doTouch

Post your scripting questions / solutions here

Moderator: Moderators

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 »

The French Tourist ! wrote:Well. But be careful with while(1) because it makes an infinite loop, so u must quit the loop when the player does not touch the trigger anymore.
nuggets wrote:else
{
end
}
end
although if your running this, the trigger maybe triggered again while the play remains in the trigger,
though adding a variable will solve it ;)

Code: Select all

local.player = parm.other
while (1)
	if (local.player isTouching $trigger)
	{
		if (local.player.triggered == 1)
		{
			end
		}
		else
		{
			//do you stuff
			local.player.triggered = 1
		}
	}
	else
	{
		local.player.triggered = 0
		end
	}
end
hope this helps, prob not cos it's all foreign 2 me :-/
Krane
Lieutenant General
Posts: 782
Joined: Sat May 31, 2003 4:18 pm
Location: California, USA
Contact:

Post by Krane »

Bjarne BZR wrote: So Krane: can you tell us what you want to do with it? Just in a very non-technical way... what are you aiming for?
I'm looking for a trigger that, when a allied player is inside, starts to kill him slowly, among w/ a series of mustard gas fx (creative, no?). But if he backs off (gets out of the trigger), he stops being hurt...Inside, gas and hurt...outside, no-hurt.
Image
User avatar
diego
Captain
Posts: 245
Joined: Sun Dec 21, 2003 10:47 pm

Post by diego »

Well, the trigger multiple will handle the hurt part easily. I have these in my map so if you stand too close to a fire, or fall into a vat of acid, you start to take damage.

In my script:

Code: Select all

Acidthread:
$Acid volumedamage 2
end
In my trigger brush:

Code: Select all

$targetname Acid
classname trigger_multiple
setthread Acidthread
You can also add a delay to how often the trigger fires, or increase the damage in the thread. But 2 will reduce you pretty quickly.

I have never used effects before. But I'm sure someone here could tell you how to add those lines to your thread.
Diego
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

sooner

Post by tltrude »

If you would of said that in the first post, Krane, it wouldn't of taken two pages to answer.
Tom Trude,

Image
Krane
Lieutenant General
Posts: 782
Joined: Sat May 31, 2003 4:18 pm
Location: California, USA
Contact:

Re: sooner

Post by Krane »

tltrude wrote:If you would of said that in the first post, Krane, it wouldn't of taken two pages to answer.
Sorry, my General :oops:, but my time is very tight right now...

I'll pay 30 push-ups, sir!
Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

also, you could do this since i've found delay isn't in seconds...

acid:
if($player istouching $acidtrigger)
{
$acid volumedamage 2
wait 1 //or whatever
}
end

once again, someone correct me if thsi is the wrong format for istouching.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Krane
Lieutenant General
Posts: 782
Joined: Sat May 31, 2003 4:18 pm
Location: California, USA
Contact:

Post by Krane »

Nice one, lizardkid :D !

I was trying all possible methods using while, but while makes the animations starts every frame...Here's the final working one:

Code: Select all

mustard:

local.player = parm.other 
if(local.player istouching $gases_trigger) 
{ 
$gases anim start // only runs once coz of if
$gases_trigger volumedamage 3 
wait 1 //or whatever 
} 
$gases anim stop // stops the anim when player leaves the trigger

end 
Thanks to all you guys :D !

Looks like I needed the 2 pages, sir 8-) !
Image
Krane
Lieutenant General
Posts: 782
Joined: Sat May 31, 2003 4:18 pm
Location: California, USA
Contact:

Post by Krane »

Hmm, still not perfect coz the animation stopped...Here's what is working perfectly:
mustard:

local.player = parm.other
if(local.player istouching $gases_trigger && local.player.dmteam=="allies")
{
iprintln "started"
$gases anim start
$gases_trigger volumedamage 2
wait 1 //or whatever
}
while(local.player istouching $gases_trigger && local.player.dmteam=="allies")
{
wait 1
}
iprintln "stopped"
$gases anim stop


end
Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

something gives me the impresion that it skips to the end where
$gasses anim stop

is. don't ask me why...
whcih iprintln's appear?
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Krane
Lieutenant General
Posts: 782
Joined: Sat May 31, 2003 4:18 pm
Location: California, USA
Contact:

Post by Krane »

The one between "code" really skips to the end, so I added a:

while (etc,..)
{
wait 1
}

and it's not skipping anymore. The one between "quote" is working fine!

Txs again!
Image
Post Reply