spawn bomb in stock map

Post your scripting questions / solutions here

Moderator: Moderators

.FuSe.
Lance Corporal
Posts: 10
Joined: Tue Dec 16, 2003 11:36 pm
Contact:

spawn bomb in stock map

Post by .FuSe. »

i am trying to spawn a bomb it be planted in stock maps
i already know how to spawn a say tiger tank in a map but how to attach a triggerable(i belive) bomb to it is stumpin me
any help would be great
Image
M&M
General
Posts: 1427
Joined: Sun Sep 14, 2003 1:03 am
Location: egypt
Contact:

Post by M&M »

there is a tut on making obj like that in the tuts section here on this site,i dont know about spawning it in a stock map ,but u could check it out.i fu already did then u'll have 2 wait 4 one of the pros 2 reply 2 u.btw is the tank drivable or just the object u want 2 blow?
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

trigger

Post by tltrude »

Spawn a "pulsating bomb" and a "non-pulsating bomb" (script_objects) in the same spot on the side of the two tanks--an unexploded tank and an exploded tank). Also, spawn a trigger_use in the same spot, and an explosion entity. Then, in the script, use "hide" for the non-pulsating bomb to hide it. The script should look something like this.

Code: Select all

main:

	level waittill spawn

	//spawn all the suff

	$tank1 hide  // Hide the exploded tank
	$bomb1 hide  // Hide the non-pulse bomb script_object


end

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

bomb_tank1:

	$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 
	$tank_explode anim start // explosion entity
	radiusdamage $bomb1.origin 120 256  // numbers are damage and radius
	$bomb1 remove
	$tank1 remove // tank entity
	$tank1_destroyed show // destroyed tank entity
	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

The trigger should have "setthread tank_bomb1".
Tom Trude,

Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

.FuSe., I did exactly this in the Dogville OBJ map, check the script of the map: http://www.planetmedalofhonor.com/rjuka ... gville_obj
Admin .MAP Forums
Image
Head above heels.
.FuSe.
Lance Corporal
Posts: 10
Joined: Tue Dec 16, 2003 11:36 pm
Contact:

Post by .FuSe. »

ok i downloaded your map and stole some of your script :)
here is what i got thus far

Code: Select all

// REMAGEN
// ARCHITECTURE: STAGGER
// SCRIPTING: POWZER


main:

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

setcvar "g_scoreboardpic" "mohdm3"

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

	level waittill prespawn
	
	level.dmrespawning = 0
	level.dmroundlimit = 5
	level.clockside = allies
	
	//*** Precache Dm Stuff
	exec global/DMprecache.scr
	
	level.script = maps/dm/mohdm3.scr
	exec global/ambient.scr mohdm3
	
thread global/door_locked.scr::lock

	
	
	level waittill spawn
	
	level.defusing_team = "allies
	level.planting_team = "axis"
	level.targets_to_destroy = 1
	level.bomb_damage = 200
	level.bomb_explosion_radius = 1000
	
          local.stuka = spawn script_model
        local.stuka model "vehicles/stuka_d.tik" 
        local.stuka.origin = ( 3730.68 -2800.60 440.72 )
        local.stuka.angles = ( 25 360 0 )
        
          local.fockwulf = spawn script_model
        local.fockwulf model "vehicles/fockwulf_d.tik"
        local.fockwulf.origin = ( 1280.56 -2617.86 868.88 )
        local.fockwulf.angles = ( 25 270 180 )
        
          local.opel = spawn script_model
        local.opel model "vehicles/opeltruckgreen_d.tik"
        local.opel.origin = ( 5875.20 -2871.74 2.43 )
        local.opel.angles = ( 0 90 0 )
        
        local.panzer = spawn script_model "targetname" "exploder"
        local.panzer model "vehicles/panzer_iv.tik"
        local.panzer.origin = ( 1082.15 -1036.92 -71.88 )
        local.panzer.angles = ( 0 50 0 )
        local.panzer = solid
        
        

	level waittill roundstart
	
	$bomb thread global/obj_dm.scr::bomb_thinker
	thread axis_win_bomb
	$bomb thread allies_win_timer
	$bomb thread exploder_wait
	
	local.bomb = spawn script_model "targetname" "bomb"
	local.bomb model "items/pulse_explosive.tik"
	local.bomb.origin = ( 957.49 -1184.19 -25.75 )
	local.bomb.angles = ( 10.0 0.0 0.0 )
	local.bomb.exploder_set = 1
	local.bomb.explosion_fx = "models/fx/fx_explosion.tik"
	local.bomb.trigger_name = "bomb_trigger"
	local.bomb.target = "exploder"
	
	local.trigger = spawn trigger_use "targetname" "bomb_trigger"
	local.trigger setsize ( 957.49 -1184.19 -45.75 ) //( 957.49 -1184.19 -45.75 )
	
end
	
	

end
	
axis_win_bomb:
	println "[threadStart] axis_win_bomb"
	while(level.targets_destroyed < level.targets_to_destroy)
		waitframe
	teamwin axis	

end

allies_win_timer:
	println "[threadStart] allies_win_timer"
	level waittill allieswin
	
