SGTbayk47 Posted July 30, 2017 Share Posted July 30, 2017 Hey all, I would like to write a script that will allow me to use the 'Update3d' function on all of the currently loaded NPCs when the player loads a save game. By currently loaded I mean all NPCs in the grid that loads around the current cell the player is in. I am planning on adding the script to my existing script, that runs once inside a 'getgamerestarted' check, so I don't need a whole script written. So, for example; scn myscript begin gamemode if getgamerestarted == 1 my script stuff new section that calls update3d on all npcs endif endMy script already does everything else I need in the 'my script stuff' part, I just need to know what to write in the 'new section' part. From what I have read I think I need to use an array, but all of the information I can find on the subject is well beyond my scripting capabilities. If somebody could help me out with this it would be greatly appreciated and you would be credited for your help. Thanks in advance, BayK Link to comment Share on other sites More sharing options...
Ladez Posted July 30, 2017 Share Posted July 30, 2017 I think this should do it: array_var aEntry foreach (aEntry <- GetRefs 200, -1) let rActor := *aEntry rActor.Update3D loop The -1 that is passed to the GetRefs function makes it search the area that is defined by the uGridsToLoad setting, so this should cover all loaded NPCs. Link to comment Share on other sites More sharing options...
SGTbayk47 Posted July 31, 2017 Author Share Posted July 31, 2017 Thanks for the help, that works perfectly! Link to comment Share on other sites More sharing options...
Recommended Posts