- Joined
- Feb 13, 2009
- Messages
- 388
Greetings, after a lot of time being away I finally decided to return to WC3 modding but this time I try to not to touch GUI and I've started to learn JASS.
That's the story.
Now to facts.
I want to make a trigger which loops though players, checks if they are present and gives "selector units" (currently wisps) to buy heroes from a tavern.
I have two syntax errors regarding function( parameter ), without ( parameter ) it produces no syntax errors but then it doesn't pass the parameter "i" to the function. I feel like I am doing something really stupid here, but can you answer me, why can't I use a parameter here if I specify "takes integer i" in the functions'?
(!) indicate 2 strings with errors (there're not present in the actual jass text).
That's the story.
Now to facts.
I want to make a trigger which loops though players, checks if they are present and gives "selector units" (currently wisps) to buy heroes from a tavern.
I have two syntax errors regarding function( parameter ), without ( parameter ) it produces no syntax errors but then it doesn't pass the parameter "i" to the function. I feel like I am doing something really stupid here, but can you answer me, why can't I use a parameter here if I specify "takes integer i" in the functions'?
JASS:
//===========================================================================
// Trigger: GiveSelectors
//===========================================================================
function Trig_GiveSelectors_Conditions takes integer i returns boolean
if ( not ( GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING ) ) then
return false
endif
return true
endfunction
function Trig_GiveSelectors_Actions takes integer i returns nothing
call CreateNUnitsAtLocFacingLocBJ( 1, 'ewsp', Player(i), GetRectCenter(gg_rct_HumansSpawn), GetRectCenter(GetPlayableMapRect()) )
endfunction
//===========================================================================
function InitTrig_GiveSelectors takes nothing returns nothing
local integer i = 0
set gg_trg_GiveSelectors = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_GiveSelectors, 1.00 )
loop
exitwhen i > 9
(!) call TriggerAddCondition( gg_trg_GiveSelectors, Condition( function Trig_GiveSelectors_Conditions(i) ) )
(!) call TriggerAddAction( gg_trg_GiveSelectors, function Trig_GiveSelectors_Actions(i) )
set i = i + 1
endloop
endfunction
//===========================================================================
(!) indicate 2 strings with errors (there're not present in the actual jass text).