Another timer question
Moderator: Moderators
-
SniperWolf
- Colour Sergeant
- Posts: 89
- Joined: Sat Dec 18, 2004 5:14 am
- Location: New York, USA
- Contact:
Another timer question
Looking to make a timer that counts down from 2 minutes to 0. I'm looking to see how many targets a player can shoot in a certain time.
Can it be done??
Can it be done??
We could do a thing with the stop watch - and I recomend 1 min. thats what the stop watch will start at max.
The tracking of hits for individual players is tricky. need to make an array - the hard thing is tracking the players if they leave the server, etc. if not done properly players end up with other players scores or worse the server crash. I could start it but I would need a seasoned scripter to help finish it. lol
The tracking of hits for individual players is tricky. need to make an array - the hard thing is tracking the players if they leave the server, etc. if not done properly players end up with other players scores or worse the server crash. I could start it but I would need a seasoned scripter to help finish it. lol
-
SniperWolf
- Colour Sergeant
- Posts: 89
- Joined: Sat Dec 18, 2004 5:14 am
- Location: New York, USA
- Contact:
Well tracking the targets we don't have to worry about really. The Instructors of the Boot Camp can count them physically.
Is it possible to use the timer for round based or obj maps? From the top right corner of the hud?
Or can we run a 1 minute stop watch back to back(to make 2 minute)then have it sound an alarm?
Is it possible to use the timer for round based or obj maps? From the top right corner of the hud?
Or can we run a 1 minute stop watch back to back(to make 2 minute)then have it sound an alarm?
Well here is my stab at what you want. All this does is watches the player who uses the trigger. It gives the player a stop watch on the left middle screen. It messages the player and the server that the clock started. after one minute the watch starts counting down. then at the end of minute two it says times up.
The timer is deactivated if the player dies, drops to spec or leaves the server.
The timer is deactivated if the player dies, drops to spec or leaves the server.
Code: Select all
main local.origin:
local.trigger = spawn trigger_use
local.trigger model "static/corona_orange.tik"
local.trigger.origin = local.origin
local.trigger.scale = .8
local.trigger light 1 0 0 50
local.trigger setthread do_random
local.trigger show
level.target_time = 120
end
do_random:
self nottriggerable
local.player = parm.other
if(local.player.inuse)
{
self triggerable
end
}
else
{
local.player.inuse = 1
local.player thread doit
}
self triggerable
end
doit:
iprintln "Clock Started"
self iprint ("Start Shooting!") 1
local.result = self waitthread scan_player level.target_time
if(local.result != left)
{
self.inuse = 0
}
end
scan_player local.time:
local.result = ok
local.team = self.dmteam
self stopwatch local.time
local.count = 0
while(1)
{
if(self == NULL)
{
local.result = left
end local.result
}
else
{
if(self.dmteam != local.team || !isalive self)
{
self stopwatch 0
end local.result
}
else
{
local.count++
if((local.count / 10) >= local.time)
{
self stopwatch 0
self iprint ("Time is up!") 1
iprintln "Clock Stopped"
end local.result
}
}
}
wait 0.1
}
end-
SniperWolf
- Colour Sergeant
- Posts: 89
- Joined: Sat Dec 18, 2004 5:14 am
- Location: New York, USA
- Contact:
either.
in map script after prespawn (change it from main to something like stopwatchtimer)
in map script after prespawn (change it from main to something like stopwatchtimer)
Code: Select all
local.o = (x y z)
thread stopwatchtimer local.o
[code]
or name it and put it in global folder
[code]
exec global/stopwatchtimer.scr (x y z)
[code]
-
SniperWolf
- Colour Sergeant
- Posts: 89
- Joined: Sat Dec 18, 2004 5:14 am
- Location: New York, USA
- Contact:
Here you go...
Code: Select all
main local.origin:
local.master = spawn ScriptMaster
local.master aliascache m6l3c_alarm sound/mechanics/Mec_Alarm_05.wav soundparms 1.0 0.0 1.0 0.0 160 1200 auto loaded maps "m dm moh obj train"
local.trigger = spawn trigger_use targetname starttimer
local.trigger model "static/corona_orange.tik"
local.trigger.origin = local.origin
local.trigger.scale = .8
local.trigger light 1 0 0 50
local.trigger setthread do_random
local.trigger show
level.target_time = 60
end
do_random:
self nottriggerable
local.player = parm.other
if(local.player.inuse)
{
self triggerable
end
}
else
{
local.player.inuse = 1
local.player thread doit
}
self triggerable
end
doit:
iprintln "Clock Started"
self iprint ("Start Shooting!") 1
local.result = self waitthread scan_player level.target_time
if(local.result != left)
{
self.inuse = 0
}
end
scan_player local.time:
local.result = ok
local.team = self.dmteam
self stopwatch local.time
local.count = 0
while(1)
{
if(self == NULL)
{
local.result = left
end local.result
}
else
{
if(self.dmteam != local.team || !isalive self)
{
self stopwatch 0
end local.result
}
else
{
local.count++
if((local.count / 10) >= local.time)
{
self stopwatch 0
self iprint ("Time is up!") 1
iprintln "Clock Stopped"
$starttimer playsound m6l3c_alarm
end local.result
}
}
}
wait 0.1
}
end-
SniperWolf
- Colour Sergeant
- Posts: 89
- Joined: Sat Dec 18, 2004 5:14 am
- Location: New York, USA
- Contact:
-
SniperWolf
- Colour Sergeant
- Posts: 89
- Joined: Sat Dec 18, 2004 5:14 am
- Location: New York, USA
- Contact:
name this something like traininguber and put it in a folder named ubersound and pak it with your map.
That's it. I think that should do it.
That's it. I think that should do it.
Code: Select all
//========================================================================================
// UBERSOUND FILE
//========================================================================================
// aliascache(alias) <aliasname> <soundfile> soundparms <basevol> <volmod> <basepitch> <pitchmod> <minDist> <maxDist> <channel> loaded(streamed) maps "<mapstring>"
//========================================================================================
// MIN DIST AND MAX DIST: Sound has a linear fall-off rate from minDist to maxDist. If the player is within minDist, sound is at full volume. 16 Units = 1 Foot.
//========================================================================================
// Sound channel priorities:
//0 - auto - This is considered the lowest audio channel priority. It always plays if possible (hardware audio channel available) and they don't override previously played sounds. If no channels are available, the sound will just not play. This is best used for things that do not have a particular entity or character related to them (like bullet hit sounds), or are not overly important sound (like shell casing landing sounds or footsteps).
//1 - body - these are sounds made by a characters body. These include sounds like impact sounds (from falling & landing hard) and equipment movement jingles.
//2 - item - These are sounds made by items on a character, or that represent some sort of item related sound. These would include sounds made by any misc items carried by a character like papers or binorulars, but could also be used as a second weapon sound channel if it is required for a weapon to play two different sounds at the same time. This is also the channel that should be used for weapon reload sound to prevent them from cutting off long firing sounds.
//3 - weaponidle - is for constant sound made by weapons or possibly the character itself. An example from Quake3 would be the rail gun hum, but I can't think of any examples from MoH.
//4 - voice - These are vocal sounds made by a character such as pain, death, and yelling during combat. This is effectively a lower priority dialog channel for general use throughout the majority of the game.
//5 - local - This plays a sound that is considered to be "local" to the player. Meaning, it does not do 3D spatialization on the sound. It does adjust the volume of the sound according to distance though. This is best used for playing sounds that should sound omni-directional like rain or lightning.
//6 - weapon - These are the sound that are made by the characters' weapons. These include the firing sounds, but not reloading sounds.
//7 - dialog_secondary - This is a secondary backup dialog channel. Good for use with lower priority dialog such as idle chatter between characters, as it's considered to be lower priority than regular dialog. This should only include spoken dialog that will have subtitle text.
//8 - dialog - This is the primary sould channel for playing character dialog. This should only include spoken dialog that will have subtitle text.
//9 - menu - This is the sound channel for menu sounds to play on.
//========================================================================================
settiki none
aliascache m6l3c_alarm sound/mechanics/Mec_Alarm_05.wav soundparms 0.9 0.0 1.0 0.0 150 7000 item loaded maps "t2l1 t2l2 "
end
-
SniperWolf
- Colour Sergeant
- Posts: 89
- Joined: Sat Dec 18, 2004 5:14 am
- Location: New York, USA
- Contact:
-
SniperWolf
- Colour Sergeant
- Posts: 89
- Joined: Sat Dec 18, 2004 5:14 am
- Location: New York, USA
- Contact:


