Non-objective bomb scripting prob

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Daniel Radcliffe
Second Lieutenant
Posts: 168
Joined: Fri May 30, 2003 9:49 am

Non-objective bomb scripting prob

Post by Daniel Radcliffe »

Ive managed to create a bomb that will explode and take out a part of a wall. However i have a couple of problems, the first is that there is no explosion when the bomb detonates.

The second problem is that all looks good untill the bomb has been planeted, then once its been planted you can see both the red pulsating bomb and the black/yellow bomb. After the bomb has exploded everything works as suppose to, yet you can still see the red pulsating bomb.

Ive uploaded the bsp and .scr so that you can see the problem.
http://www.billandben79.pwp.blueyonder.co.uk/maps/9.pk3 <---- 7kb file

Please take a look at it, i know the problem is scripting as ive been playing around with it and got all sorts of errors, but i cant figure out the right combination. :(

Thx for your help :)
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

The red pulseing bomb should be a script_model and should be removed by script . I don't know how you did it but this is what I would do .

Make a script_model for the puslateing explosives targetname explosives
Make a trigger use around that . Key: setthread Value: bomb
when the tigger is triggered I would put this

bomb:
local.player = parm.other
$explosives.model = miscobj/detpack.tik
local.player stopwatch 10
local.player loopsound bombtick1
wait 10
local.player stoploopsound
waitexec global/model.scr $explosives.origin // or exec global/exploder.scr::explode 1 the set nunber of the exploder
$explosives remove
end
User avatar
williewisp
First Lieutenant
Posts: 208
Joined: Fri May 16, 2003 1:10 pm
Location: ireland

Post by williewisp »

bdbodger wrote:local.player = parm.other
local.player stopwatch 10
local.player loopsound bombtick1
wait 10
local.player stoploopsound
never tried that way, local.player cudn't ya use $player loopsound bombtick1

it's prob the same?
it's not a time for thinking its a time for drinking!
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

I think he wants it for multiplayer . In multiplayer there is more that one $player .
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

your script->

main:
level waittill prespawn
exec global/DMprecache.scr
$door1_nopulse hide
$world farplane 1000
$world farplane_color (0.333 0.333 0.333)
level.script = maps/obj/9.scr
exec global/ambient.scr obj_team5
setcvar "g_obj_alliedtext1" ""
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" ""

level waittill spawn
level.bomb_damage = 200
level.bomb_explosion_radius = 640
level.defusing_team = "axis"
level.planting_team = "allies"
level.dmrespawning = 1
level.dmroundlimit = 10
level.clockside = axis

//level waittill roundstart
thread shingle_setup
end

//*** --------------------------------------------
//*** "Shingle"
//*** --------------------------------------------

shingle_setup:
thread shingle_center_start
end

shingle_center_start:
$door1_trigger waittill trigger
local.player = parm.other
if (local.player.dmteam != axis)
{
goto door1
}

end

door1:
$bangalore_center playsound plantbomb1
$door1_nopulse show
wait 5
$door1_explosion_center anim start
$door1_pulse show
$door1 remove

end

i'm guessing that the $door_pulse show should be $door_pulse hide
but it's hard to see what your trying to do :(

really though you only need one model, once it's set change the model to something else, easy :D

bang:
$1st_model model new_model.tik
end

that kinda thing but you'll need to find the correct model names

bdbodger has the idea worth going with, but you'll need to implement a team check, and also a while loop to make sure the trigger is being used, can be seen, and the player is alive
the make a counter to end the loop and convert the script it's next step

as i'm so nice: :D
1) give the bomb trigger any name ya like but make sure it's trigger_use
2) call the bomb the_bomb
key: targetname
value: the_bomb
3) give the trigger setthread set_me
key: setthread
value: set_me

