Types/Trigger

From SC2Mapster Wiki
Jump to: navigation, search

Trigger

  • Trigger is a special kind of function.

You need a Function for all Actions inside the Trigger:

bool libNtve_gt__BB_BossHPChanged_Func (bool testConds, bool runActions) {
    //...
    return true;
}
  • textConds will be True if all Condition are OK
  • runActions will be True if the trigger should run

Now we need to link this function to a Trigger, add event:

void libNtve_gt__BB_BossHPChanged_Init () {
    //make trigger
    libNtve_gt__BB_BossHPChanged = TriggerCreate("libNtve_gt__BB_BossHPChanged_Func");
    //Enable trigger
    TriggerEnable(libNtve_gt__BB_BossHPChanged, false);
    //Add event. 
    TriggerAddEventUnitProperty(libNtve_gt__BB_BossHPChanged, null, c_unitPropLife);
    TriggerAddEventUnitProperty(libNtve_gt__BB_BossHPChanged, null, c_unitPropShields);
}