im having a problem with stopwatch

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Lt.Audie L Murphy
Lance Corporal
Posts: 22
Joined: Wed Feb 16, 2005 8:47 am

im having a problem with stopwatch

Post by Lt.Audie L Murphy »

im having a problem with stopwatch here my code

im using



spawn_a_flak88:
println "[threadStart] spawn_a_flak88"
//******************************
//* The flak88 gun
//******************************
local.flak = spawn script_model "targetname" "exploder"
local.flak model "statweapons/flak88turret.tik"
local.flak.destroyed_model = "models/statweapons/flak88_d.tik"
local.flak.set = 1
local.flak origin ( -6575 2033 489 )
local.flak.angles = ( 0 -90 0 )

//******************************
//* The flak88 base
//******************************
local.base = spawn script_model "targetname" "flak88base"
local.base model "statweapons/flak88base.tik"
local.base.origin = ( -6575 2033 432 )
local.base.angles = ( 0 0 0 )

//******************************
//* The bomb model
//******************************
local.bomb = spawn script_model "targetname" "bomb"
local.bomb model "items/pulse_explosive.tik"
local.bomb.origin = ( -6571 2185 446 )
local.bomb.angles = ( 0.0 0.0 0.0 )
local.bomb.exploder_set = 1
iprintlnbold "The bomb have been planted!" ////// code i added

local.bomb.explosion_fx = "models/fx/fx_explosion.tik"
local.bomb.trigger_name = "bomb_trigger"
local.bomb.target = "exploder"

//******************************
//* The bomb trigger
//******************************
local.trigger = spawn trigger_use "targetname" "bomb_trigger"
local.trigger setsize ( -6571 2185 445 ) ( -6571 2185 446 )





bomb works fine allies can set the bomb

axis can defuse the bomb

when bomb explodes level ends and restarts



only after bomb is set stop watch dont appear



ive tried all codes posted tried stock scr code but all same result ,,,

i added this to the bomb script without a problem

iprintlnbold "The bomb have been planted!"



thank you in advance
Image
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post by Master-Of-Fungus-Foo-D »

uhmm in case you didnt notice, there ISNT ANY stopwatch code in your script... you cant expect it to be there if you didnt ascript it to...

here, go to your trigger's sethhread, Then palce this line after your bomb has started ticking:

Code: Select all

$player stopwatch 30 //<-- # = [amount of time]
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
Lt.Audie L Murphy
Lance Corporal
Posts: 22
Joined: Wed Feb 16, 2005 8:47 am

Post by Lt.Audie L Murphy »

yes i noticed ,,,, this is my problem ,,,,, i have stop watch code just cant seem to get it to work with code im using

ive placed it everywhere in that code i posted but same result
Image
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

i use the bombthinkers
but then you have to add a couple values to your spawned explosives.

but basically

Code: Select all

$explosives_targetname thread global/obj_dm.scr::bomb_thinker
$explosives_targetname is the targetname of your explosives.
Image
Lt.Audie L Murphy
Lance Corporal
Posts: 22
Joined: Wed Feb 16, 2005 8:47 am

Post by Lt.Audie L Murphy »

i tried your code Green Beret kinda worked ,,,, only stop watch appeard after bomb blows up

hehe :D

getting further : ) is all that matters
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Ahh. Cool thinking. Well... never tried it, but this should work (to start the watches for all players):

Code: Select all

for(local.i = 1; local.i <= $player.size; local.i++) {
	local.player = $player[local.i]
	if(isAlive local.player) {
		$player stopwatch 30
	}
}
...it loops thrugh the $player array, starting a stopwatch for everyone that is alive.
Admin .MAP Forums
Image
Head above heels.
Post Reply