Page 1 of 2

doTouch

Posted: Mon May 17, 2004 7:25 pm
by Krane
I'm havin some problems w/ doTouch in my trigger...I want a trigger that is activated only when someone is inside. When the player gets out, the stuff stops...In, stuff...Out, no stuff...

Can somebody help? :)

Posted: Mon May 17, 2004 9:28 pm
by lizardkid
if(istouching) is what you're looking for, dunnoi the syntax, try looknig at a stock map.

i think, not sure, but think it's like this...

if($player istouching $trigger)
{
//blah blah blajah
}

Posted: Mon May 17, 2004 10:34 pm
by diego
I don't know anything about this dotouch, but what is wrong with using a trigger >multiple? My scripting knowlege is very basic. But this does do what you are talking about:

If I'm inside the trigger multiple, I take damage, or activate an alarm. If I'm outside the trigger, nothing happens.

Posted: Mon May 17, 2004 10:38 pm
by blue60007
Yes a trigger_multiple will work 100 times better, and I can't even find (or heard of) a doTouch, oh wait that's probably a scripty thingy.

Posted: Tue May 18, 2004 4:02 pm
by fuhrer
can u use isinside?, but u would need a trigger multiple

Posted: Tue May 18, 2004 7:56 pm
by Krane
A trigger multiple activates a thread. When you leave the trigger, the thread continues. we have to use istouching w/ the trigger multiple.

Posted: Tue May 18, 2004 8:23 pm
by diego
Maybe it would help if you told us exactly what you wanted to happen when you are inside the trigger? I still don't see why a trigger multiple won't help you. If you leave the trigger, the thread is no longer being called.

Posted: Tue May 18, 2004 8:44 pm
by The French Tourist !
When you want to be hurted while being inside a trigger_multiple, use the command volumedamage. This command is only available when you are inside the trigger.
A trigger doesn't have to activate a thread. Il does if you enter the key/value : setthread/mythread. But you can use this syntax :

main:

level waittill spawn

thread mythread

end

// Thread

mythread :

$mytrigger waittill trigger
$mytrigger volumedamage 10

loop:
// Commands for the alarm
while ( $player istouching $trigger )
{goto loop}

end

while

Posted: Tue May 18, 2004 9:03 pm
by tltrude
Use a "while" loop.

Posted: Tue May 18, 2004 9:13 pm
by lizardkid
wooo! lots of ideas....

while($player istouching $trigger)
{

//blah blah
}
right tltrude?

Posted: Tue May 18, 2004 9:24 pm
by Bjarne BZR
lizardkid wrote:wooo! lots of ideas....

while($player istouching $trigger)
{

//blah blah
}
right tltrude?
To some extent, yes... but you need to get ahold of the player as well: and just writing $player is not enough as that will be an array of players...

This can all be done, but depending on what you want to happen it will be done in different ways. 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?

Posted: Tue May 18, 2004 9:55 pm
by lizardkid
i found DoTouch, in g_allclasses...

doTouch( Entity touchingEntity )


sent to entity when touched.

it is not fake nor a weird unknown command! *using valient voice*

Posted: Tue May 18, 2004 10:42 pm
by nuggets
local.player = parm.other
while (1)
if (local.player isTouching $trigger)
{
}
else
{
end
}
end

//you need all that crap otherwise the second time the trigger is touched what ever happens to local.playe will happen twice then 3 times etc... etc...

Posted: Wed May 19, 2004 3:24 am
by Krane
Ah, now it's clear :wink: !

We need the while on top!

Txs m8!

Posted: Wed May 19, 2004 11:26 pm
by The French Tourist !
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.