• 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.

[JASS] Problem with the guide from Vexorian

Status
Not open for further replies.
Level 1
Joined
Apr 10, 2010
Messages
1
Im trying to learn JASS through the first guide of Vexorian, but I've encountered a problem and really can't see what I'm doing wrong.

This is the trigger at map initialization, which should be a global variable according to the guide:

JASS:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerRegisterUnitEvent( gg_trg_Untitled_Trigger_001, gg_unit_hsor_0002, EVENT_UNIT_DEATH )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction

Then there's the function that calls the global variable from above to get the unit name of gg_unit_hsor0002:

JASS:
function Trig_JASS_test_Actions takes nothing returns nothing
    call DisplayTextToForce( GetPlayersAll(), GetUnitName(gg_unit_hsor_0002) )
endfunction

Now if I change the number for the unit to 0000 (which it is for me) and I write the last function under the first, it still doesn't work. If i put the call command from the last function into the first, it actually does work, so i think the problem is that the first one isn't global. Problem is I don't know what to do about that.

Oh and is it possible for me to learn JASS while I never worked with the GUI before?
 
The World Editor only generates globals when they need to. To generate a global for a unit, make a new trigger, and do something like "Kill Unit" and select the unit on the map. Then just convert it to custom text, and copy the part with gg_unit_ in it and use that. (You can delete the new trigger now)

In fact, this might help:
http://www.hiveworkshop.com/forums/...ls-278/mini-tutorial-generated-globals-43391/

=)
 
Status
Not open for further replies.
Top