Jass Starter, displaying Text not working?

YourFace

<span style="color:#9C9C9C;"><strong>Runner Up - T
Reaction score
91
JASS:
function Trig_Untitled_Trigger_001_KillPickedUnit takes nothing returns nothing
    call KillUnit( GetEnumUnit() )
    call DisplayTextToForce( GetPlayersAll(), a )
endfunction

function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    local string a = &quot;you lost 1 footmen sorry&quot;
    set udg_unitgroup = GetUnitsInRectAll(GetPlayableMapRect())
    call ForGroupBJ( udg_unitgroup, function Trig_Untitled_Trigger_001_KillPickedUnit)
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction

This is like my second trigger in jass and whenever i test the map, it goes to the options screen where you go to log on
I want it so that this trigger to kill every unit in the map and for every unit that dies, it will display "you lost one footmen sorry"
thanks in advane +rep
 

Joker(Div)

Always Here..
Reaction score
86
JASS:
function Trig_Untitled_Trigger_001_KillPickedUnit takes nothing returns nothing
    local string a = &quot;you lost 1 footmen sorry&quot; //&lt;--- Locals only work inside the function they are called in.
    call KillUnit( GetEnumUnit() )
    call DisplayTextToForce( GetPlayersAll(), a )
endfunction

function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    set udg_unitgroup = GetUnitsInRectAll(GetPlayableMapRect())
    call ForGroupBJ( udg_unitgroup, function Trig_Untitled_Trigger_001_KillPickedUnit)
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
 

YourFace

<span style="color:#9C9C9C;"><strong>Runner Up - T
Reaction score
91
oooooooooohhhhhhhhhhhhhh i never knew that
+rep
 

SFilip

Gone but not forgotten
Reaction score
634
> Locals cannot be passed between functions without special systems.
In case of ForGroup/ForForce, globals would do. In this particular case, just defining the local in the other function is enough, as Joker pointed out.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top