Sliptip on 8/2/2012 at 00:49
I've got a situation where the player must shoot an object with an arrow.
The first time the object gets hit, a control signal needs to trigger something.
The second time it gets hit it needs to trigger something else.
After that, the player shooting the object should have no effect, however this whole set-up needs to be resetable.
Is there an easy way to do this?
LarryG on 8/2/2012 at 01:15
What immediately comes to mind is using metaprops with NVRelayTraps and Design Notes ... just off the top of my head ...
Create a metaprop called M-1stHit and another called M-2ndHit.
M-1stHit should have NVRelayTrap, NVMetaTrap, and NVMetaTrap2. Use your Design Note (also in the metaprop) to:
* convert the arrow hit to a TurnOn that NVRelayTrap sends to the 1st thing you want to trigger
* convert the arrow hit to have NVMetaTrap add M-2ndHit to the object
* convert the arrow hit to have NVMetaTrap2 remove M-1stHit from the object
M-2ndHit is similar and should have NVRelayTrap and NVMetaTrap2. Use your Design Note (also in the metaprop) to:
* convert the arrow hit to a TurnOn that NVRelayTrap sends to the 2nd thing you want to trigger
* convert the arrow hit to have NVMetaTrap2 remove M-2nd Hit from the object
Start your object with it having M-1stHit on it.
You then only have to use some other marker or object to reset the whole thing by having it
* Remove M-1stHit from the triggering object (to ensure that you don't get the metaprop twice after putting it back on below)
* Remove M-2ndHit from the triggering object
* Add M-1stHit from the triggering object
Something like that should work. I leave the specifics of the Design Notes and how you set up a receptron to send the arrow hits to scripts as an exercise for the student. Aren't NVScripts fun?
Sliptip on 8/2/2012 at 01:37
Smart! Thanks Larry. I never think to use mprops for some reason - that should do the trick.
I firmly believe the NVRelayTrap has got to be the most significant addition to the Dromeding universe since Dromed itself.
LarryG on 8/2/2012 at 01:47
Once you learn the NVScript system, they are all really easy to remember and use. And, yes, NVRelayTrap is the most general purpose script around for sure!
Haplo on 8/2/2012 at 01:56
I do this quite often, and take the simplest path. After the object is hit by the arrow for the first time, I replace it with another object which is programmed to do the second task on the arrow hit, and so on. I do it this way because it is much easier to troubleshoot and extend if I ever think of extra stuff in the future.
In general, the easiest way to do this is using Gaylesaver's Validator script which does exactly this. It implements state machines without having to resort to meta properties and QVars.
nightshifter on 8/2/2012 at 01:59
I think that (
http://dromed.whoopdedo.org/tnhscript/trapthreshold) TrapThreshold is another way to go
3 markers with the script.
first with design note: threshold=1 to give an on to first needed action
second ( design note threshold=2) for second action and linked with an inverter to action one (if needed)
third to shut off action 2 ( if needed)
the third one allso can be used ( if needed) to reset the counters...
( using a marker with (
http://dromed.whoopdedo.org/tnhscript/traprelayrepeat) TrapRelayRepeat )
yes, scripts are fun...:)
Yandros on 8/2/2012 at 02:12
Or just use a QVar, and hitting the apple always increments it by 1. Use QVTriggers set to trigger on =1 and =2 to set off the two events. Reset the system by setting the QVar back to 0. If they keep shooting and increment it past 2 nothing happens until the reset occurs.
LarryG on 8/2/2012 at 03:50
I learn new stuff all the time!:thumb: