PDA

View Full Version : TrapDispenser?



goldsla
24th Jan 2009, 19:48
I need to have a container dispense 5 flares every time it is opened. And reading the documentation for TrapDispenser in tnhScript.osm makes me think that it could do the trick if I can figure out how to use it.

Here is the documentation:


TrapDispenser (GenericTrap)
Creates a new object and adds it to the container linked with ControlDevice. The object archetype to create is named in the dispense parameter. Using the player as a container works as expected.

I thought that what I should do is:

script_load tnhScript
Create a child of Tulz>FlareTypes>Flare called Flares5 which has EngineFeatures>StackCount: 5
edit the properties for the container:

Add Script: TrapDispenser
Add Editor>DesignNote: dispense="Flares5"



But when I tried that, the container did not dispense anything when frobbed open. Any suggestions?

R_Soul
24th Jan 2009, 20:30
You haven't set up the CD link to the container. Because the player only exists in game mode, you have to point the link to the starting point instead.

Btw, there's a demo mission included with tnhscript.

goldsla
24th Jan 2009, 22:00
You haven't set up the CD link to the container. Because the player only exists in game mode, you have to point the link to the starting point instead.

Btw, there's a demo mission included with tnhscript.

CD from the container to the starting point? I tried that as well as from the starting pont to the container. Nothing. I'll see if I can make sense out of the demo mission in DromEd. ...

Well ... I now have it such that I get 10 flares when I open and 10 when I close ... It's a start. I'll figure out why the doubling, and I'll put in a filter so that only opens give flares ... Thanks!

Edit: This is my rig so far

Container >-CD-> TrapThreshold (every 4th starting at 2) >-CD-> TrapDispenser (dispense=Flares5) >-CD-> StartPt

That gets me the flares on opens only. Now how to autoclose the container? I thought Script>Timing:2000 would do it, but no. Maybe a time delay loop back to itself?

goldsla
24th Jan 2009, 22:59
If the dispenser is also something like a footlocker, it'll inherit the container script, which will also give you the contains linked object. It is a footlocker, but I did not set a contains link. Somehow every open and every close sends two TurnOns. Who would have thought? So I use the TrapThreshold to only send one every 4th TurnOn, and that works.

R_Soul
24th Jan 2009, 23:19
That's a feature of the container script.

There is a way to set it up as you initially planned:
Footlocker: StdLever script (remove Container and LockSounds, don't inherit: false).
Give it a FrobProxy link to a lever, no data needed.

Give the lever a CD link to the dispenser

goldsla
24th Jan 2009, 23:29
That's a feature of the container script.

There is a way to set it up as you initially planned:
Footlocker: StdLever script (remove Container and LockSounds, don't inherit: false).
Give it a FrobProxy link to a lever, no data needed.

Give the lever a CD link to the dispenserHow does that auto-close the container? Color me confused.

goldsla
24th Jan 2009, 23:37
I removed all the scripts from my container, and now it works like so:

Container >-CD-> TrapThreshold (every 2nd starting at 1) >-CD-> TrapDispenser (dispense=Flares5) >-CD-> StartPt

Now that this is clean, I'll try to make sense of why your lever idea would close the container.

R_Soul
24th Jan 2009, 23:47
It won't, I didn't see your edit while I was posting.

goldsla
24th Jan 2009, 23:49
Any ideas on how to get the container to auto-close after a second or two?

R_Soul
25th Jan 2009, 01:25
Container >-CD-> TrapThreshold (every 2nd starting at 1) >-CD-> TrapDispenser (dispense=Flares5) >-CD-> StartPtOk, start with that.

Create a marker, and turn it into a timer. TrapTimedRelay might not work for everyone, but you can use TrapRandomTimer (from tnhscript) with min_time equal to max_time (milliseconds).

Link the threshold to the marker (CD), and link the marker to the footlocker (CD again).

Add to the footlocker the script TrapFrobber, ensuring it's original scripts are still inherited. This is also in tnhScript, so you can read about what it does.

goldsla
25th Jan 2009, 01:31
Ok, start with that.

Create a marker, and turn it into a timer. TrapTimedRelay might not work for everyone, but you can use TrapRandomTimer (from tnhscript) with min_time equal to max_time (milliseconds).

Link the threshold to the marker (CD), and link the marker to the footlocker (CD again).

Add to the footlocker the script TrapFrobber, ensuring it's original scripts are still inherited. This is also in tnhScript, so you can read about what it does.
Thanks. I'll try that.

I am having no luck with NVRelayTrap in the same position. It gets the TurnOn (I have spy on the Marker with NVRelayTrap) but the container never gets anything from it.

goldsla
25th Jan 2009, 01:56
OK. Doing as you suggested the container reports getting a turnon, but remains open. So I re-thought the NVRelayTrap, and got it working to send a turnoff when it gets a turnon. But the container ignores that too. So I think I need a way to change the turnon to a frobproxy after the delay ... I think that NVRelayTrap will do that too, if I can figure it out. I am still having trouble with the way that script instructions are written. It is as though all script developers want to be extremely economical in their documentation, to the point of weakness.

goldsla
25th Jan 2009, 02:58
I ended up using the NVRelayTrap with the following Design Note:

NVRelayDelay=3000;
NVRelayTrapTDest="&FrobProxy";
NVRelayTrapTOn="[5.00]Touch"

I put a FrobProxy link from the NVRelayTrap to the container with Data: NoWorld; AllowDirect

And the container had a Receptron for Touch (min:1, no max); Effect:Frob Object; Target Object: Me

Whew!

Thanks for all your help RSoul!!

R_Soul
25th Jan 2009, 15:27
OK. Doing as you suggested the container reports getting a turnon, but remains open.If you're using the Spy script, it'll interfere with Telliamed's scripts. In my case it causes a crash. You can use NVSpy, which won't interfere because NVScript is based on tnhScript (to some extent).

goldsla
25th Jan 2009, 18:35
That's good to know. I was using Spy because it seemed to work better ... oh well. At least I have this all working now. Thanks.

Yandros
26th Jan 2009, 02:44
It's possible that the reimplementation of Spy from Public Script will play more friendly with tnhScript as well, as opposed to the original Spy in VK's script.