GOAL: A Trigger that will fire whenever a unit morphs
Alright, so I've been playing around with unit triggers and events, and one thing I cannot get down is a generic "Unit Morphs -> Do this" (there seems to be something similar for nearly anything else a Unit does). The Trigger "Unit Uses Ability" seems to demand an exact ability to be given, and I want something more generic. Is there a way to accomplish this, perhaps another event I can utilize and then conditions I can check, without listing all my abilities that can induce a morph?
Awesome. I've actually been meaning to get into the custom scripting (the GUI just takes so long to navigate the menus), and this is just the kick start I needed! Didn't realize there were native functions that couldn't be called via the GUI either. Wish I'd taken the plunge earlier.
Now that I can detect morphs (again, much <3), I'm running into an issue with what I wanted to do with the morphs. The idea is that these morphs take some time, but can be "disabled" if the power is cut. However, upon restoring power the morph should begin where it left off. I thought it would be as easy as "Unit - Pause" and "Unit - Resume" but pausing actually causes the morph to become canceled..
Most of those functions can be called from gui - not the one that adds the events to the trigger.
Regarding pausing the morph, you could add a power user behavior such as Power User (Queue) to the unit when the power is cut - and then remove it again when the power is restored
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
GOAL: A Trigger that will fire whenever a unit morphs
Alright, so I've been playing around with unit triggers and events, and one thing I cannot get down is a generic "Unit Morphs -> Do this" (there seems to be something similar for nearly anything else a Unit does). The Trigger "Unit Uses Ability" seems to demand an exact ability to be given, and I want something more generic. Is there a way to accomplish this, perhaps another event I can utilize and then conditions I can check, without listing all my abilities that can induce a morph?
You could add the Unit uses ability event for each morph ability automatically
First the trigger that should fire when a unit morphs
morph
Events
Local Variables
Conditions
Actions
Whatever your actions are
Then a trigger to add events to this trigger
add to morph
Events
Game - Map initialization
Local Variables
count = 0 <Integer>
i = 0 <Integer>
ability = "" <String>
Conditions
Actions
General - Custom Script
lv_count = CatalogEntryCount(c_gameCatalogAbil);
lv_i=1;
while (lv_i <= lv_count)
{
lv_ability = CatalogEntryGet(c_gameCatalogAbil, lv_i);
if (AbilityClass(lv_ability) == c_classIdCAbilMorph)
{
TriggerAddEventUnitAbility(gt_morph, null, AbilityCommand(lv_ability, 0), c_unitAbilStageExecute, false);
}
lv_i = lv_i + 1;
}
@SBeier: Go
Awesome. I've actually been meaning to get into the custom scripting (the GUI just takes so long to navigate the menus), and this is just the kick start I needed! Didn't realize there were native functions that couldn't be called via the GUI either. Wish I'd taken the plunge earlier.
Now that I can detect morphs (again, much <3), I'm running into an issue with what I wanted to do with the morphs. The idea is that these morphs take some time, but can be "disabled" if the power is cut. However, upon restoring power the morph should begin where it left off. I thought it would be as easy as "Unit - Pause" and "Unit - Resume" but pausing actually causes the morph to become canceled..
Most of those functions can be called from gui - not the one that adds the events to the trigger.
Regarding pausing the morph, you could add a power user behavior such as Power User (Queue) to the unit when the power is cut - and then remove it again when the power is restored