Page 1 of 1

jetpack mod

Posted: Wed May 05, 2004 4:07 am
by fuhrer
i been helpin someone with a jetpack mod, n he asked me to kill the jetpack when a player dies, which i have done..however if u want to refuel the jetpack (i.e. get another one) we want it to last for 60 seconds, now the countdown is at 60 seconds on the first jetpack but it remains at 60 seconds from the 1st jetpack no matter how many u get, when u get a new pack it should last for 60 seconds from that time, i.e. if u stand at the trigger for getting a pack for 30 seconds, when u leave the trigger ur pack should still last 60 seconds, but its only lasting 30,

sorry if this sounds confusng its hard to explain, i have tried many ways to get it to work but its still only using the time from the 1st pack

here is the script

Code: Select all

jetpack1:

local.trig1 = spawn trigger_multiple
local.trig1.origin = ( 3444 723 -343 ) //axis
local.color = ( 0.0 1.0 0.0 )
local.trig1 setsize ( -50 -50 -50 ) ( 50 50 50 )
local.trig1 setthread  Gravity1
local.trig1 message "JetPack Obtained!"                           
local.trig1 wait 4                                                                  
local.trig1 delay 0



Gravity1:

level.packon1 = 1
level.player1 = parm.other
level.static1 = spawn script_model 
level.static1 model "emitters/pipe_steam.tik"
level.static1.origin = local.player.origin + ( 0 10 48 )
level.static1 glue  local.player
level.player1 gravity .1                                                           
level.player1 stufftext "say Ive Got a JetPack! :)"
level.player1 loopsound jetpack
thread while1
parm.other stopwatch 60
wait 60
level.player1 stoploopsound
level.player1 gravity 1
level.static1 delete
level.packon1 = 0

end

while1:

 while (1)
{
if (level.player1.health == 0)
{
level.player1 stoploopsound
level.player1 gravity 1
level.static1 delete
level.packon1 = 0
end
}
wait .1
}

end

Posted: Wed May 05, 2004 4:47 am
by nuggets
change all your gravity thread to this ->

gravity1:
local.player = parm.other
local.player.packon = 1

local.player.static1 = spawn script_model
local.player.static1 model "emitters/pipe_steam.tik"
local.player.static1.origin = local.player.origin + ( 0 10 48 )
local.player.static1 glue local.player
local.player gravity .1

local.player stufftext "say Ive Got a JetPack! : )"
local.player loopsound jetpack
local.player.count = 60
local.player stopwatch local.player.count
local.player thread fuel_check
end

fuel_check:
while (1)
{
if ((self.packon == 1) && (self.count > 0))
{
self.count--
}
else
{
self.count = 0
self stopwatch 0
self stoploopsound
self gravity 1
self.static1 delete
self.packon = 0
}
if !(isAlive self)
{
self.count = 0
self stopwatch 0
self stoploopsound
self gravity 1
self.static1 delete
self.packon = 0
end
}
wait 1
}


and delete your while1 thread

Posted: Wed May 05, 2004 9:29 pm
by fuhrer
thx for the try nuggets but the timer isnt reseting, the stopwatch is but the local.player.count keeps counting down from 60 regardless if u get a new pack.

must be some way of puttin it back to 60 everytime u get a new pack

Posted: Thu May 06, 2004 2:28 am
by nuggets
here ya go

Code: Select all

	level waittill spawn
        thread triggerspawn
        thread rocketeers
        thread Cobratext
ETC>>>

Code: Select all

level.snipernodes[14].peekdist = 80.000
end

//---------------------------------------->JetPacks!

triggerspawn:

local.trig1 = spawn trigger_multiple
local.trig1.origin = ( 3444 723 -343 ) //axis
local.trig1 setsize ( -50 -50 -50 ) ( 50 50 50 )
local.trig1 setthread "JetPack"
local.trig1 message "JetPack Obtained!"
local.trig1 wait 4
local.trig1 delay 0

local.trig2 = spawn trigger_multiple
local.trig2.origin = ( 2297 4547 -217 ) //allied
local.trig2 setsize ( -50 -50 -50 ) ( 50 50 50 )
local.trig2 setthread "JetPack"
local.trig2 message "JetPack Obtained!"
local.trig2 wait 4
local.trig2 delay 0
end

