I am trying to make a new game mode where the objective is to hold out as long as you can against the enemy. I want a timer to count down till you win the match, also the player only get one life in the game mode.
Now I got the one life thing and the force player on team 1 stuff all figured out, however, I can't figure out how to create a timer that counts down till victory (you win the match after the timer hits 0).
If anyone could help me create this timer counting down until victory funtion I would be grateful!
.lua scripting help (timer related) [Solved]
Moderator: Moderators
-
- Sergeant Major
- Posts: 234
- Joined: Sat Feb 04, 2017 5:52 pm
- xbox live or psn: No gamertag set
- Location: Milky Way, Solar System, Earth, Antarctica
.lua scripting help (timer related) [Solved]
Last edited by LitFam on Sun Dec 17, 2017 2:01 am, edited 1 time in total.
- Lorul1
- Rebel Colonel
- Posts: 562
- Joined: Wed Apr 24, 2013 10:34 pm
- Projects :: Assault on Theed
- xbox live or psn: No gamertag set
- Location: Your House
Re: .lua scripting help (timer related)
Add this code under function ScriptPostLoad() and above function ScriptInit() in your lua
Explanation & tips :
Code: Select all
Gamestarter = OnCharacterSpawn(
function(player)
if IsCharacterHuman(player) then
StartTimer(loser)
ShowTimer(loser)
end
end
)
loser = CreateTimer("loser")
SetTimerValue(loser, 60)
OnTimerElapse(
function(timer)
MissionVictory(DEF)
DestroyTimer(loser)
end,
loser
)
Hidden/Spoiler:
-
- Sergeant Major
- Posts: 234
- Joined: Sat Feb 04, 2017 5:52 pm
- xbox live or psn: No gamertag set
- Location: Milky Way, Solar System, Earth, Antarctica