astalas2031 Posted February 24, 2011 Share Posted February 24, 2011 Currently playing with a script that should cause a terminal to open when a certain value becomes 1.. to simplify.. I tried this.. with setting the player as the terminal's linkedref... ScriptName example ref rSelfref rLinked Begin GameMode if UsingDB == 1 set rSelf to getself set rLinked to getlinkedref rSelf.activate rLinked 0 endifend And I also tried this.. w/out using a linkedref.. ScriptName example ref rSelf Begin GameMode if UsingDB == 1 set rSelf to getself rSelf.activate player 0 endifend In either case the script is set on the terminal itself. Anyone have any clues? I want to be able to open a terminal from any cell or locations (even if said terminal is in a remote location.) I don't really care how I achieve it.. this is just what i've been trying. Link to comment Share on other sites More sharing options...
Tefnacht Posted February 25, 2011 Share Posted February 25, 2011 Hello. Let me start with some general information. Object scripts (scripts that are attached to items like your terminal, armors, doors, etc.) will only be executed if the player is in the same cell as the object, otherwise they are dormant and don't do anything. There are a few very specific exceptions to this “rule” but those don't really matter here. ;) Another thing: I noticed your use of GetSelf. This is not necessary and can be very misleading. A script attached to an object, is running ON that object. This means to send commands to this object, there is no reference prefix needed. set rSelf To GetSelf rSelf.Activate Playerand Activate Playerdoes the exact same thing. The second version is much simpler and easier to read, don't you think? :D Okay, now to your problem. You don't need a script on the terminal (because it won't be executed most of the time anyway) but the terminal reference itself must be a persistent reference and have a name. After you placed the terminal somewhere into the gameworld, double click on it, check “Persistent Reference” and give it a “Reference Editor ID”. “RemoteTerminalRef” for example. Now to open the terminal, you can use the command “RemoteTerminalRef.Activate Player” from any other script. For example from the script that sets your UsingDB global variable to 1 (thus making the global variable obsolete). If you need the global for some reason, you should use a quest script to monitor it or even a script running on a token item in the players inventory, depending on how fast you want the terminal to respond to setting UsingDB to 1. If you need immediate response, you should use a token item, otherwise a quest (quest scripts use less resources because they are not executed as often). I hope this helps. Have fun. Link to comment Share on other sites More sharing options...
astalas2031 Posted February 27, 2011 Author Share Posted February 27, 2011 Hello. Let me start with some general information. Object scripts (scripts that are attached to items like your terminal, armors, doors, etc.) will only be executed if the player is in the same cell as the object, otherwise they are dormant and don't do anything. There are a few very specific exceptions to this “rule” but those don't really matter here. ;) Another thing: I noticed your use of GetSelf. This is not necessary and can be very misleading. A script attached to an object, is running ON that object. This means to send commands to this object, there is no reference prefix needed. set rSelf To GetSelf rSelf.Activate Playerand Activate Playerdoes the exact same thing. The second version is much simpler and easier to read, don't you think? :D Okay, now to your problem. You don't need a script on the terminal (because it won't be executed most of the time anyway) but the terminal reference itself must be a persistent reference and have a name. After you placed the terminal somewhere into the gameworld, double click on it, check “Persistent Reference” and give it a “Reference Editor ID”. “RemoteTerminalRef” for example. Now to open the terminal, you can use the command “RemoteTerminalRef.Activate Player” from any other script. For example from the script that sets your UsingDB global variable to 1 (thus making the global variable obsolete). If you need the global for some reason, you should use a quest script to monitor it or even a script running on a token item in the players inventory, depending on how fast you want the terminal to respond to setting UsingDB to 1. If you need immediate response, you should use a token item, otherwise a quest (quest scripts use less resources because they are not executed as often). I hope this helps. Have fun. Thanks! I should have remembered the persistent reference checkbox.. the global is already handled by other stuff and automatically gets reset when needs be. Not a big fan of the token item method as I don't like to override existing stuff others may have modded to an item (or may one day).. nor am I a fan of giving the player an item to tote around arbitrarily. Link to comment Share on other sites More sharing options...
Recommended Posts