JetPack:
	local.player = parm.other
	local.player.packspawn = 1
	local.player.packon = 1
	local.player.count = 10
	local.player stopwatch local.player.count 
	local.player gravity .1
		local.player.pack = spawn script_model 
		local.player.pack model "emitters/pipe_steam.tik" 
		local.player.pack.origin = local.player.origin + ( 0 10 48 ) 
		local.player.pack glue local.player 
		local.player loopsound jetpack 

	waitframe
	while (local.player.packon == 1)
		{
		if (local.player.count > 0)
			{
			local.player.count--
			wait 1
			}
		else
			{
			iprintln_noloc "MAYDAY we're going down"
			local.player thread JetPack_off
			end
			}
		if !(isAlive local.player)
			{
			iprintln_noloc "ARGHH i'm not alive"
			local.player thread JetPack_off
			end
			}
		}
end

JetPack_off:
	self.pack_on = 0
	self.count = 0
	self stopwatch 0
	self gravity 1
	self stoploopsound jetpack		
	self.pack remove
end

//-------------------------------------------------------> Rocketeers!  

rocketeers:


Posted: Thu May 06, 2004 2:46 am
by fuhrer
no good m8, still same problem as before

Posted: Thu May 06, 2004 3:10 am
by nuggets
i'll send you mine

Posted: Thu May 06, 2004 3:57 am
by fuhrer
:? nobody else got any ideas?

Posted: Thu May 06, 2004 4:08 am
by kai0ty
i havent looked at teh script, but this would be my idea. set the life (fule whatever) to a sertain variable, like local.fuel. then make an if statement like if(local.fule == 0){
etc
}
and when u refil
local.fuel == 60

thats my super super basic idea.

Posted: Thu May 06, 2004 5:06 am
by fuhrer
:D done that, this is what happening....

while loop or not, when u get ur first pack u get 60 seconds of fuel, and however u count it down doesnt matter, 1 a second blah... if u get a second pack, ur fuel goes up to 60 seconds again, but it takes it away twice as fast, 3rd pack 3 times as fast...if u got any ideas lol im fresh out of em

Posted: Fri May 07, 2004 2:10 am
by nuggets
i now see your problem i'd love to say i've solved it... so i will

I'VE SOLVED IT

Code: Select all

JetPack:
	local.player = parm.other
	local.player.packon = 1
	if ((local.player.count == 0) || (local.player.count == NIL))
		{
		local.player.count = 10
		local.player stopwatch local.player.count 
		local.player gravity .1
			local.player.pack = spawn script_model 
			local.player.pack model "emitters/pipe_steam.tik" 
			local.player.pack.origin = local.player.origin + ( 0 10 48 ) 
			local.player.pack glue local.player 
			local.player loopsound jetpack 

		waitframe
		while (local.player.packon == 1)
			{
			if (local.player.count > 0)
				{
				local.player.count--
				wait 1
				}
			else
				{
				iprintln_noloc "MAYDAY we're going down"
				local.player thread JetPack_off
				end
				}
			if !(isAlive local.player)
				{
				iprintln_noloc "ARGHH i'm not alive"
				local.player thread JetPack_off
				end
				}
			}
		}
	else
		{
		local.player.count = 10
		local.player stopwatch local.player.count
		}
end

JetPack_off:
	self.pack_on = 0
	self.count = 0
	self stopwatch 0
	self gravity 1
	self stoploopsound jetpack		
	self.pack remove
end
replace all previous crap that hasn't worked and here's the daddy :D
remember to keep the thread triggerspawn command and the like though ;)

Posted: Fri May 07, 2004 6:03 am
by fuhrer
GENIUS!

cheers nuggets works great

Posted: Fri May 07, 2004 6:42 am
by fuhrer
:? too more things i have no idea how to do, the jetpack doesnt turn off if u get kicked to speccy, or if the round restarts.

Posted: Fri May 07, 2004 10:41 pm
by nuggets
fk that, who cares lol, you've gotta do something ;)

JetPack_off

Posted: Fri May 07, 2004 11:13 pm
by tltrude
I know there is a way to check if a player is in spectator mode, but can't remember it. For the round start, put a trigger at the spawn points to remove the packs (setthread JetPack_off)--might stop flying spawnkillers too.

Posted: Sat May 08, 2004 1:33 am
by nuggets
if (local.player.dmteam == "spectator")

the restart i think should do this anyway... not sure though