- Joined
- Mar 21, 2011
- Messages
- 1,622
Hi guys,
i am using a few RegisterVariableEvents in my map to create custom events. This is the base function:
To trigger the custom event, i do this for example:
Initialization:
I have a few other custom events, like a custom "A unit dies"-Event. Now, when i create a trigger with the "unit dies" event, and the function called triggers another custom event, like a coin change, it will never jump back to all the other "on death" events.
Example:
-> i have initialized three "On Death"-Events.
-> a unit dies -> event variable is set, first of the three events is fired.
-> first onDeath function is called
-> now the second initialized "On Death"-event is fired.
-> second onDeath function is called and contains a coin change, so this is executed:
-> before the last onDeath event is fired, all the CoinChange events are fired (lets say there is only one CoinChange event)
-> onCoinChange function is called
-> and here it stops, the last onDeath function will never be called.
I hope it is somewhat understandable what i am trying to say. Is there an easy fix for that? Thanks in advance.
i am using a few RegisterVariableEvents in my map to create custom events. This is the base function:
JASS:
function RegisterEvent takes string varName, code c returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterVariableEvent(t, varName, EQUAL, 1.0)
call TriggerAddCondition(t, Filter(c))
set t = null
endfunction
JASS:
method operator coins= takes integer amount returns nothing
if amount < 0 then
set amount = 0
endif
set this.vCoins = amount
set CoinChangeController = this
set EVENT_CONTROLLER_COINCHANGE = 0.0
set EVENT_CONTROLLER_COINCHANGE = 1.0
set EVENT_CONTROLLER_COINCHANGE = 0.0
endmethod
JASS:
call RegisterEvent("EVENT_CONTROLLER_COINCHANGE", function thistype.onCoinChange)
I have a few other custom events, like a custom "A unit dies"-Event. Now, when i create a trigger with the "unit dies" event, and the function called triggers another custom event, like a coin change, it will never jump back to all the other "on death" events.
Example:
-> i have initialized three "On Death"-Events.
-> a unit dies -> event variable is set, first of the three events is fired.
-> first onDeath function is called
-> now the second initialized "On Death"-event is fired.
-> second onDeath function is called and contains a coin change, so this is executed:
JASS:
set EVENT_CONTROLLER_COINCHANGE = 0.0
set EVENT_CONTROLLER_COINCHANGE = 1.0
set EVENT_CONTROLLER_COINCHANGE = 0.0
-> onCoinChange function is called
-> and here it stops, the last onDeath function will never be called.
I hope it is somewhat understandable what i am trying to say. Is there an easy fix for that? Thanks in advance.



