Page 1 of 2

spawning triggers?

Posted: Sat Jul 03, 2004 10:03 pm
by lizardkid
okay, how can i spawn a trigger around a certain area via script, and how can i assign values to it?

trigger

Posted: Sat Jul 03, 2004 10:42 pm
by tltrude
Your sig logo images are not working.

You must first have a set of coordinates to act as the starting point to spawn the trigger. For now, let's pretend this point is at (0 0 0) of the map.

local.trigger = spawn trigger_multiple targetname "mytrigger"
local.trigger.origin = ( 0 0 0 ) // coordinates, or the targetname of an entitiy like $myswitch.origin.
local.trigger setsize ( -30 -30 0 ) ( 30 30 60 ) // two 3d points to define the size of the trigger from the origin point (xyz)(xyz).
local.trigger.wait = 10

In this case the edges of the trigger brush are 30 units to the left and 30 units to the right of the origin point; 30 unit to the front and 30 units to the back of the origin; at the origin and 60 units above the origin.

Hope that helps.

Posted: Sat Jul 03, 2004 11:33 pm
by lizardkid
yeah i'm aware my sig pictures aren't working, i'm finiding another hoster right now, jsut haven't deleted them yet :wink:

that should be exactly what i need. you're a lifesaver Tom :)

Posted: Tue Jul 06, 2004 10:50 pm
by lizardkid
okay well, they've spawned, i'm pretty sure of that. but they either don't 'teleport' to their locations or don't trigger. here's the relevant script. btw they don't trigger. i'm also certain that this thread is called as everything after it (fx and such) work perfectly.

Code: Select all

//------------------------------------------------------
spawn trigger_multiple "targetname" "groundzero" 
$groundzero.origin = $bangalore.origin        
$groundzero setsize ( 96 96 180 ) ( 96 96 180 )
$groundzero.setthread = firedmg
//-------------------------------------------------------
spawn trigger_multiple "targetname" "groundone"
$groundone.origin = $bangalore.origin
$groundone setsize ( 224 224 180 ) ( 224 224 180 )
$groundone.setthread = firedmg
//-------------------------------------------------------
spawn trigger_multiple "targetname" "groundtwo" 
$groundtwo.origin = $bangalore.origin
$groundtwo setsize ( 352 352 180 ) ( 352 352 180 )
$groundtwo.setthread = firedmg
//-------------------------------------------------------

Posted: Wed Jul 07, 2004 12:23 am
by bdbodger
why have you got them all spawning at the same place ? As far as the rest of it goes no way to tell without seeing the thread called by the setthread .

setsize

Posted: Wed Jul 07, 2004 12:24 am
by tltrude
With that "setsize" it is a wafer thin trigger 180 units above the origin point. Try using the setsize I have in the example.

Posted: Wed Jul 07, 2004 12:27 am
by bdbodger
oops ya the first number need to be negitive numbers and both are 180 on the z axis like tltrude said 180 above the bangalore.

Posted: Wed Jul 07, 2004 12:40 am
by lizardkid
well the reason i have them overlapping is so that the damage that the fire deals is added when you enter the trigger, and okay, i'll use your setsize T.

i thought with the 180 it'd spawn 180 units tall, is there any way to make it taller? so that airborne enemies (players, namely. jumping out of windows etc) can be affected as well?

Posted: Wed Jul 07, 2004 12:44 am
by bdbodger
There is probably a better way than spawning 3 triggers at the same spot .

Posted: Wed Jul 07, 2004 2:36 am
by lizardkid
if you mean caluculations with while loops and stuff..... i'm not too apt at that stuff. triggers were the best way for me. :wink: besides, they're removed afterwards and nothing is leftover once all is said and done. :)

otherwise, (not being rude) how would you propose to do it?

setsize

Posted: Wed Jul 07, 2004 2:51 am
by tltrude
Ok, well I guess you didn't get how setsize works in my first example.

Think of the trigger brush as a 6 sided box. The setsize has 6 numbers and each is the distance of a side from the origin point (the origin of your bangalor). A negitive number will move a side in one direction, and a positive number will move a side in the opposite direction.

The third number, in each of the two groups of number, is for the botton and top of the trigger (Z axis). So, what numbers should we use?

Posted: Wed Jul 07, 2004 3:07 am
by lizardkid
oh i get it now.

something like this.... (the largest trigger)

( -352 -352 180 ) ( 352 352 -180 )

am i right? six sides, the numbers for each are the numbers given, i still don't know which comes first (for instance which Z-axis comes first in the thingie, up or down) but i understand it now. :wink:

thanks Tom! :D

Posted: Wed Jul 07, 2004 4:28 am
by tltrude
They are (X Y Z) (X Y Z), so the last two numbers are for the two Z sides. The first Z is for the bottom, so the bottom of your trigger is now 180 unit below the origin--probably underground. The second Z is for the top and it is 180 unit above the origin--making the trigger 360 units tall, and half buried in the ground.

Maybe this will help.

(X Y Z) (X Y Z) = (left back bottom) (right front top)

Note: Your trigger is also 704 uints wide and 704 units deep.

Posted: Wed Jul 07, 2004 6:58 am
by bdbodger
What about 1 trigger that just does more damage .

damage

Posted: Wed Jul 07, 2004 7:18 am
by tltrude
I'm pretty sure you can set up one trigger and damage according to how close you are to the origin of the explosion.

-------------------------------------------------------------------------------
radiusdamage ( Vector origin, Float damage, Float radius, Integer constant_damage )

radius damage at origin

-------------------------------------------------------------------------------

Here is how they used that in the ohmaha singleplayer script.

radiusdamage $bangalore_explosion1a 2000 192

And here is how they did it in the ohmaha multiplayer script.

radiusdamage $bangalore_explosion_left2.origin 640 384

I have no idea why the singleplayer one has 2000 damage, except that I think you get more than 100 health in singleplayer. The two numbers are damage and distance. But, the damage gets less the farther the player is from the origin point. Outside the radius there is no damage.