assterixxx Posted September 20, 2012 Share Posted September 20, 2012 I want to run a script to run every time I enter a cell. Nothing big, right? Where the he** do I attach it? I mean I could do a sm node in the Change Location Event, but isn't there a simpler way then to build a quest just to run a script? Thanks Link to comment Share on other sites More sharing options...
gasti89 Posted September 20, 2012 Share Posted September 20, 2012 Depending on what you want the script to do, there are different ways to run the cell loading event. So, what do you want the script to do when you enter a cell? Link to comment Share on other sites More sharing options...
assterixxx Posted September 20, 2012 Author Share Posted September 20, 2012 (edited) Nothing big really. First off I want to kick in a DisablePlayerControls for a couple of secs, then I want to run a quest that populates dummys from aliases. Thats it. Guess I could have the dummy quest on a sm node with the DisablePlayerControls on that too, but I was looking for a more... right way of doing it - if you get what I mean. Edit: And please don't suggest some OnInit event on the floor tile where I enter. Edited September 20, 2012 by assterixxx Link to comment Share on other sites More sharing options...
Ghaunadaur Posted September 20, 2012 Share Posted September 20, 2012 The event OnCellAttach() would work in this case. It will fire every time the player enters the cell with the object the script is attached to. You could even put it on a...ehm...floor tile. :whistling: Link to comment Share on other sites More sharing options...
assterixxx Posted September 20, 2012 Author Share Posted September 20, 2012 (edited) Thanks for the reply Ghaunadaur. I wasn't really looking for what event to use, although it's a nice bonus! But isn't there a "real" place to attach that dang script? Putting it on a floor tile/room marker would make me feel so... dirty! Edited September 20, 2012 by assterixxx Link to comment Share on other sites More sharing options...
David Brasher Posted September 20, 2012 Share Posted September 20, 2012 Maybe you could put a statue of Mara in the cell to attach your script to, since you are looking for something that is not dirty like a floor tile. Link to comment Share on other sites More sharing options...
assterixxx Posted September 20, 2012 Author Share Posted September 20, 2012 ...statue of Mara... LAWL! That's just awesome. But is that really the solution you big guys use? Attach a script to a random object? I guess I have to yield, then. But it still don't feel right... Link to comment Share on other sites More sharing options...
Ghaunadaur Posted September 21, 2012 Share Posted September 21, 2012 (edited) Thanks for the reply Ghaunadaur. I wasn't really looking for what event to use, although it's a nice bonus! But isn't there a "real" place to attach that dang script? Putting it on a floor tile/room marker would make me feel so... dirty! It's not a bonus, it's the main thing to fire your script when you want it to. And what is a "real" place? For instance, I'm using OnCellAttach() and OnCellDetach() events in a script for a light switch to register/unregister for update events. So far I can tell, it works reliable. The script is attached to a light, obviously. - Edited September 21, 2012 by Ghaunadaur Link to comment Share on other sites More sharing options...
assterixxx Posted September 21, 2012 Author Share Posted September 21, 2012 I need a cold shower after hearing about that light switch... :tongue: I just spent ½ a day looking for some place to attach a script to the cell itself, not to an object in the cell. That is just what seems logical in my little world. But don't mind me, last time I did any modding was for Warcraft III... There you had a "master" place to do stuff that related to the entire map, if that makes any sense... But I appreciate the time you all took to answer my (obviously) dumb question. Link to comment Share on other sites More sharing options...
steve40 Posted September 21, 2012 Share Posted September 21, 2012 (edited) You could set up a quest alias for the player, then put a script on this alias that has an OnLocationChange() event, and check if the new location is the cell where you want to do your stuff. ScriptName My_Player_Alias_Script extends ReferenceAlias Location Property MySpecialCell auto int Property stagenumber auto Event OnLocationChange(Location akOldLoc, Location akNewLoc) If akNewLoc == MySpecialCell Game.DisablePlayerControls() GetOwningQuest.SetStage(stagenumber) Game.EnablePlayerControls() EndIf EndEvent Alternatively, you could possibly create a quest alias for an item in your special location, eg. a floor tile, then put a script on the floor tile's alias, with an OnCellAttach() event. This would save you having to "dirty" the actual object. Edited September 21, 2012 by steve40 Link to comment Share on other sites More sharing options...
Recommended Posts