Page 1 of 2

Thread for spawning explosive crates in stock maps.

Posted: Thu Oct 16, 2003 4:20 am
by tltrude
It's messy but, by god, it works great!!! And, you can make as many as you like by just changing the index numbers of all the parts and the name of the thread. All the threads should be started in prespawn, but the threads themselves should be stuck to the end of the script.


Code: Select all


level waittill prespawn

thread boomcrate1

//--------------------------------------------------->

// EXPLOSIVE CRATE SPAWN THREADS

//--------------------------------------------------->

 boomcrate1:

	local.crate1 = spawn script_model
	local.crate1.targetname = "explosive_crate1"
	local.crate1 model "models/static/indycrate.tik" 
	local.crate1.origin = ( -500 1388 0 )
	local.crate1.angles = (0 0 0) // if angles changed, adjust trigger setsize
	spawn script_origin targetname "killspot1"
	$killspot1.origin = (local.crate1.origin + (0 0 64))
	spawn trigger_multiple targetname "crate_trigger1" "spawnflags" "128" "health" "1"
	$crate_trigger1.origin = (local.crate1.origin)
	$crate_trigger1 setsize ( -27 -38 0) (27 38 49)
	$crate_trigger1 waittill trigger

	spawn "animate/fx_explosion_mine" targetname "explode_crate1" angle "-1" origin local.crate1.origin
	$explode_crate1 anim start
	radiusdamage $killspot1 250 256 // numbers are damage and radius
	local.crate1 hide
	$crate_trigger1 remove  // may not be needed because trigger is killed
	$killspot1 remove
	wait 20
	$explode_crate1 remove
	local.crate1 show
	local.crate1 remove
	thread boomcrate1

end

The crate respawns after 20 seconds.

Posted: Thu Oct 16, 2003 3:29 pm
by jv_map
Looks cool :)

I however want to give some useful hints (or maybe I just like to disturb the fun ;)).

Using targetnames is best to be avoided, since there always is a risk of multiple entities using the same targetname, resulting in an unwanted array. Therefore targetnames should only be set in Radiant, since there is no other way to 'get' entities from a map by script. However when using spawn commands it's better to simply set a variable, like this:

local.myobject = spawn object

One obvious advantage when using this in your script is that you can simply copy and paste the thread without having to alter the targetnames for the killspots and crate_triggers.

Posted: Thu Oct 16, 2003 8:40 pm
by bdbodger
something like this can be used several times just give it differnt origins

Code: Select all

level waittill prespawn 

thread boomcrate ( 0 1234 5678 )// origin

thread boomcrate ( 111 222 5678 )// origin

//---------------------------------------------------> 

// EXPLOSIVE CRATE SPAWN THREADS 

//---------------------------------------------------> 

 boomcrate local.origin: 

   local.crate = spawn script_model 
   local.crate model "models/static/indycrate.tik" 
   local.crate.origin = local.origin
   local.crate.angles = (0 0 0) // if angles changed, adjust trigger setsize 

   local.trigger = spawn trigger_multiple "spawnflags" "128" "health" "1" 
   local.trigger.origin = local.origin 
   local.trigger setsize ( -27 -38 0) (27 38 49)

   local.trigger waittill trigger

   exec global/model.scr local.origin // default is explosion mine
   radiusdamage (local.origin + ( 0 0 64)) 250 256 // numbers are damage and radius 
   local.crate remove
   wait 20 
   thread boomcrate local.origin

end 

Posted: Thu Oct 16, 2003 8:52 pm
by jv_map
Even better :D

20 20 hindsight

Posted: Sat Oct 18, 2003 4:25 am
by tltrude
Yeah that works great, but players can be trapped if they stand where a crate respawns. That is why I did the hide and show stuff--to block players.

Also It would be nice if there was an automattic setsize thing for the trigger--if the angles were changed. That would probably be a math problem. And, changing the angles would change all the crates to those angles with your generic thread.

Posted: Sat Oct 18, 2003 2:29 pm
by bdbodger
You are right with that script all the angles will be the same but it easy to fix

Code: Select all

level waittill prespawn 

thread boomcrate ( 0 1234 5678 ) 90 // origin angle

thread boomcrate ( 111 222 5678 )  180 // origin angle

//---------------------------------------------------> 

// EXPLOSIVE CRATE SPAWN THREADS 

//---------------------------------------------------> 

 boomcrate local.origin local.angle: 

   local.crate = spawn script_model 
   local.crate model "models/static/indycrate.tik" 
   local.crate.origin = local.origin 
   local.crate.angle = local.angle 
   local.crate notsolid
   local.trigger = spawn trigger_multiple "spawnflags" "128" "health" "1" 
   local.trigger.origin = local.origin 
   local.trigger setsize ( -27 -38 0) (27 38 49) 
   local.tigger.angle = local.angle 

   local.trigger waittill trigger 

   exec global/model.scr local.origin // default is explosion mine 
   radiusdamage (local.origin + ( 0 0 64)) 250 256 // numbers are damage and radius 
   local.crate remove 
   wait 20 
   thread boomcrate local.origin 

end 
I made the crate notsolid in the script and set an angle for the trigger will it work ?

Re: 20 20 hindsight

Posted: Sat Oct 18, 2003 2:36 pm
by jv_map
tltrude wrote:Also It would be nice if there was an automattic setsize thing for the trigger--if the angles were changed. That would probably be a math problem.
I think math difficulties can be avoided this way:

Code: Select all

