Player is hurt when touching barbed wire

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
HotShizzle
Corporal
Posts: 25
Joined: Wed Apr 28, 2004 1:22 am
Contact:

Player is hurt when touching barbed wire

Post by HotShizzle »

I need some help with a barbed wire when touched will cause damage to the player....ive seen something with when the player touches the trigger he gets hurt, but ive forgot where the tut was....i know i have to assign the barbed wire with a target name and then do something with a if statement and local.player....can someone give me the solution...im sure its really simple...
~.::[FS] 4 LyF3::.~
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 »

well te if functino isn't needed

place a trigger_multiple around the barbed wire, and put
key: setthread
value: hurt_me
key: targetname
value: barbed_wire
on in the in the script have

hurt_me:
$barbed_wire volumedamage 1000
end

//1000 will kill the player
hope this helps, prob not cos it's all foreign 2 me :-/
HotShizzle
Corporal
Posts: 25
Joined: Wed Apr 28, 2004 1:22 am
Contact:

Post by HotShizzle »

o sorry yea i saw the same thing, but with more explanation in one of the tuts on the site...
~.::[FS] 4 LyF3::.~
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

look at volumedamage... should be near the end.

i think it's done by multiplying. the value by 5 of teh volumdamage and that's your damage per second.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

kill

Post by tltrude »

Nuggets little thread will kill the player with one touch, I think. So, you should probably try a smaller value. A trigger multiple fires every .2 seconds, unless you change it with key/value wait/1 .

hurt_me:
$barbed_wire volumedamage 10
end

Here is another way.

Code: Select all

 
hurt_me:

	$barbed_wire waitill trigger
	local.sucker = parm.other
	if (local.sucker istouching $barbed_wire)
		{
        		radiusdamage local.sucker.origin 10 16 
		}
	wait 1
	goto hurt_me

end
"10" is how much damage there will be every second. For this method, there is no setthread in the trigger and the thread must be started under prespawn or spawn ( thread hurt_me ).
Tom Trude,

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

Post by bdbodger »

Another way to do it is

hurt_me:

$barbed_wire waitill trigger
local.sucker = parm.other
if (local.sucker istouching $barbed_wire)
{
local.sucker hurt 10
}
wait 1
goto hurt_me

end
Image
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

nuggets wrote:well te if functino isn't needed

place a trigger_multiple around the barbed wire, and put
key: setthread
value: hurt_me

key: targetname
value: barbed_wire
on in the in the script have

hurt_me:
$barbed_wire volumedamage 1000
end

//1000 will kill the player
are those two lines neccesary?
Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

setthread makes the trigger start the thread when triggered without it you would have to run the thread and put waittill trigger in it like in tltrude's example . Either way will work . If you have more than one set of barbwire I would change it so every trigger around any barbwire ran this thread with setthread .

hurt_me:
local.player = parm.other
local.player hurt 10
end

or if each trigger ran the same thread without useing setthread

main:
$barb1_trigger thread hurt_me
$barb2_trigger thread hurt_me
$barb3_trigger thread hurt_me
end

hurt_me:
while(1){
self waittill trigger
local.player = parm.other
while(local.player istouching self)
{
local.player hurt 10
wait 1
}}
end

there are other ways of doing it too it is up to you how you do it .
Image
Post Reply