Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds
Watch MODSonair

Members Online

»
0 Active | 250 Guests
Online:

LATEST FORUM THREADS

»
New BF2 Mod
BF2 General

Tutorials

»
OFP2
ratings:
Awful Rating
Poor Rating
Average Rating
Good Rating
Excellent Rating
Create a Timer for triggering Events
Versions: You must be logged in to view history.

Zeroy shows us how to create a timer for triggering events

Dragon Rising: Create a Timer for triggering Events

When you add a timer it will count from the start time down to 0 at which point the function onTimer_TIMERNAME(name) becomes usable.

Say you want to have Echelon1 moving from one location to another 5 minutes after your Player and his Fireteam entered triggerzone1:

Code:

function onEnter_triggerzone1(zoneName, UnitName)
OFP:addTimer("timer1", 300000) -- 300000ms = 5mins
hours, minutes, seconds = OFP: convertTimeToHMS(OFP:getTimer("timer1"));
OFP:displaySystemMessage("The time: " .. hours .. ":" .. minutes .. ":" .. seconds);
OFP:disableEvent("onEnter_triggerzone1")
end
In the above the timer "timer1" is created when anyone enters triggerzone1, the timer is then display as in "HH:MM:SS" once only (i dont know how to have it permanent and decreasing yet) Note: the disableEvent is so that the Timer isnt created each time someone steps out of the triggerzone (it removes the trigger essentially) Next:
Code:

function onTimer_timer1(name)
OFP:activateEntitySet("Echelon1")
OFP:move("Echelon1", "waypoint", "ADDTOFRONT")
end
This last bit will spawn and move the Echelon1 to the waypoint when the timer is up. You could also use the timer to end a mission:
Code:

function onTimer_timer1(name)
OFP:setObjectiveState("Objective", "COMPLETED")
OFP:removeTimer("timer1")
OFP:missionCompleted()
end

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»