Page 1 of 1
Player is hurt when touching barbed wire
Posted: Fri Jun 11, 2004 10:13 pm
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...
Posted: Sat Jun 12, 2004 2:32 am
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
Posted: Sat Jun 12, 2004 3:30 am
by HotShizzle
o sorry yea i saw the same thing, but with more explanation in one of the tuts on the site...
Posted: Mon Jun 14, 2004 7:01 pm
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.
kill
Posted: Mon Jun 14, 2004 7:23 pm
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 ).
Posted: Mon Jun 14, 2004 10:36 pm
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
Posted: Fri Aug 27, 2004 8:41 pm
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?
Posted: Fri Aug 27, 2004 9:49 pm
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 .