Members Online»
0 Active | 102 Guests
Online:
|
LATEST FORUM THREADS»
by StrYdeR
Posts: 3 / 155 The Future of MODSonline
In The News by KAZAM3766
Posts: 1 / 504 CoD: Battle Royale
CoD+UO Map + Mod Releases by morgawr
Posts: 1 / 2579 Damaged .pk3's
CoD Mapping by lazygit
Posts: 1 / 3095 heli to attack ai
CoD4 SP Mapping by DrBiggzz
Posts: 11 / 991 New Cod UO Rifle Mod.
CoD Mapping |
Polls»
|
Adding time display to system message window
I wrote this because I needed to have players
reach an objective by a certain time to observe
some event that I was planning.
--[[
=================================================
***Display the Current Time***
Ron "Ronbocop" Carroll
=================================================
I wrote this because I needed to have players
reach an objective by a certain time to observe
some event that I was planning.
I couldn't find any reference to display the
time except for the mission time, which doesn't
help players to know that they are 23mins into
the game after an arbitrary mission start time
of 11:45 in the morning, especially since my
mates just skip the whole menu thing to get into
the game. This game also does not have a watch
a la ARMA either.
To do this I had to get the script to know
what time it was at the start of the mission.
This is the time that is set up in the Mission
Properties area under Environment, Date & Time.
In my case this was 2009/12/05 21:03 (my team
having landed on site around 21:00 and having
unloaded the ingress boat of a cache of weapons.
IMPORTANT: If you decide to change your mission
start time, do not forget to change the
"CurrentTime" parameter to match
IMPORTANT: Remember that onTimer is one of the
few commands that does not have an underscore,
"_" to separate the function-type from the
function-name.
You can call the displayCurrentTime()
function at any point you wish, ie, after
destroying an objective, retrieving some intel
or whatever. It will not interfere with you
minute by minute update.
Hope this fleshes out your missions &
campaigns. Enjoy
=================================================
]]
function onMissionStart()
--Display Current Mission Time
displayCurrentTime()
--Call routine to Display Current Time
--again after a minute
OFP:addTimer("DisplayTime",60000) --60x1000msec
end
--Display the CurrentTime
function displayCurrentTime()
--Mission time at start = 0
--21x60 mins per hour x60 secs per minute x1000msec
--to give 21:00hrs or 9pm +
--3x60 secs per minute x1000msec
--to give xx:03mins
CurrentTime = OFP:getMissionTime() + (21*60*60*1000) + (3*60*1000)
--Format for obtaining readable time from a calculated
--number in millisecongds
Hours, Minutes, Seconds = OFP:convertTimeToHMS(CurrentTime)
--Since 21:3:0 does not look like readable time you
--need to inflate or insert a zero into the text
if Minutes < 10 then
Minutes = "0" .. Minutes
end
if Seconds < 10 then
Seconds = "0" .. Seconds
end
--The "double full stops" is Lua's concatenate function
--The result will be a message in the bottom left corner
--ie "The Current Time is:- 21:03:00"
OFP:displaySystemMessage("Current Time is:- " .. Hours .. ":" .. Minutes .. ":" .. Seconds) -- remove the space before display
end
--Call the time every minute
function onTimerDisplayTime()
--[[You may delete the DisplayTime() timer here if you
wish as per normal but I haven't had a problem with it.]]
--OFP:removeTimer()
--Call the displayCurrentTime() function again
displayCurrentTime()
--Initiate this timer again to run 1min later
OFP:setTimer("DisplayTime",60000)
end
Latest Syndicated News»
Comments: 5
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which... Comments: 5
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ... Comments: 5
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead?
... Comments: 5
Codutility.com up and runn...
It seems to me the like the site is completely dead? Comments: 5
Codutility.com up and runn...
Yeeaahhhh.........
|
Latest Downloads»
OHMY Don Quixote
Call of Duty 2: Maps: Multiplayer (5.76Mb) OHMY Neuburg
Call of Duty 2: Maps: Multiplayer (6.84Mb) OHMY Tebessa
Call of Duty 2: Maps: Multiplayer (7.36Mb) OHMY POW Camp
Call of Duty 2: Maps: Multiplayer (2.15Mb) OHMY Valley
Call of Duty 2: Maps: Multiplayer (5.7Mb) |
Partners & Friends»
|
Site Links and Information
|
Partners
|
Friends
|
Copyright © MODSonline LLC
Tresware Content Management System © 2011
Website Designed by LKFX and Developed by Tresware