Ziphelon Posted September 18, 2004 Share Posted September 18, 2004 Is it safe to do this: begin coolScript ;a severely shortened cool global script ... StopScript, coolScript end Also, am I right in thinking that you can only use the StartScript and StopScript on global scripts? Link to comment Share on other sites More sharing options...
Marxist ßastard Posted September 18, 2004 Share Posted September 18, 2004 Is it safe to do this:begin coolScript ;a severely shortened cool global script ... StopScript, coolScript end Yes... Also, am I right in thinking that you can only use the StartScript and StopScript on global scripts? ...And yes -- local scripts (targetted global scripts do not apply here, as they can be terminated with StopScript) can only be stopped by putting conditional returns in, or, if this is an object that can be safely disabled when the script execution needs to break in a mod with a Tribunal or Bloodmoon requirement, by putting a "SetDelete 1" line in. Link to comment Share on other sites More sharing options...
Ziphelon Posted September 18, 2004 Author Share Posted September 18, 2004 Rather than start a whole other topic: Is it possible to test things like distances of things in a cell other than the one the player's in? If so, does it depend on whether the script is global or local? example:if ( player is in balmora mages guild ) ;objects in fighters guild: if ( object -> getdistance otherone < 10 ) blah endif endif Link to comment Share on other sites More sharing options...
Marxist ßastard Posted September 19, 2004 Share Posted September 19, 2004 AFAIK, objects in interior cells that the player is not currently occupying are completely static. Thus, distance measurements taken immediately before the PC's departure from that cell can be assumed constant until the PC enters that cell again. If you can use a different method that would rely on pure math or be cell-restricted, reply with what you need this for and I'll think of something that could work. If not, state your intent in using this anyways -- I'm quite curious as to why you'd need to detect an object within ten units of another object -- and take advantage of the fact that this is an easy set-up for an experiment. Link to comment Share on other sites More sharing options...
Ziphelon Posted September 19, 2004 Author Share Posted September 19, 2004 If you can use a different method that would rely on pure math or be cell-restricted, reply with what you need this for and I'll think of something that could work. If not, state your intent in using this anyways -- I'm quite curious as to why you'd need to detect an object within ten units of another object -- and take advantage of the fact that this is an easy set-up for an experiment.All riiight...you asked for it: I'm helping someone with their mod by scripting, one of the quests requires putting certain objects (we'll say a paper) on certain elevated objects (we'll say a table). Not knowing the complete details, I made up a couple rules on my own: 1) At least some of the tables must be in different cells2) One paper per table I thought instead of using some boring activator like that Morag Tong quest where you get the Khajit Ring I could actually have the player put the objects on the tables himself. To do this, I came up with (for me) an ingenious idea where I spread some activators around a table with a GetDistance script that had a range shorter than the height of the table (so the paper couldn't be put on the floor). The GetDistance script went on the papers so of course it targetted the activators. For each table there was a different numbered activator associated with it. (Table 1 had paperDetector1, table 2, paperDetector2, etc.) The papers had the same scripts except for the global they set. (paperDetector1 had paperDetected1, paperDetector2 had paperDetected2, etc.) There was also a seperate counter that was a global script that was to be run through its code once when the player told the quest-giver that he finished the quest to see if he really did. The scirpt worked like this: it would reset its counter (a global: papersPlaced) and then add 1 to it for each paperDetected global set to on and then stop after doing so with StopScript. If there were five papers to be placed, then if papersPlace >= 5 the quest was done. There are of course the problems of papers being taken away after being placed correctly (making the script much more complicated), making sure the paper that's close isn't in the player's inventory (easily handled), and others I had known but forgot as I spent the half-hour it took to write this. To summarize, right now the script needs to accomplish this:1) detect when the papers are placed2) detect when placed papers are taken away3) count up papers placed when required My main problem is #2. Although something like this might seem to work at a glance,if ( paper #2 -> GetDistance, activator #3 < 10 ) set activator #3 to 1 else ;if #2 isn't on #3 if ( activator #3 == 1 ) set activator #3 to 0 endif endifit doesn't. What if paper #5 is on activator #3? Other than making an extremely long script where it tested each paper for each table, I don't know what to do. You probably know this, but just in case I'll let you know: I can't switch the scripts from the papers to the activators since the paper's references don't persist (in other words, GetDistance won't work). :help: I don't what else write atm. If you'd like to see the current state of this quest, I can pm it to you; just let me know. P.S. I used something more like 25 for GetDistance. B) P.P.S. AFAIK? Link to comment Share on other sites More sharing options...
Marxist ßastard Posted September 20, 2004 Share Posted September 20, 2004 You should probably take note of these two points concerning GetDistance:GetDistance measures the distance between the centers of objects, and is thus somewhat useless in measuring distances between surfaces.The units that GetDistance provides are quite small -- the space between your charachter's feet can be measured in dozens of these units.Unless these tables, thrones, or what have you are circular and arranged in a very peculiar manner (or placed by the PC, or placed completely randomly), then, given the former point, GetDistance will be a poor method of detection. It would be better to just fetch the placed object's position at the moment it is dropped, and, if the Z axis position is greater than that of the table's surface, put the X and Y axis measurements through a series of inequalities that define the table's surface. For instance, if you had a perfectly square table with sides measuring 256 units and the center of the surface lying at origin, the meat of the code for the script attached to the corresponding paper would be something like the following (clarity has been sacrificed in order to keep relatively flat and concise code): Short OnPCDrop Short Placed If ( OnActivcate ) Set Placed to 0 Activate ElseIf ( OnPCDrop < 1 ) Return ElseIf ( GetPos Z < 0 ) Set Placed to 0 ElseIf ( GetPos X < -128 ) Set Placed to 0 ElseIf ( GetPos X > 128 ) Set Placed to 0 ElseIf ( GetPos Y < -128 ) Set Placed to 0 ElseIf ( GetPos Y > 128 ) Set Placed to 0 Else Set Placed to 1 EndIf Set OnPCDrop to 0 ...And then you would collect the status of each paper when needed -- provided that the references to each paper are marked as persistent -- like so: Set PapersPlaced to 0 If ( Paper1.Placed > 0 ) Set PapersPlaced to ( PapersPlaced + 1 ) EndIf If ( Paper2.Placed > 0 ) Set PapersPlaced to ( PapersPlaced + 1 ) EndIf If ( Paper3.Placed > 0 ) Set PapersPlaced to ( PapersPlaced + 1 ) EndIf Link to comment Share on other sites More sharing options...
Ziphelon Posted September 20, 2004 Author Share Posted September 20, 2004 Sorry. I suppose I'm not very good at explaining. It works very well except for I haven't worked out the problem of detecting when the papers have been taken away. Would you mind if I sent you this plugin in a pm? You can't make the paper's reference persist because since the player is moving it about anything using GetDistance on it won't know that it's even moved. GetDistance measures the distance between the centers of objects, and is thus somewhat useless in measuring distances between surfaces.It does work. AFAIKWhat means this? EDIT: Oh, I was wrong, I was using 50. Link to comment Share on other sites More sharing options...
Malchik Posted September 22, 2004 Share Posted September 22, 2004 There is a pinned thread detailing common abbreviations. AFAIK - as far as I know. Check out the thread if you encounter any others. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.