set_me:
local.player = parm.other
if (local.player.dmteam == "allies")
{local.player.counter = 0
local.player thread im_planting self $the_bomb
local.player stopwatch 10
end

im_planting local.trigger local.bomb:
while ((self.useheld == 1) && (isalive self) && (self cansee local.bomb 30 128))
{if (self.counter < level.bomb_time)
{self.counter = (self.counter + .2)
wait .2}
if (self.counter == level.bomb_time)
{self.counter = 0
self stopwatch 0
self.counter = (self.counter + .2)
local.bomb thread ive_planted local.trigger}
if (self.counter > level.bomb_time)
{end}}
end

ive_planted local.trigger:
local.trigger nottriggerable
self playsound bombtick
self model "animate/explosive.tik"
wait 10 //time to get outta the way
self stoploopsound
self playsound explode_tank
self hide
self notsolid
earthquake .35 10 0 0
earthquake .23 6 0 0
earthquake 1 1 0 0
earthquake 1.25 .3 0 1
end

//one question though? is this bomb supposed to be defusable, if so just let me know :D
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

bomb_wall tutorial map

Post by tltrude »

Here is a tutorial map for a wall bomb in a deathmatch map. I used willie's stopwatch lines in the script, and it is pretty cool. It also has an exploder set off by a crate explosion. Any player (either team) can set off the bomb, and It will kill anyone near it when it goes off. The .map file is included in the zip.

http://pages.sbcglobal.net/tltrude/Temp/bomb_wall.zip

Image

Here is the script:

Code: Select all

// BOMB WALL TEST MAP
// ARCHITECTURE: TLTRUDE
// SCRIPTING: TLTRUDE / WILLIE THE WISP

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Bomb Wall"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" ""

	// call additional stuff for playing this map round based is needed
	if(level.roundbased)
		thread roundbasedthread

	level waittill prespawn

	//*** Precache Dm Stuff
	exec global/DMprecache.scr

	exec global/door_locked.scr::lock
	level.script = maps/dm/bomb_wall.scr
	exec global/ambient.scr mohdm7
	exec global/exploder.scr
	exec global/crate.scr::explosive_crate  // targetname explosive_crate will explode

	$bomb1 hide  // Hide the non-pulse bomb script_object
	
	level waittill spawn

end

//-----------------------------------------------------------------------------

roundbasedthread:

	// Can specify different scoreboard messages for round based games here.

	level waitTill prespawn

	level waittill spawn

	// set the parameters for this round based match
	level.dmrespawning = 0 // 1 or 0
	level.dmroundlimit = 5 // round time limit in minutes
	level.clockside = kills // set to axis, allies, kills, or draw

	//level waittill roundstart

end

//******************************
// Bomb trigger1 setthread
//******************************

bombwall:

	$trigger1 remove
	$bomb1 show
	$bomb1_pulse remove 
	local.player = parm.other  
	local.player stopwatch 10
	$bomb1 playsound plantbomb
	wait .5 
	$bomb1 loopsound final_countdown 
	wait 10 
	$bomb1 stoploopsound 
	exec global/exploder.scr::explode 1 // blows up the #set 1 exploder
	radiusdamage $bomb1.origin 120 256  // numbers are damage and radius
	$bomb1 remove
	thread jitter_large
 
end

//******************************
// func_explodeobject setthread
//******************************

crate_bomb:

	exec global/exploder.scr::explode 2 // blows up the #set 2 exploder
	thread jitter_large
end

//******************************
// earthquake effect
//******************************

jitter_large:

	waitexec global/earthquake.scr .35 10 0 0
	waitexec global/earthquake.scr .23 6 0 0
	waitexec global/earthquake.scr 1 1 0 0
	waitexec global/earthquake.scr 1.25 .3 0 1
end
Tom Trude,

Image
User avatar
williewisp
First Lieutenant
Posts: 208
Joined: Fri May 16, 2003 1:10 pm
Location: ireland

Post by williewisp »

sorry didn't know it was for multiplayer :oops:

script'n knowledge isn't 2 gud!
it's not a time for thinking its a time for drinking!
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

why use local.player...

in MOH every PC (playable character) unless redefined is called player, whether it be in MP SP FFA etc...

using $player in SP will work as it has only one entity to look at, while in MP every $player will get the same commands, hence an array is made

by using $player[1] and $player[2] etc... you can give actions to just one of the PC's, just as local.player if defined as local.player

local.player may be defined as parm.other, so you will be giving commands to the player that used a trigger

but bear in mind local.player is just a variable, it could be called anything, it's just scripting practise to give variables sensible names so when you read back over the script or someone else reads it, you know what is being referred to...

so:
local.player = parm.other //the triggerer
local.player stopwatch 10 //shows a stopwatch just for the triggerer
local.player loopsound bombtick //will have the triggerer hearing the bombtick but...
self loopsound bombtick //will make the bombtick stay with the bomb so a player would know if they are approaching the bomb
hope this helps, prob not cos it's all foreign 2 me :-/
Daniel Radcliffe
Second Lieutenant
Posts: 168
Joined: Fri May 30, 2003 9:49 am

Post by Daniel Radcliffe »

After looking at various scripts and examples ive come up with my own varient (never thought id be saying that).

What i basically done was make the usual target/trigger/2 bombs and fx.

And then put this in the script and it works fine now:
Level waittill spawn:
$door1_nopulse hide


*********Outside of main thread**************

bombs_setup:

thread bomb1_start
end

bomb1_start:

$door1_trigger waittill trigger
$door1_trigger playsound plantbomb

local.player = parm.other
$door1_nopulse playsound plantbomb
$door1_pulse hide

if (local.player.dmteam != axis)
{
goto door1
}

end

door1:
$door1_trigger playsound plantbomb
$door1_nopulse show
$door1_pulse hide
local.player = parm.other
local.player stopwatch 5
$door1_nopulse playsound plantbomb
wait .5
$door1_nopulse loopsound final_countdown
wait 5
$door1_nopulse stoploopsound
radiusdamage $door1_nopulse.origin 120 256
thread jitter_large
$door1_explosion_fx anim start
$door1 remove
$door1_nopulse remove
iprintlnbold "Allies have gained access to the passages"
end

jitter_large:

waitexec global/earthquake.scr .35 10 0 0
waitexec global/earthquake.scr .23 6 0 0
waitexec global/earthquake.scr 1 1 0 0
waitexec global/earthquake.scr 1.25 .3 0 1
end
This as far as im aware can be used in either multiplayer or singleplayer maps of obj or dm. I must admit that i have taken the jitter thread straight from tltrude thread as although i know what it does i have no idea what the numbers represent so maybe someone could explain that to me plz.

Anyway thx for your help, if there is anything you can see as an improvment to the script please let me know.

Once again, thx for your help :D
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Earthquake

Post by tltrude »

That looks like a good script, but you could remove "$door1" with an exploder. You have an fx explosion, but an exploder can set that off for you, remove the door, show a smashed door, and make chunks of door fly away. The exploder script in pak0.pk3/global explains how to set one up, and you can take my example map apart to see how I did it.

The jitter is right out of the pak0.pk3/global/obj_dm.scr script and the earthquake script tells what the numbers are. I do not recommend changing the numbers, as they are already set for the best effect. Here is what each number is for:

duration
magnitude
no_rampup
no_rampdown

You can find other predefined earthquakes in many of the stock scripts, and here are a few I have found:

Code: Select all

//******************************
// jitter effect from mgs
// jitter_mg [delay]
//******************************
jitter_mg local.time:

if (local.time)
{
	wait local.time
}

waitexec global/earthquake.scr .5 1 0 0

waitexec global/earthquake.scr .3 1 0 0

end


//*********************************
// jitter effect from mgs in cover
// jitter_mg_cover [delay]
//*********************************
jitter_mg_cover local.time:

if (local.time)
{
	wait local.time
}

waitexec global/earthquake.scr .3 .5 0 0

waitexec global/earthquake.scr .3 .2 0 0

end


//*********************************
// jitter effect from mgs in cover
// jitter_small [delay]
//*********************************
jitter_small local.time:

if (local.time)
{
	wait local.time
}

waitexec global/earthquake.scr .3 1 0 0

waitexec global/earthquake.scr .3 .75 0 0

waitexec global/earthquake.scr 1.25 .3 0 0

end


//******************************
// jitter medium effect
// jitter_medium [delay]
//******************************
jitter_medium local.time:

if (local.time)
{
	wait local.time
}

waitexec global/earthquake.scr .23 2 0 0

waitexec global/earthquake.scr 1 1 0 0

waitexec global/earthquake.scr 1.25 .3 0 1

end


//******************************
// jitter large effect
// jitter_large [delay]
//******************************
jitter_large local.time:

if (local.time)
{
	wait local.time
}

waitexec global/earthquake.scr .25 3 0 0

waitexec global/earthquake.scr .4 1.25 0 0

waitexec global/earthquake.scr 1 .75 0 0

waitexec global/earthquake.scr 1.25 .3 0 1

end


//********************************************
// jitter effect from being next to artillery
// jitter_artillery [delay]
//********************************************
jitter_artillery local.time:

if (local.time)
{
	wait local.time
}

waitexec global/earthquake.scr .23 3 0 0

end

You can add a delay when call for an earthquake thread. I did not add a number because I didn't want any delay between the explosion and the effect. But, if I wanted it to delay a half a second, I would of called for it like this:

thread jitter_large 0.5

Hope that helps!
Tom Trude,

Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

The script looks good to me nice work . Except one thing .

bombs_setup:

thread bomb1_start
end

bomb1_start:

why not just forget about the extra statements and just run bomb1_start ? or did you leave out some stuff .
Post Reply