HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Global and Local Triggers

12-04-2007, 09:54 AM#1
chobibo
Its me again with another noobish question!
I'm wondering, whats more efficient to use for spells, a local trigger or a global trigger? also, in a global trigger, should I destroy triggeractions and triggerconditions? Thanks!
12-04-2007, 10:00 AM#2
Malf
Depends on what you use them for.
12-04-2007, 10:06 AM#3
chobibo
How about spells? Sorry I can't rep anymore today ill be sure to +REP you tomorrow, Thanks for all the help man!
12-04-2007, 10:15 AM#4
Malf
Spells like?
12-04-2007, 10:22 AM#5
chobibo
100 % Jass spells that are MUI
12-04-2007, 10:28 AM#6
Malf
What kind of spells, really.

I don't even think using triggers for spells are needed, they're overkill.
12-04-2007, 10:40 AM#7
chobibo
No I mean Jass Custom Spells// Triggered Spells, not the ordinary warcraft spells like strom bolt lol, I mean the ones like in the resources section.
12-04-2007, 10:53 AM#8
Jazradel
Doesn't really matter if it's only created once. And if a trigger needs to be created more than once, you probably need to rethink your code.
12-04-2007, 10:54 AM#9
Malf
You already said that. I have not seen any spell in the resource section that uses triggers.
12-04-2007, 11:15 AM#10
Troll-Brain
and what about a global trigger with local variables ?
And of course you can destroy actions and conditions on a global trigger, but why ?
12-04-2007, 12:36 PM#11
chobibo
Ok, I think I got it. I was talking about the last function in a trigger that creates a trigger, this one:
Collapse JASS:
function InitTrig_Holy_Light takes nothing returns nothing
    local integer i = 0
    // global variable ?
    set gg_trg_Holy_Light = CreateTrigger(  ) 
    // or local gg_trg_Holy_Light = CreateTrigger( )
    loop
        call TriggerRegisterPlayerUnitEvent( gg_trg_Holy_Light, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
        set i = i + 1
        exitwhen i== bj_MAX_PLAYERS
    endloop

    call TriggerAddCondition( gg_trg_Holy_Light, Condition( function HolyLightcondition ) )
    call TriggerAddAction( gg_trg_Holy_Light, function HolyLightactions )
endfunction
edit: I think I called it incorrectly, this is what I was talking about should I use the gg_trg_something or use a local instead sorry for the wrong question. Thanks to Jaz, that was the answer I was looking for. I'll REP you tomorrow coz I already cant now
12-04-2007, 01:34 PM#12
Vexorian
Quote:
Originally Posted by Malf
What kind of spells, really.

I don't even think using triggers for spells are needed, they're overkill.
I don't think you can even detect when a unit casts the spell without using a trigger.
12-04-2007, 08:31 PM#13
Deaod
The only place where you will need a global variable for a trigger is when you disable/enable the trigger in some other function. And that will happen only in some really rare cases. So, why dont you use local trigger vars since those cant be modified easily and are a bit faster.
12-05-2007, 06:36 AM#14
Pyrogasm
Quote:
Originally Posted by Deaod
So, why dont you use local trigger vars since those cant be modified easily and are a bit faster.
Wha...? That doesn't make any sense. Nor would it matter, really.
12-05-2007, 07:08 AM#15
chobibo
Ok guys I'll just keep using globals since I'm not having any trouble with it. Thanks to all who replied, sorry I cant REP you guys right now.