local.trigger = spawn Trigger
local.trigger setsize ( -20 -40 0) (30 50 60)
local.trigger origin (2342 256 -241)
local.trigger.rotatedbbox = 1
local.trigger.angles = (0 35 0)

Angle

Posted: Sat Oct 18, 2003 8:37 pm
by tltrude
Angle does not work on the model. I guess it has to be "angles". This seems to work, but the trigger angles are not changing with the crate. Making the crate non solid is cheating, ha ha.

Code: Select all

	level waittill prespawn

	thread boomcrate ( -500 1388 0 ) (0 0 0) // origin and angles 
	thread boomcrate ( -500 1888 0 ) (0 90 0) // origin and angles

==============================================

//---------------------------------------------------> 

// EXPLOSIVE CRATE SPAWN THREAD 

//---------------------------------------------------> 

boomcrate local.origin local.angles: 

   local.crate = spawn script_model 
   local.crate model "models/static/indycrate.tik" 
   local.crate.origin = local.origin 
   local.crate.angles = local.angles
   local.crate notsolid 
   local.trigger = spawn trigger_multiple "spawnflags" "128" "health" "1" 
   local.trigger.origin = local.origin 
   local.trigger setsize ( -27 -38 0) (27 38 49)
   local.trigger.rotatedbbox = 1 
   local.tigger.angle = local.angles[2] 

   local.trigger waittill trigger 

   exec global/model.scr local.origin // default is explosion mine 
   radiusdamage (local.origin + ( 0 0 64)) 250 256 // numbers are damage and radius 
   local.crate remove 
   wait 20 
   thread boomcrate local.origin local.angles

end 

I tried it with "local.tigger.angles = local.angles" too and still didnt work. Does a trigger_multiple even have a bounding box?

Posted: Sun Oct 19, 2003 1:21 am
by nuggets
hey fellow scripters :D

just noticed a typo

level waittill prespawn

thread boomcrate ( -500 1388 0 ) (0 0 0) // origin and angles
thread boomcrate ( -500 1888 0 ) (0 90 0) // origin and angles

==============================================

//--------------------------------------------------->

// EXPLOSIVE CRATE SPAWN THREAD

//--------------------------------------------------->

boomcrate local.origin local.angles:

local.crate = spawn script_model
local.crate model "models/static/indycrate.tik"
local.crate.origin = local.origin
local.crate.angles = local.angles
local.crate notsolid
local.trigger = spawn trigger_multiple "spawnflags" "128" "health" "1"
local.trigger.origin = local.origin
local.trigger setsize ( -27 -38 0) (27 38 49)
local.trigger.rotatedbbox = 1
local.trigger.angles = local.angles[2]

local.trigger waittill trigger

exec global/model.scr local.origin // default is explosion mine
radiusdamage (local.origin + ( 0 0 64)) 250 256 // numbers are damage and radius
local.crate remove
wait 20
thread boomcrate local.origin local.angles

end

if the model being spawned anlges are changed, using local.trigger.angles = local.crate.angles should change the rotation of the trigger

if not though and you just want to change 1 angle (the Z angle), you will need to use
local.trigger.angles = (0 0 (local.crate.angles[2] + 45)) //or the needed rotational addition

Hey

Posted: Sun Oct 19, 2003 1:47 am
by tltrude
That fixed it!!! Thanks nuggets! Here is my solid crate version which will boot a player off the respawning spot. The crate pops up out of the ground! It even works with the crate standing on end (first crate).

Code: Select all


   level waittill prespawn 

   thread boomcrate ( -500 1388 38 ) (0 0 90) // origin and angles 
   thread boomcrate ( -500 1888 0 ) (0 90 0) // origin and angles
   thread boomcrate ( -500 2388 23 ) (90 0 0) // origin and angles 

============================================== 

//---------------------------------------------------> 

// EXPLOSIVE CRATE SPAWN THREAD 

//---------------------------------------------------> 

boomcrate local.origin local.angles: 

   local.crate = spawn script_model 
   local.crate model "models/static/indycrate.tik" 
   local.crate.origin = local.origin + ( 0 0 -80 )
   local.crate.angles = local.angles
   local.crate time 0.001
   local.crate moveUp 80
   local.crate move 
   local.trigger = spawn trigger_multiple "spawnflags" "128" "health" "1" 
   local.trigger.origin = local.origin 
   local.trigger setsize ( -27 -38 0) (27 38 49)
   local.trigger.rotatedbbox = 1 
   local.trigger.angles = local.angles 

   local.trigger waittill trigger 

   exec global/model.scr local.origin // default is explosion mine 
   radiusdamage (local.origin + ( 0 0 64)) 250 256 // numbers are damage and radius 
   local.crate remove 
   wait 20 
   thread boomcrate local.origin local.angles

end 


Posted: Mon Oct 20, 2003 4:39 am
by bdbodger
Thats ok no need to thank me for my time . :cry:

Help

Posted: Mon Oct 20, 2003 4:46 am
by tltrude
I did kinda, just not here which I should have.

http://www.modtheater.com/forum/showthr ... 493&page=2

THANKS bdbodger, and Jv_map!!!!!!!!!!!!!!

Posted: Mon Oct 20, 2003 12:39 pm
by bdbodger
:oops: :lol:

Posted: Wed Oct 22, 2003 1:24 am
by nuggets
np's matey :D

how is it working though that it can't respawn at a player location?

All fixed now

Posted: Wed Oct 22, 2003 5:32 am
by tltrude
If a player stood where a crate respawned, it would trap him--could not move. bdbodger's solution was to make the crates non-solid. I fixed it by spawning the crates underground and having them pop up to boot players off the spot. Works great now!!!