• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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