• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

jass question

Status
Not open for further replies.
Level 12
Joined
Jan 30, 2009
Messages
1,067
I'm not entirely sure what you are asking?

Are you asking when to start using actions?
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
The first function that gets run by engine ingame is the "main" function, which you normally do not see in standard editor/JNGP. This main function can run other functions such as the init functions of your triggers. To run something, you can either do a direct call with call function(<params>), a more indirect call via a native function like ForGroup(<group>, <code>) or you set up a trigger with an action block and an event (TriggerRegister...) that gets automatically fired by engine.

Take a look through the functions list or if you used GUI before, convert some stuff.

By default, each trigger leaf that you create in editor gets one "InitTrig_<trigName>" function that is registered for being run by the main function in beginning.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Not directly to the functions but trigger handles.

JASS:
function init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerAddAction(t, function yourFunction) or TriggerAddCondition(t, Condition(function yourFunction))
    call TriggerRegister...(t, ...)
    set t = null
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
Well, i noticed the add action and add condtion can be binded to a function (i think since i cant really read the jass) while the event only be binded to a trigger how do i make the event execute something then? Because i have heard that jass can use multiple events in same trigger so you only need one big trigger for things. if the event you scroll through all functions that wont work
JASS:
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Untitled_Trigger_001, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Untitled_Trigger_001, Condition( function Trig_Untitled_Trigger_001_Conditions ) )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
The event fires the trigger and the trigger fires the conditions/actions. If multiple events are registered for a trigger, when any of those events occurs, the trigger will be fired.

Stuffing everything in one trigger would not be so smart. You cannot perfectly differentiate which event occured and checking this would take some performance. Accumulating events on one trigger only makes sense when those events should run about the same conditions/actions.
 
Status
Not open for further replies.
Top