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

Need help with trigger

Status
Not open for further replies.
Level 1
Joined
Jul 17, 2013
Messages
2
Hi
I try to add "give 1 gold every second" and "set population to 100 after 60 seconds is elapsed" into a map.
I use the worldeditor GUI trigger editor to create the scripts and then convert it to custom text. Lastly, I copy and paste to war3map.j.
I tested the map but my additional scripts doesn't work.

scripts
function Trig_Give_Gold_Conditions takes nothing returns boolean
if ( not ( IsPlayerInForce(GetEnumPlayer(), GetPlayersAll()) == true ) ) then
return false
endif
return true
endfunction

function Trig_Give_Gold_Func001002 takes nothing returns nothing
call AdjustPlayerStateBJ( 1, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD )
endfunction

function Trig_Give_Gold_Actions takes nothing returns nothing
call ForForce( GetPlayersAll(), function Trig_Give_Gold_Func001002 )
endfunction

//===========================================================================
function InitTrig_Give_Gold takes nothing returns nothing
set gg_trg_Give_Gold = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Give_Gold, 1.00 )
call TriggerAddCondition( gg_trg_Give_Gold, Condition( function Trig_Give_Gold_Conditions ) )
call TriggerAddAction( gg_trg_Give_Gold, function Trig_Give_Gold_Actions )
endfunction

function Trig_Food_Func001002 takes nothing returns nothing
call SetPlayerStateBJ( GetEnumPlayer(), PLAYER_STATE_RESOURCE_FOOD_CAP, 100 )
endfunction

function Trig_Food_Actions takes nothing returns nothing
call ForForce( GetPlayersAll(), function Trig_Food_Func001002 )
endfunction

//===========================================================================
function InitTrig_Food takes nothing returns nothing
set gg_trg_Food = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Food, 30.00 )
call TriggerAddAction( gg_trg_Food, function Trig_Food_Actions )
endfunction
Please help! Thanks.
 
Status
Not open for further replies.
Top