Page 2 of 2

Posted: Thu May 20, 2004 1:01 am
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

Posted: Thu May 20, 2004 7:34 am
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.

Posted: Thu May 20, 2004 9:08 am
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.

sooner

Posted: Thu May 20, 2004 2:32 pm
by tltrude
If you would of said that in the first post, Krane, it wouldn't of taken two pages to answer.

Re: sooner

Posted: Thu May 20, 2004 2:53 pm
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!

Posted: Thu May 20, 2004 3:25 pm
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.

Posted: Thu May 20, 2004 4:16 pm
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-) !

Posted: Thu May 20, 2004 5:31 pm
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

Posted: Thu May 20, 2004 6:03 pm
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?

Posted: Thu May 20, 2004 7:52 pm
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!