Jump to content

[Script] Simplifying Scripts


Zorkaz

Recommended Posts

I have a script that goes like this

ObjectReference1.disable()
ObjectReference2.disable()
ObjectReference3.disable()
ObjectReference4.disable()
ObjectReference5.disable()
ObjectReference6.disable()
ObjectReference7.disable()
ObjectReference8.disable()
...
ObjectReference22.disable()

 

 

is there a way to group all of them together?

Link to comment
Share on other sites

If they are your objects or you are happy to hack base game content the best way is to connect them to an EnableStateParent object and just switch the parent state in script. This does not make them persistent.

 

If the objects are not your objects to hack, or persistence is not an issue (you have not planned to clear their script property handles) then drag them into a formlist and loop;

Formlist Property ListOfObjectsToDisable Auto Const Mandatory

Function DisableTheObjects()

Int iIndex = 0 
While (iIndex < ListOfObjectsToDisable.GetSize())
   ObjectReference ThisObject = ListOfObjectsToDisable.GetAt(iIndex) as ObjectReference
   ThisObject.Disable()
   iIndex +=1
EndWhile

EndFunction

My non invasive realtime world conversion solutions do a crap-tonne of this on several thousand objects as the only real alternative to static xEdit hacks.

 

Pro Tip: It is impossible to detect if an object has an EnableStateParent in script (grrrrr) so any script that does try to switch a child object state directly will just fail. The only workaround is to seeif the object is still enabled and then move it to a hidden holding cell (double grrr).

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...