Author Topic: Does anyone have a "OnPlayerNotTouching" event?  (Read 1156 times)

If anyone has a event like this, please let me know!

What are you trying to make it do that it involves the player not touching it? Cause what you can always do if you need events to go off while nothing is happening to the brick itself involving a player is just use onrelay self firerelay depending on what you're trying to do.



To be more specific, the brick will have it's function happening only whenever it is not being touched by the player

so a check, not an always active input event?


probably the best way to handle it is on touch/firstTouch apply a variable, and on stopTouch remove the variable
then check the variable

Just have a relay running that causes whatever you want to happen, happen. Have playertouch cancelevents on the relay bricks, have playerstoptouch restart the relay.

I don't see why it'd need to be more complex than that just by the description.

that'd be for if it was always active instead of as a check

Well I mean...if no one is touching the brick then it would be make sense to use a relay on the brick while no-one is touching it. Then when they do touch it, cancel the events and when they stop touching it, re-fire the relay loop. What Blockhead says makes perfect sense to me but I get what phlack meant since the events should only fire once and not constantly loop.

A way to do it without calling a constant loop would be onPlayerTouch self vce_modVariable touching == 1
onPlayerStopTouch self vce_modVariable touching == 0

then you could fire an event to see if the brick has that variable, and if false then do whatever.

Itíd help to know more about what this is needed for, though still believe my solution solves it pretty well.

that'd be for if it was always active instead of as a check
the brick will have it's function happening only whenever it is not being touched by the player
It sounds like itíll be happening continuously, and if itís instead just a one time occurrence do everything else I said and just ditch the relay.

A way to do it without calling a constant loop would be onPlayerTouch self vce_modVariable touching == 1
onPlayerStopTouch self vce_modVariable touching == 0

then you could fire an event to see if the brick has that variable, and if false then do whatever.
Imagine this would work fine for most uses, though might run into some problems when multiple people are getting on and off.

if you want it to work with multiple people, add and subtract instead of set
that way it counts the number of people on it, with start/stop touch instead of touch/stoptouch

can be a bit prone to errors though, like if somebody disconnects, i don't expect it to call stoptouch

either way, with more information from the OP, a better solution can be suggested

in this scenario any player touching said brick would void its effects, the multiple people touching it has 0 effect as long as just one is doing so. Seems like a safe zone brick of the sorts?

with more information from the OP, a better solution can be suggested
I highly agree with this