• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Wierd problem importing code to map

Status
Not open for further replies.
Level 4
Joined
Jul 24, 2008
Messages
108
So i got these 2 maps, pretty much the same concept, both tag maps, my friend wanted me to code his tag map, so i said sure just make hte terrain. Now im trying to use the exact same code that works in my map, in his. all the variables except for one is local (which i made). there are no locations in it. all the unit ID's have been changed to the correct ones but the trigger does not do anything. So question, does

call TriggerRegisterDeathEvent(gg_trg_deathtrig,GetEnumUnit())

does that only apply to nonhero units? What are things that could be happening so it doesn't work, 3 outa the 4 triggers do work that i imported. Its like the trigger doesn't even go off. Here it is, anything wrong with it?
JASS:
function InitTrig_deathtrig takes nothing returns nothing
    set gg_trg_deathtrig = CreateTrigger(  )
    call TriggerRegisterDeathEvent(gg_trg_deathtrig,GetEnumUnit())
    call TriggerAddCondition(gg_trg_deathtrig, Condition(function isrunner))
    call TriggerAddAction(gg_trg_deathtrig, function death)
endfunction
I have already tried getting rid of the conditions to see if it will go off when a unit dies and it doesn't. I've added a debug message to see if function death is actaully going off and nothing happened
 
Level 7
Joined
Jul 20, 2008
Messages
377
The problem is with your event. You have GetEnumUnit() in a global trigger initialization function. You are not calling it from ForGroup.
 
Level 4
Joined
Jul 24, 2008
Messages
108
Oh i just figured it out. using
JASS:
call TriggerRegisterAnyUnitEventBJ( gg_trg_deathtrig, EVENT_PLAYER_UNIT_DEATH )

but from what im to understand using BJ functions are bad right? so is there an alternate way of doing this?
 
Level 7
Joined
Jul 20, 2008
Messages
377
It's not bad in this situation. The bj is only called once, and it's at the beginning of the game, so there is nothing to worry about.

BJs are fine in some situations, this is one of them.
 
Level 10
Joined
Jun 26, 2005
Messages
236
That BJ is fine, but if you really want the alternate way, it's:

JASS:
function a0 takes nothing returns nothing
    local integer i = 0

    loop
        set i = i + 1
        call TriggerRegisterPlayerUnitEvent(gg_trg_deathtrig, Player(i), EVENT_PLAYER_UNIT_DEATH, null)
        exitwhen i == bj_MAX_PLAYER_SLOTS
    endloop
endfunction
 
Status
Not open for further replies.
Top