Page 1 of 1
A moving exploder problem
Posted: Fri Jun 02, 2006 10:38 am
by Waylander76
In my map I have a V2 on a launch tower.
this moves (the v2 and the launch tower) to the launch bay where
the V2 will take off.
The allies have to blow up the v2 before it can launch.
in my script the V2 is an exploder and all works until the v2 blows up.
The exploder explodes with exploder chunks flying about but the V2
is still there after the explosion.
the thread is below...it all works apart from leaving the v2 behind after the
explosion.
The explosion is called from a trigger that uses the global/exploder.scr::main script.
The bomb can be set, it does explode, the debris flies about but the V2 remains.
$r1 - $r4 are the origins used for the exploderchunks
$exploder is the V2
What do I need to do to make the V2 dissapear after the explosion?
Code: Select all
rocketdoor:
$speaker1 playsound 2min_snd
$speaker2 playsound 2min_snd
$rocket_door moveto $doordown
$rocket_door_speaker loopsound rocket_door_snd
$rocket_door waitmove
$rocket_door_speaker stoploopsound
$exploderfire bind $exploder
$r1 bind $rocket_tower
$r2 bind $rocket_tower
$r3 bind $rocket_tower
$r4 bind $rocket_tower
$fire bind $exploder
$fire1 bind $exploder
$v2_launch_speaker bind $rocket_tower
$v2_clip bind $rocket_tower
$exploderchunk bind $rocket_tower
$v2_metal_clip bind $rocket_tower
$exploder bind $rocket_tower
$rocket_tower time 20
$v2_launch_speaker loopsound platform_move_snd
$rocket_tower moveto $rocket_tower_wap
$rocket_tower waitmove
$v2_launch_speaker stoploopsound platform_move_snd
$exploder unbind $rocket_tower
wait 40
$speaker1 playsound 1min_snd
$speaker2 playsound 1min_snd
waiit 30
$speaker1 playsound 30secs_snd
$speaker2 playsound 30secs_snd
wait 20
$speaker1 playsound 10secs_snd
$speaker2 playsound 10secs_snd
wait 10
$v2_launch_speaker playsound v2takeoff_snd
$fire show
$fire1 show
$firehurt triggerable
$exploder moveto $wap2
$exploder waitmove
$exploder hide
$fire hide
$fire1 hide
$firehurt nottriggerable
teamwin axis
end
Posted: Sat Jun 03, 2006 9:59 am
by tltrude
I don't see the exploder being set off. There should be a line like this
thread global/exploder.scr::explode #
(#) being the "#set" value of the exploder in question. The exploder will hide anything targetname "exploder" by itself, as long as the #set number is right.
Posted: Mon Jun 05, 2006 7:31 am
by Waylander76
Tanks tom
Now how would I go about breaking the thread down into events?
Ideally I want it to start 2 minutes before the time runs out.
It's an OBJ map btw, so for example if the round timelimit was 5 minutes the rocket would start moving at 3 minutes.
I saw this thread
/forum/viewtopic.php?t=10562&highlight=timer+countdown
and tried to apply it like this....
Code: Select all
main
level waittill roundstart // should already have this line
level.start_time = level.time
local.time_remaining = level.dmroundlimit * 60.0 - level.time + level.start_time
thread rocketdoor
end
rocketdoor:
while(level.dmroundlimit * 60.0 - level.time + level.start_time > 120.0)
waitframe
if (local.time_remaining == 120)
{
$speaker1 playsound 2min_snd
$speaker2 playsound 2min_snd
$rocket_door moveto $doordown
$rocket_door_speaker loopsound rocket_door_snd
$rocket_door waitmove
$rocket_door_speaker stoploopsound
$exploderfire bind $exploder
$r1 bind $rocket_tower
$r2 bind $rocket_tower
$r3 bind $rocket_tower
$r4 bind $rocket_tower
$fire bind $exploder
$fire1 bind $exploder
$v2_launch_speaker bind $rocket_tower
$v2_clip bind $rocket_tower
$exploderchunk bind $rocket_tower
$v2_metal_clip bind $rocket_tower
$exploder bind $rocket_tower
$rocket_tower time 20
$v2_launch_speaker loopsound platform_move_snd
$rocket_tower moveto $rocket_tower_wap
$rocket_tower waitmove
$v2_launch_speaker stoploopsound platform_move_snd
$exploder unbind $rocket_tower
}
if (local.time_remaining == 60)
{
$speaker1 playsound 1min_snd
$speaker2 playsound 1min_snd
}
if (local.time_remaining == 30)
{
$speaker1 playsound 30secs_snd
$speaker2 playsound 30secs_snd
}
if (local.time_remaining == 10)
{
$speaker1 playsound 10secs_snd
$speaker2 playsound 10secs_snd
wait 10
$v2_launch_speaker playsound v2takeoff_snd
$fire show
$fire1 show
$firehurt triggerable
$exploder moveto $wap2
$exploder waitmove
$exploder hide
$fire hide
$fire1 hide
$firehurt nottriggerable
teamwin axis
}
else
{
end
}
end
However at the start of the round the rocket and platform move and then nothing happens after that.
What am I doing wrong?
Posted: Mon Jun 05, 2006 7:59 am
by bdbodger
if (local.time_remaining == 120)
{
what changes the value of local.time_remaining? I don't see it
Posted: Mon Jun 05, 2006 8:33 am
by Waylander76
Ahh so I need to make local.time_remaining countdown?
Ok so how would I do that to get an accurate time of the time remaining?
Something like
Code: Select all
while(level.dmroundlimit * 60.0 - level.time + level.start_time > 120.0)
local.time_remaining = local.time_remaining - 1
waitframe
Posted: Mon Jun 05, 2006 10:01 am
by bdbodger
main
level waittill roundstart // should already have this line
level.start_time = level.time
local.time_remaining = level.dmroundlimit * 60.0 - level.time + level.start_time // local.variables only have value in the thread they are in unless you pass that value to another thread
thread rocketdoor
end
rocketdoor:
// Your while loop starts here
while(level.dmroundlimit * 60.0 - level.time + level.start_time > 120.0)
waitframe // but ends here
if (local.time_remaining == 120) // this value never gets changed
{
$speaker1 playsound 2min_snd
$speaker2 playsound 2min_snd
$rocket_door moveto $doordown
$rocket_door_speaker loopsound rocket_door_snd
$rocket_door waitmove
$rocket_door_speaker stoploopsound
$exploderfire bind $exploder
$r1 bind $rocket_tower
$r2 bind $rocket_tower
$r3 bind $rocket_tower
$r4 bind $rocket_tower
$fire bind $exploder
$fire1 bind $exploder
$v2_launch_speaker bind $rocket_tower
$v2_clip bind $rocket_tower
$exploderchunk bind $rocket_tower
$v2_metal_clip bind $rocket_tower
$exploder bind $rocket_tower
$rocket_tower time 20
$v2_launch_speaker loopsound platform_move_snd
$rocket_tower moveto $rocket_tower_wap
$rocket_tower waitmove
$v2_launch_speaker stoploopsound platform_move_snd
$exploder unbind $rocket_tower
}
if (local.time_remaining == 60) // this value never gets changed
{
$speaker1 playsound 1min_snd
$speaker2 playsound 1min_snd
}
if (local.time_remaining == 30)
{
$speaker1 playsound 30secs_snd
$speaker2 playsound 30secs_snd
}
if (local.time_remaining == 10) // this value never gets changed
{
$speaker1 playsound 10secs_snd
$speaker2 playsound 10secs_snd
wait 10
$v2_launch_speaker playsound v2takeoff_snd
$fire show
$fire1 show
$firehurt triggerable
$exploder moveto $wap2
$exploder waitmove
$exploder hide
$fire hide
$fire1 hide
$firehurt nottriggerable
teamwin axis
}
else
{
end
}
end // this thread ends because it is not inside a loop
If you want part of the thead to loop you need to do this
while( expression )
{
thread stuff goes here
}
You need to use the start and stop brackets { and } to enclose the part of the thread you want to loop and have a timer inside that loop that changes the value of local.time_remaining and you must set the start time of local.time_remaining inside of the thread or pass the value to this thread .
main:
thread rocketdoor local.time_remaining
end
rocketdoor local.time_remaining:
while ............
Posted: Tue Jun 06, 2006 5:45 am
by Waylander76
bdbodger thanks for pointing me in the right direction....I got it working but there is one problem....
When I first get the local.time_remaining the format is xxx.000
after the rocketdoor moves down and I get the local.time_remaining again it gives a value of xxx.100 and everything after that fails it's if(etc) check as it is looking for an exact number ie 60.000.
It fails this as the returned value is 60.100.
How do i round get round this?
Script is below...
Code: Select all
main:
//level waittill roundstart
level.start_time = level.time
local.time_remaining = level.dmroundlimit * 60.0 - level.time + level.start_time
thread rocketdoor local.time_remaining
end
rocketdoor local.time_remaining:
while(1)
{
{
iprintlnbold_noloc local.time_remaining //prints to screen for testing
local.time_remaining = local.time_remaining - 1.0
wait 1
}
if (level.v2alive == 1 && local.time_remaining == 120)
{
$speaker1 playsound 2min_snd
$speaker2 playsound 2min_snd
$rocket_door moveto $doordown
$rocket_door_speaker loopsound rocket_door_snd
$rocket_door waitmove
$rocket_door_speaker stoploopsound
$fire bind $v2
$fire1 bind $v2
$v2_launch_speaker bind $rocket_tower
$v2_clip bind $v2
$v2_metal_clip bind $v2
$v2 bind $rocket_tower
$rocket_tower time 20
$v2_launch_speaker loopsound platform_move_snd
$rocket_tower moveto $rocket_tower_wap
$rocket_tower waitmove
$v2_launch_speaker stoploopsound platform_move_snd
$v2 unbind $rocket_tower
local.time_remaining = level.dmroundlimit * 60.0 - level.time + level.start_time
}
if (level.v2alive == 1 && local.time_remaining = 60)
{
$speaker1 playsound 1min_snd
$speaker2 playsound 1min_snd
local.time_remaining = int (level.dmroundlimit * 60.0 - level.time + level.start_time)
}
if (level.v2alive == 1 && local.time_remaining = 30)
{
$speaker1 playsound 30secs_snd
$speaker2 playsound 30secs_snd
}
if (level.v2alive == 1 && local.time_remaining = 20)
{
level.launch = 1
$speaker1 playsound 10secs_snd
$speaker2 playsound 10secs_snd
local.time_remaining = level.dmroundlimit * 60.0 - level.time + level.start_time
}
if (level.v2alive == 1 && local.time_remaining = 10)
{
$v2_launch_speaker playsound v2takeoff_snd
$fire show
$fire1 show
$firehurt triggerable
$v2 moveto $wap2
$v2 waitmove
$v2 hide
$fire hide
$fire1 hide
$firehurt nottriggerable
teamwin axis
}
if ( level.v2alive == 0 )
{
thread allies_win_bomb
end
}
}
end
Posted: Tue Jun 06, 2006 9:56 am
by bdbodger
not sure why you need level.v2alive but I left that in just in case and the global/obj_dm.scr does play countdown sounds but it's your script so maybe this script will help at least
main:
//level waittill roundstart
//level.start_time = level.time
//local.time_remaining = (int(level.dmroundlimit * 60.0 - level.time + level.start_time ))
thread rocketdoor // local.time_remaining
$bomb1 thread global/obj_dm.scr::bomb_thinker // I assume you will be useing the obj_dm.scr??
thread allies_win_bomb $bomb1
end
rocketdoor : //local.time_remaining:
level.start_time = level.time
local.time_remaining = (int(level.dmroundlimit * 60.0 - level.time + level.start_time )) // convert to integer
while(1)
{
if (level.v2alive == 1 && local.time_remaining == 120)
{
$speaker1 playsound 2min_snd
$speaker2 playsound 2min_snd
$rocket_door moveto $doordown
$rocket_door_speaker loopsound rocket_door_snd
$rocket_door waitmove
$rocket_door_speaker stoploopsound
$fire bind $v2
$fire1 bind $v2
$v2_launch_speaker bind $rocket_tower
$v2_clip bind $v2
$v2_metal_clip bind $v2
$v2 bind $rocket_tower
$rocket_tower time 20
$v2_launch_speaker loopsound platform_move_snd
$rocket_tower moveto $rocket_tower_wap
$rocket_tower waitmove
$v2_launch_speaker stoploopsound platform_move_snd
$v2 unbind $rocket_tower
//local.time_remaining = level.dmroundlimit * 60.0 - level.time + level.start_time
}
if (level.v2alive == 1 && local.time_remaining = 60)
{
$speaker1 playsound 1min_snd
$speaker2 playsound 1min_snd
//local.time_remaining = int (level.dmroundlimit * 60.0 - level.time + level.start_time)
}
if (level.v2alive == 1 && local.time_remaining = 30)
{
$speaker1 playsound 30secs_snd
$speaker2 playsound 30secs_snd
}
if (level.v2alive == 1 && local.time_remaining = 20)
{
level.launch = 1
$speaker1 playsound 10secs_snd
$speaker2 playsound 10secs_snd
//local.time_remaining = level.dmroundlimit * 60.0 - level.time + level.start_time
}
if (level.v2alive == 1 && local.time_remaining = 10)
{
$v2_launch_speaker playsound v2takeoff_snd
$fire show
$fire1 show
$firehurt triggerable
$v2 moveto $wap2
$v2 waitmove
$v2 hide
$fire hide
$fire1 hide
$firehurt nottriggerable
teamwin axis // this will end round so no need to exit while loop
}
waitframe
local.time_remaining = (int(level.dmroundlimit * 60.0 - level.time + level.start_time )) // convert to integer
//if ( level.v2alive == 0 )
//{
//thread allies_win_bomb
//end
//}
}
end
/*** --------------------------------------------
//*** "Allied Victory"
//*** --------------------------------------------
allies_win_bomb local.bomb1:
while (local.bomb1.exploded != 1)
waitframe
teamwin allies
end
Posted: Tue Jun 06, 2006 12:17 pm
by Waylander76
bdbodger thank you again! so all i needed to do was convert it to an integer!
The level.v2alive checks to see if the V2 is still intact as I couldn't use the
$bomb1 thread global/obj_dm.scr::bomb_thinker as I had major probs getting the bomb to explode after everything all moved in the rocket door thread.
In the first script you'll see that I tried binding the exploder to the rocket
tower.This moved the rocket and tower and the bomb could be
set, but when it exploded the V2 was still there.
That was using the $bomb1 thread global/obj_dm.scr::bomb_thinker
Tom said I needed to add thread global/exploder.scr::explode #
but I couldn't see how to fit that in with the thread to make it work
if the setting of the bomb was linked to the obj_dm.scr::bomb_thinker
So now the allies throw a switch so the V2 self destructs (this is in another thread) where two explosion fx are spawned and the V2 is removed.
It all works so i'm happy!!
That's why I wnated the countdown so the custom wav's play at a certain time starting 2 minutes before the round ends.
thanks again for all the help
Posted: Tue Jun 06, 2006 1:24 pm
by bdbodger
Well the global/exploder.scr does this
self.exploded = 1
so you could have made a thread that checked when the bombs exploded value changed to 1 and removed the rocket but hey you got it working the way you want so great thats all you need .
Posted: Tue Jun 06, 2006 5:01 pm
by Waylander76
bdbodger...works like a charm, so like i said thanks for all the help.
BTW where do you guys learn all this stuff?? You, Tom,Rookie.One and JV??
Posted: Wed Jun 07, 2006 3:05 am
by bdbodger
Trial and error and haveing a guy like JV around he is the master

helps to read the game scripts and really understand what is written and also just hanging around forums like this one you tend to pick up little bits of new information every once in a while .