• 🏆 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!

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.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
Plz repost the normal GUI triggers or use jass tags. When using jass u need to change a lot of the old GUI actions. U can use my tutorials. One is for GUI and how to code efficiently. The other is converting GUI to efficient jass. If u r doing jass then u should look at both. If u r doing only GUI u should look at things a GUIer should know.
 
Status
Not open for further replies.
Top