Federico on 13/6/2020 at 10:48
Hi guys! I'm an absolute newbie here, so be patient, please. :)
I have a rotating wheel that goes on and off via a switch. The wheel is supposed to be on when the mission starts and to cause damage to the player (but only while spinning).
So:
Switch > JointsState > AnimS On
Wheel > Sources > WeaponStim > Contact.
Result: it works, but the wheel keeps causing damage even when it's turned off.
So I've tried looking into Ominous Bequest Gold (it has a scepter that shocks you if you frob it, until you slash a certain wire with your sword), and my set-up was:
2 Wheels, 2 TeleportTraps, a Button, a Switch, an Inverter:
TelTrap1 > CDLink to Wheel 1
TelTrap2 > CDLink to Wheel 2
Switch > CDLink to Inverter
CDLink to TelTrap1
CDLink to Teltrap2
Properties: Script > TrapRelay
Trap Control Flags > NONE...
JointsState > ON -NONE - NONE...
Button > CDLINK to Switch
Properties: TweqJointsState > NONE...
Result: The wheel works, but no damage at all.
I've tried "countless" combinations of the latter set-up, with very weird results. I know there must be a solution hiding somewhere, only I don't have the knowledge to flush it out.
Where am I going wrong? Any suggestion would be greatly appreciated!
john9818a on 21/6/2020 at 08:32
I'm not sure if you want to be able to turn the wheel back on again so... Use two wheels at the same time except make the "damage" wheel slightly larger than the other wheel. When the lever is frobbed, have a destroy trap destroy the "damage" wheel. Also remove the ambient hacked property from the "damage" wheel so that you don't have twice as much wheel rotating sound being played.
vfig on 21/6/2020 at 13:52
I would do this with just the one wheel. Make it start/stop with TweqOnOff, as usual. And put the stim source on a metaproperty, and also add/remove the metaproperty from the wheel appropriately.
Edit: probably just follow Yandros's advice below for the metaproperty, and skip the rest of this post.You could maybe use (
https://dromed.whoopdedo.org/public_scripts/trapmetaprop) TrapMetaProp for that. But I'd just use squirrel: put this "HurtyWheel" script on the wheel, and then it will add/remove the "M-WheelDamage" metaproperty from itself when it gets TurnOn/TurnOff:
Code:
class HurtyWheel extends SqRootScript
{
function OnTurnOn() {
if (! Object.HasMetaProperty(self, "M-WheelDamage")) {
Object.AddMetaProperty(self, "M-WheelDamage");
}
}
function OnTurnOff() {
Object.RemoveMetaProperty(self, "M-WheelDamage");
}
}
Edit: I should probably add instructions in case you've never used a squirrel script before:
1. "script_load squirrel" in Dromed
2. create a subfolder of your mission's folder called "sq_scripts"
3. create a text file (with Notepad or whatever) in that subfolder, called "
whatever.nut" (I usually name it for the mission, but the name is not important, only the .nut extension is)
4. paste the script above into the file and save.
Yandros on 21/6/2020 at 17:04
I would just put the source on a metaprop and just use NVMetaTrap to add/remove it.
vfig on 21/6/2020 at 19:35
Quote Posted by Yandros
I would just put the source on a metaprop and just use NVMetaTrap to add/remove it.
Thanks, I knew there'd be a solution to adding/removing the metaprop using NVScript (which I'm completely ignorant of).
Federico on 22/6/2020 at 08:11
Great, it works! Thanks everybody. I gave it a MetaProperty and then used NVMetaTrap. :thumb: