HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: Changing attributes based on trigger event  (Read 1240 times)

wallace_balaniuc

  • Developer
  • *
  • Posts: 9
    • View Profile
Changing attributes based on trigger event
« on: Jul 09, 13, 11:59:17 AM »

Greeting!

I'm new to HeroEngine and currently trying to wrap my head around all of it's systems.

Currently I'm working on a small "capture the tower" prototype in which each tower is represented by a CleanEngine asset (gothic arch). Each tower is enclosed in a trigger.

What i'm trying to do is simply change the color attribute of the arch when a player enters into the trigger.

The tutorial on the wiki shows how to change the attribute based on a mouse event, but I'm unsure on how to do it through a trigger event.

Thanks!
Logged
Lead Programmer - Gallium Gaming

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Changing attributes based on trigger event
« Reply #1 on: Jul 09, 13, 02:14:00 PM »

Have you read through this page completely?
http://hewiki.heroengine.com/wiki/Triggers

Specifically, the section Catching Trigger Events in Script.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

wallace_balaniuc

  • Developer
  • *
  • Posts: 9
    • View Profile
Re: Changing attributes based on trigger event
« Reply #2 on: Jul 09, 13, 03:01:06 PM »

Thanks for the response.

I have read that page. The issue I'm seeing is that the parameter passed into the function/method in my case would be the character (since it's the character that triggers the script call...it is being passed into the function).

What I would like is access to the attributes of an object (the gothic arch) currently inside of the triggers area.

I did register the object as shown in this tutorial http://hewiki.heroengine.com/wiki/Your_First_HSL_Script but am not sure how to use the object in the script.

Thanks again
Logged
Lead Programmer - Gallium Gaming

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Changing attributes based on trigger event
« Reply #3 on: Jul 09, 13, 04:19:03 PM »

The trigger has a UserData field on the trigger that can contain anything pertinent you might wish to attach.  So for each trigger in your area, you could enter the ID of the tower that goes with that trigger into its UserData.  Then in the event callback, assign the trigger's User Data to a noderef of class HBNode and set its color properties.

Other approaches would be to create an associate between the trigger and tower, or perhaps easiest is to use the HeroBlade toolbar to parent the trigger to its tower (where the tower is the parent).  Then you can read the tower ID from the ParentInstance field of the trigger, plus if you move the tower around the the trigger will move with it.

Of course, you could either glom a class onto each trigger via the DOM Editor and use methods, or use functions in an assigned script.  Either way, "me" would refer to the trigger.
« Last Edit: Jul 09, 13, 04:23:57 PM by ScottZarnke »
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

wallace_balaniuc

  • Developer
  • *
  • Posts: 9
    • View Profile
Re: Changing attributes based on trigger event
« Reply #4 on: Jul 10, 13, 11:55:00 AM »

Excellent! The info got me going in the right direction.

Appreciate it.
Logged
Lead Programmer - Gallium Gaming