Ranokoa Posted March 27, 2010 Share Posted March 27, 2010 Okay, I have this simple SIMPLE script that refuses to work properly. Why? Probably because it's on a bloody triggerbox. Here is the script:scn RTrigZoneScript ref target Begin onTrigger player set target to getParentRef if target.getDisabled target.enable else target.disable Endif End It's simple, right? Basically let's put it this way... There is a table in front of me, and an apple on the table. I am hungry. I want that apple. I go towards the table but run through the triggerbox, the apple disappears because I passed through the triggerbox. Darn, I guess I don't get that apple. So I begin to walk back, again through the triggerbox, and the apple reappears. now I want the apple again, I reach for it and it just repeats. Basically one pass its gone second pass it's there, or visa versa depending on enable status. BUT! Here is what happens. I pass through the triggerbox and the apple disappears, I pass through again walking away and look back, ITS STILL GONE! The bloody thing doesn't reappear or enable. What am I to do? This has been a problem for well over 4 months but I have all but abandoned the mod for the last 2 till now. I've just been modding around it till I can find a way for it to work again, it just won't. Anyone know a solution? I tried even scripting the triggerbox like this: scn RTrigZoneScript ref target ref target2 Begin onTrigger player set target to getParentRef set target2.getself if target.getDisabled target.enable else target.disable Endif if target2.getdisabled target2.enable endif End so that the triggerbox would never disable, it still don't work. Anyone have a solution? I wouldn't even mind referencing each and ever 100+ triggerboxes or something and then ADDING another triggerbox in the SAME place that forces the OTHER triggerbox that makes the apple to always be enabled. Idk if the triggerbox disables itself when its reference is disabled or the link disappears, idk what to do! Anyone have any idea a solution? And keep in mind the triggerbox is generically scripted, and is in VAST use for the same purpose. I'm almost considering just putting a timer on it, which DOES work, but the apple will only reappear after a certain amount of time, not on a second pass, which would mean a LOT of reworking on the ENTIRE mod, but I am willing to do it as a last resort. I just want it to read if it's disabled, if so enable, and keep the path so if you pass again it will read if it's disabled, if not, meaning enabled, it will disable it. Continually disallowing the "apple" to be obtained. God the work I'd have to do.. the MANY hours I'd have to REDO things if I absolutely have to use that timer.... I so want to avoid it. (I even tried adding a second triggerbox that is initially disabled but enabled when the first one disables to enable the first one on a second pass and then redisable itself, it did not work) I use a testing realm for these purposes to ensure things don't screw the mod up. Be well, sleep well, fight well, live long.~Ranokoa PS: Respect muh authoritaaay. <3 you all. Link to comment Share on other sites More sharing options...
Argomirr Posted March 27, 2010 Share Posted March 27, 2010 The problem with this is that Parent and Child refs share the same enabled state. If you run through the trigger box, the apple is disabled, but the trigger box itself also. And if it's disabled, it won't be triggered when the player walks through. The only way around this is by directly using the apple's reference: scn RTrigZoneScript ref target Short DoOnce Begin onTrigger player If DoOnce == 0 Set target to AppleRef Set DoOnce to 1 Else if target.getDisabled == 1 target.enable else target.disable Endif EndIf End Link to comment Share on other sites More sharing options...
Ranokoa Posted March 27, 2010 Author Share Posted March 27, 2010 Hmm.. Well it would mean a lot of script editing but ya I think I'll give it a try! Thank you. I also have another problem.... Scriptname RMTeleportScript02 Short DoOnce Begin onTrigger if DoOnce == 0 player.moveto RMTeleportMarker02 Messagebox "You feel yourself being teleported to a random location within the maze" set DoOnce to 1 Elseif DoOnce == 1 Messagebox "It appears you were teleported the last time you were at this exact location, but upon revisiting it you realize it won't happen again and can proceed." endif endif End Well.. it teleports... but it glitches. When you teleport the first time any movement at all and you get back to the same location. You can't do anything. Even opening the console it disappears immediately. It's like it's stuck continuously teleporting the player over and over and over and over. Anyways, ima try that referencing. Won't like it, will increase work significantly just because of how much I gotta do, but if it works who cares?! Link to comment Share on other sites More sharing options...
Argomirr Posted March 27, 2010 Share Posted March 27, 2010 Ah, I've been fooled by this thing quite a few times. :P The MoveTo function acts as a return, causing script processing to jump back to the top of the script. That prevents the DoOnce from being set to 1 to prevent it from doing it over and over. It's a simple fix: Scriptname RMTeleportScript02 Short DoOnce Begin onTrigger if DoOnce == 0 Messagebox "You feel yourself being teleported to a random location within the maze" set DoOnce to 1 player.moveto RMTeleportMarker02 Elseif DoOnce == 1 Messagebox "It appears you were teleported the last time you were at this exact location, but upon revisiting it you realize it won't happen again and can proceed." endif endif End As long as you make sure the MoveTo is called last, things should be fine. :) Link to comment Share on other sites More sharing options...
Ranokoa Posted March 27, 2010 Author Share Posted March 27, 2010 Nope.. referencing doesn't work. Even tried taking away target altogether and just referencing the enable, disable, and enable again. Doesn't work. Same problem. Cept for when I reference all 3 things, then it just glitches up and doesn't wait for the player to trigger to disable it. But it won't enable after trigger either. The apple just disappears permanentally. When the "apple" disappears another "apple" linked to it is actually supposed to appear, and when the first apple appears again the second disappears. Well I tried simply console commanding the first apple to disable, and the second one does enable. Then without clicking out of reference enabled the first one again, and the second one disappeared. It seams the only working way I have found thus far is to just console command the apple to disappear, and it works exactly how it's supposed to. I feel doomed to a timer... plz god! PLZ! NOT THE TIMER! Link to comment Share on other sites More sharing options...
Ranokoa Posted March 27, 2010 Author Share Posted March 27, 2010 Am I doomed to the timer? Link to comment Share on other sites More sharing options...
documn Posted March 28, 2010 Share Posted March 28, 2010 I know you seem eager to do the triggerbox, but would it be acceptable to use a player.getdistance check instead? Link to comment Share on other sites More sharing options...
Argomirr Posted March 28, 2010 Share Posted March 28, 2010 GetDistance is an option, but not preferable. GetDistance is a CPU heavy function, and it's best to avoid using it every frame, especially if you're using it on multiple objects. Link to comment Share on other sites More sharing options...
Ranokoa Posted March 28, 2010 Author Share Posted March 28, 2010 Can you say insta crash on this much usage? lol Link to comment Share on other sites More sharing options...
Recommended Posts