trigger size how can i set???

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
king_of_hi_ping
Corporal
Posts: 30
Joined: Wed Feb 05, 2003 7:17 pm

trigger size how can i set???

Post by king_of_hi_ping »

Have created a trigger_use witch sets off a bomb

I then use a trigger_multiple to glue the trigger_use to a player

Now as the player faces north or west the trigger works all over the map.

but if the player faces east or south nothing happens.

Im having trouble setting size of the trigger to fit the player, it needs to be small so other players near by cant hit use and set it off.. yet it has to be a radius around the player that it will work in all directions,

This is the trigger that is glued to the player
I should mention this is a stock map and I can only use scripting for what
I need to do.

spawn trigger_use "targetname" ("bomb2")
$bomb2 origin ( 1126 260 1000 )
$bomb2 setsize ( -32 -32 -32) (64 64 64)
$bomb2 setthread blow
$bomb2 wait 0.05 // How often the trig acts
$bomb2 delay .5 // How long before trig acts



also this player has a bomb attached to his head, when he dies is there a way the bomb is unattahced and stays where it is.?? and then spwning a new trigger_mltiple at that origin??


thanks for all the tips I get here, good stuff. Hope to hear back about this soon.

King of hi ping
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Post by tltrude »

if "angle" is set, the trigger will only fire when someone is facing the direction of the angle.

"cone" the cone in which a directed trigger can be triggered (default 60 degrees)

Players are 32 uints wide/deep and 96 units high.
Tom Trude,

Image
king_of_hi_ping
Corporal
Posts: 30
Joined: Wed Feb 05, 2003 7:17 pm

got some of it to work .

Post by king_of_hi_ping »

great to know cone. never heard of that before...

here is what I got to work dont know if I wrote the cone line right
but changed a few of the set size numbers and now it works great,


spawn trigger_use "targetname" ("bomb2")
$bomb2.origin = ( 1126 260 1000 )
$bomb2 setsize ( -60 -60 -60 ) (64 64 100)
$bomb2.cone = 360
$bomb2 setthread blow
$bomb2 wait 0.05 // How often the trig acts
$bomb2 delay .5 // How long before trig acts


now my next problem ... how do i get a dead player to drop the trigger

problem is when he dies he respawns with the bomb and trigger ,,,

heres part of the script that makes him the bomber,



//////////////

spawn trigger_use "targetname" ("bomb3")
$bomb3 origin ( 1126 260 -25 )
$bomb3 setsize ( 0.00 0.00 0.00 ) ( 50.00 50.00 200.00 )
$bomb3 setthread bomb
$bomb3 wait 10.05 // How often the trig acts
$bomb3 delay .1 // How long before trig acts

spawn trigger_use "targetname" ("bomb2")
$bomb2.origin = ( 1126 260 1000 )
$bomb2 setsize ( -60 -60 -60 ) (64 64 100)
$bomb2.cone = 360
$bomb2 setthread blow
$bomb2 wait 0.05 // How often the trig acts
$bomb2 delay .5 // How long before trig acts

spawn script_model "targetname" "bomb"
$bomb model "items/explosive.tik"
$bomb.origin = ( 1126 260 0 )
$bomb.angles = ( 0 90 0 )
$bomb.scale = 2.0


end

bomb:


thread talk
$bomb3 remove
local.bombguy = parm.other
local.bombguy playsound bombtick

local.bombguy takeall
local.bombguy.health = 1500
$bomb attach local.bombguy "Bip01 head"
$bomb2 glue local.bombguy


end

blow:

$bomb2 unglue local.bombguy
$bomb remove

local.poorbastard = parm.other
local.poorbastard playsound gas_explode2

local.spawn_fire = (local.poorbastard.targetname + "_fire")
spawn animate/explosion_conflagration targetname local.spawn_fire
local.spawn_fire = $(local.poorbastard.targetname + "_fire")
local.spawn_fire.origin = local.poorbastard.origin
local.spawn_fire.angles = local.poorbastard.angles


local.spawn_fire anim start
//$player exec global/bullethit.scr (0 -1 0) 1000 50 1
radiusdamage local.spawn_fire.origin 4000 800

wait 4
local.spawn_fire remove





new:

spawn trigger_multiple "targetname" ("bomb3")
$bomb3.origin = $bomb2.origin
$bomb3 setsize ( 0.00 0.00 0.00 ) ( 50.00 50.00 200.00 )
$bomb3 setthread bomb
$bomb3 wait 10.05 // How often the trig acts
$bomb3 delay .1 // How long before trig acts


spawn script_model "targetname" "bomb"
$bomb model "items/explosive.tik"
$bomb.origin = $bomb2.origin
$bomb.angles = ( 0 90 0 )
$bomb.scale = 2.0

end

talk:

local.player = parm.other
local.player iprint "You have the bomb hit use to blow up"

end
////////////////////


Now heres the problem for my suiced bomber,,,

it all works great run to the bomb and it is attached to you

we take away all your weapons cause now you have extra health in order to get close enough to ignite... (dont want player to run around invincable with guns)

when he blows, bomb is removed and the trigger is unglued
new bomb and triggers set it all up again where bombguy blew,


All works fine.... but.....

if he dies before he blows he respawns still as the local.bomber with the bomb on his head extra health and his wepons come back... he is now shooting invincable.. this bad!!!

I tried to add this thread:

take:
local.bombguy takeall
wait 10
goto take

end


problem is everyone who has grabed the bomb in the past also get there
guns removed ... this bad too!!

so my quistion... what script can i use that will take the local.bombguy name and abilities away from a player that died without blowing the bomb....

hope this aint to confuseing .... I think i just hurt myself ..

thanks again

king of hi ping
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

While isalive

Post by tltrude »

Well you can use the command "isalive". Like:

while (isalive local.bombguy)
waitframe
$bomb2 remove
end

Or maybe just change the unglue line to $bomb2 remove and have the bomb respawn in its original spot. Does the guy blow up if he dies before getting to where he is going?

hope that works.
Tom Trude,

Image
king_of_hi_ping
Corporal
Posts: 30
Joined: Wed Feb 05, 2003 7:17 pm

Post by king_of_hi_ping »

Two problems I have,

one. its important the bomb statys where the guy dies,

at the moment it will stay where he explodes himself, and it can be picked up by others .. but if he is killed before he blows, he respawns with the bomb and weapons, makeing him invincable. not good,

To fix this i tried to write


//////////

takeall:

local.bombguy takeall
wait 10

goto takeall

end

/////////


(all would be fixed if i could make this work for just the one local.bomb guy) but it takes weapons from all past bomb guys as well

what happens is everyone who has been bomb guy looses weapons. even if they dont have the bomb,.

so guess what has to happen is if local.bombguy dies at the hands of others or suicede.. he needs to drop the bomb and triggers that go with it .. have tried this script but no luck

ugg:
while (isalive local.bombguy)
waitframe
$bomb2 unglue local.bombguy
$bomb remove

end


how about a script that says if local.bobguy health is less then 5 goto blow

how whould i write that ..

Yor suggestion of putting the bomb back to the original origin wont work cause i have 10 players waiting there to grab it ... what a mess that made.. blood everywhere ..lol


im close but so far ...
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

over my head

Post by tltrude »

Sorry, that's a little over my head. You probably need triggers at the spawn points to clear the "bombguy" label from the players. I think the line:

local.player = pram.other

will do that.
Tom Trude,

Image
king_of_hi_ping
Corporal
Posts: 30
Joined: Wed Feb 05, 2003 7:17 pm

got it

Post by king_of_hi_ping »

Hi there,

thank you for your help..I did manage to figure something that works well, I got it from a dog script that is also posted on the forums ..

so everyone knows a method that works this is the script I thread when the bomb is picked up.

bomb:


$bomb3 remove
local.bombguy = parm.other
local.bombguy playsound bombtick

local.bombguy takeall
local.bombguy.health = 1500
$bomb attach local.bombguy "Bip01 head"
$bomb2 glue local.bombguy
level.bombguy = 1

local.bombguy thread bomberdeath

////////////

other stuff happens here witch i posted above

/////////////


bomberhealth:

while (1)
{
if ( self.normal_health <= 0 ) //local bombers health reach 0
{

iprintln " suicide bomber is dead "

level.bombguy = 0
thread blow
break

}
wait .1
}
wait 2
thread new
end


If anyone notices something that may be wrong let me know.... the script does work but I dont know if it is correct.


I have also created a capture the flag game that works on the same idea,,

give it a try seems to be well liked .... =LMAO= server

see you all soon and again thanks
Post Reply