- Joined
- Dec 18, 2007
- Messages
- 205
Hi guys
I was just starting to trigger once again with the new patch where i directly discovered the new handle problem. I know that there are hashtables now, but I just don't know whether some things aren't working or are working correct.
At first I'll post you here the trigger how I am scripting a spell at the moment at which i get stuck by an error. If you want, first read the problems below and afterwards look at the script.
First Question:
Is the trigger still MUI? I mean with HandleVars there was the flush trigger (which i never understood, but which worked for MUI i think). now in the hashtable i found those 2 flush functions, but how do i have to use them to let the trigger work properly and when? With handle vars i used the flush trigger after destroying the timer.
Second Question:
If i create some spells, do i have to use different parent and child keys?
actualy i use for each spell another parent key and for each stored variable a different child key of the parent key.
so spell 1 uses parent key 0 and child keys 0-2
spell 2 uses parent key 1 and child key 0 and 1
is that correct?
Last Question that deals with the trigger itself:
I cannot save the map because the error in the Timer_Effects trigger says this line has an syntax error.
why can't i save the boolean? i know that i could store the value as an integer (0 and 1), but why can't i save it?
Thank you for reading and helping in advance!
grertings, bReathl3sS
I was just starting to trigger once again with the new patch where i directly discovered the new handle problem. I know that there are hashtables now, but I just don't know whether some things aren't working or are working correct.
At first I'll post you here the trigger how I am scripting a spell at the moment at which i get stuck by an error. If you want, first read the problems below and afterwards look at the script.
JASS:
//My hash trigger is defined in the map header btw like this:
globals
hashtable hash = InitHashtable()
endglobals
//=========================================================================
scope EnchantTotem initializer Init
private function Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetAttacker(), 'B005')>0 //Buff
endfunction
private function Timer_Effects takes nothing returns nothing
if LoadBoolean(hash, 1, 1) and GetUnitCurrentOrder(LoadUnitHandle(hash, 1, 0)) != String2OrderIdBJ("attack") then
SaveBoolean(hash, 1, 1, false)
endif
endfunction
private function Actions takes nothing returns nothing
local unit attacker = GetAttacker()
local timer t = CreateTimer()
call SaveUnitHandle(hash, 1, 0, attacker)
call SaveBoolean(hash, 1, 1, true)
call TimerStart(t, 0.03, true, function Timer_Effects)
call TriggerSleepAction(0.4)
call PauseTimer(t)
call DestroyTimer(t)
if LoadBoolean(hash, 1, 1) then
call UnitRemoveAbility(attacker, 'B005')
endif
set attacker = null
endfunction
//=========================================================================
private function Init takes nothing returns nothing
local trigger Enchant_Totem = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Enchant_Totem, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition(Enchant_Totem, Condition( function Conditions ) )
call TriggerAddAction(Enchant_Totem, function Actions )
set Enchant_Totem = null
endfunction
endscope
First Question:
Is the trigger still MUI? I mean with HandleVars there was the flush trigger (which i never understood, but which worked for MUI i think). now in the hashtable i found those 2 flush functions, but how do i have to use them to let the trigger work properly and when? With handle vars i used the flush trigger after destroying the timer.
Second Question:
If i create some spells, do i have to use different parent and child keys?
actualy i use for each spell another parent key and for each stored variable a different child key of the parent key.
so spell 1 uses parent key 0 and child keys 0-2
spell 2 uses parent key 1 and child key 0 and 1
is that correct?
Last Question that deals with the trigger itself:
I cannot save the map because the error in the Timer_Effects trigger says this line has an syntax error.
JASS:
SaveBoolean(hash, 1, 1, false)
Thank you for reading and helping in advance!
grertings, bReathl3sS