• 🏆 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!

[JASS] Problems with a function to add events to trigger

Status
Not open for further replies.
Level 2
Joined
Jun 5, 2006
Messages
18
JASS:
//The trigger gg_trg_ON_GetHit exist in my map

//===========================================================================
function FDD_AddToDS takes nothing returns nothing
    call TriggerRegisterUnitEvent(gg_trg_ON_GetHit,bj_lastCreatedUnit,EVENT_UNIT_DAMAGED)    
endfunction
//===========================================================================
function FDD_InitializeDS takes nothing returns nothing
    call TriggerRegisterUnitEvent(gg_trg_ON_GetHit,GetEnumUnit(),EVENT_UNIT_DAMAGED)
endfunction
//===========================================================================
function FDD_CreateUnit takes player id, integer unitid, real x, real y, real facex, real facey returns unit
    local unit u = CreateUnit(id,unitid,x,y,AngleBetweenPoints(Location(x,y),Location(facex,facey)))
    call TriggerAddAction( gg_trg_ON_GetHit, function FDD_AddToDS )
    return u
endfunction

I can't understand why it doesn't work...
 
Level 6
Joined
Jun 30, 2006
Messages
230
I'm not so sure what it's supposed to do. Why do you have two different events registered?

Post ALL the code relevant to this trigger(s), and then maybe I can help you. I don't even know what gg_trg_ON_GetHit is, so I can't tell you anything.
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
CreateUnit function doesn't put the unit created in bj_lastCreatedUnit, you have to add it manually. I already wrote that, but it seems something was wrong and my post isn't here (I hate this site, laggs like hell :().... btw do you have set gg_trg_ON_GetHit = CreateTrigger() somwehere?
 
Level 2
Joined
Jun 5, 2006
Messages
18
mh...i've corrected it guys, the problem was that i forgot to declare bj_lastCreatedUnit in the event and nothing more...btw thanks for reading :)

are there any way to intercet the attacktype and damagetype of the damage received by a unit?

oh and as you noticed me FDD_AddToDS was a useless function because i register two times the event (i removed it)...well actually i don't know why i've done this, probably i were a little bit out of head while doing that ...lol
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Fire-Dragon-DoL said:
]the problem was that i forgot to declare bj_lastCreatedUnit in the event and nothing more...

Silvenon said:
CreateUnit function doesn't put the unit created in bj_lastCreatedUnit, you have to add it manually


Fire-Dragon-DoL said:
are there any way to intercet the attacktype and damagetype of the damage received by a unit?

Nope, I think it's impossible.
 
Status
Not open for further replies.
Top