end
still cant set the bomb though :(
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Well, what errors do you get in console?
Admin .MAP Forums
Image
Head above heels.
.FuSe.
Lance Corporal
Posts: 10
Joined: Tue Dec 16, 2003 11:36 pm
Contact:

Post by .FuSe. »

mm dont seem to get any
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Yes you were:
And by reading these errors, I made this:

Code: Select all

// REMAGEN
// ARCHITECTURE: STAGGER
// SCRIPTING: POWZER


main:

   // set scoreboard messages
   setcvar "g_obj_alliedtext1" "remagen"
   setcvar "g_obj_alliedtext2" ""
   setcvar "g_obj_alliedtext3" ""
   setcvar "g_obj_axistext1" ""
   setcvar "g_obj_axistext2" ""
   setcvar "g_obj_axistext3" ""
   setcvar "g_scoreboardpic" "mohdm3"

   level waittill prespawn
   
   level.dmrespawning = 0
   level.dmroundlimit = 5
   level.clockside = allies
   //*** Precache Dm Stuff
   exec global/DMprecache.scr
   level.script = maps/obj/mohdm3.scr
   exec global/ambient.scr mohdm3
   
   thread global/door_locked.scr::lock   
   
   level waittill spawn
   
   level.defusing_team = "allies
   level.planting_team = "axis"
   level.targets_to_destroy = 1
   level.bomb_damage = 200
   level.bomb_explosion_radius = 1000

   local.stuka = spawn script_model
   local.stuka model "vehicles/stuka_d.tik"
   local.stuka.origin = ( 3730.68 -2800.60 440.72 )
   local.stuka.angles = ( 25 360 0 )

   local.fockwulf = spawn script_model
   local.fockwulf model "vehicles/fockwulf_d.tik"
   local.fockwulf.origin = ( 1280.56 -2617.86 868.88 )
   local.fockwulf.angles = ( 25 270 180 )

   local.opel = spawn script_model
   local.opel model "vehicles/opeltruckgreen_d.tik"
   local.opel.origin = ( 5875.20 -2871.74 2.43 )
   local.opel.angles = ( 0 90 0 )
 
   local.panzer = spawn script_model "targetname" "exploder"
   local.panzer model "vehicles/panzer_iv.tik"
   local.panzer.origin = ( 1082.15 -1036.92 -71.88 )
   local.panzer.angles = ( 0 50 0 )
   local.panzer = solid

   local.bomb = spawn script_model "targetname" "bomb"
   local.bomb model "items/pulse_explosive.tik"
   local.bomb.origin = ( 957.49 -1184.19 -25.75 )
   local.bomb.angles = ( 10.0 0.0 0.0 )
   local.bomb.exploder_set = 1
   local.bomb.explosion_fx = "models/fx/fx_explosion.tik"
   local.bomb.trigger_name = "bomb_trigger"
   local.bomb.target = "exploder"

   local.trigger = spawn trigger_use "targetname" "bomb_trigger"
   local.trigger setsize ( 957.49 -1184.19 -45.75 ) ( 1000 -1100 0 )

   // level waittill roundstart

   $bomb thread global/obj_dm.scr::bomb_thinker
   
   thread axis_win_bomb
   thread allies_win_timer

end
   
axis_win_bomb:
   println "[threadStart] axis_win_bomb"
   while(level.targets_destroyed < level.targets_to_destroy)
      waitframe
   teamwin axis
end

allies_win_timer:
   println "[threadStart] allies_win_timer"
   level waittill allieswin
end
...and it works nicely. You just need to fix a destroyed model after the explosion.
Admin .MAP Forums
Image
Head above heels.
.FuSe.
Lance Corporal
Posts: 10
Joined: Tue Dec 16, 2003 11:36 pm
Contact:

Post by .FuSe. »

ok kool thz man
i actually copyed over your entire script and changed the coords
(from your map you made)
only thing i noticed is that the allies cant defuse the bomb
any ideas ?
Image
omniscient
Major General
Posts: 694
Joined: Tue Sep 16, 2003 12:02 am

Post by omniscient »

do uhave more than 1 person in game?
Image
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 »

level.defusing_team = "allies
should be
level.defusing_team = "allies"
hope this helps, prob not cos it's all foreign 2 me :-/
.FuSe.
Lance Corporal
Posts: 10
Joined: Tue Dec 16, 2003 11:36 pm
Contact:

Post by .FuSe. »

yup
got it all fixed though
forgot one set of quotes .... d0h
thx for the help guys
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Code: Select all

   level.defusing_team = "allies
   level.planting_team = "axis"
Take a REALLY close look at these two lines :)

( Hint: How many " characters do you see? )
Admin .MAP Forums
Image
Head above heels.
.FuSe.
Lance Corporal
Posts: 10
Joined: Tue Dec 16, 2003 11:36 pm
Contact:

Post by .FuSe. »

ok thats all fixed
i saw the typo :(
now one last question
on the trigger setsize .. how do you determin the coord. to enter for the value
cause if i move around the explosive then i once again cant set it
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

I set it some units + in evey direction in reference to the bomb, and the other coordinate some units - in evey diection in reference to the bomb.`Is that a good answer?
Admin .MAP Forums
Image
Head above heels.
Post Reply