Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scriptname WorkshopCategoryFixer extends Quest
- Formlist property WorkshopMenuMain auto const
- bool locked = false
- Event OnQuestInit()
- RegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame")
- removeAllNoneValues()
- Debug.notification("none values removed")
- EndEvent
- Event Actor.OnPlayerLoadGame(Actor actorref)
- removeAllNoneValues()
- Debug.notification("none values removed")
- EndEvent
- Function removeAllNoneValues()
- ;in case the player saves and reloads the save before the first function is finished
- ;this cant be done in removeNoneValuesFromFlst, because that function calls itself recoursively
- if (!locked)
- locked = true
- removeNoneValuesFromFlst(WorkshopMenuMain)
- locked = false
- endif
- EndFunction
- Function removeNoneValuesFromFlst(Formlist flst)
- ;Create a copy of the formlist
- Formlist temp = flst
- ;Remove all forms that are added by any script
- flst.revert()
- ;Add all none forms to the flst again
- int i = 0
- while (i < temp.getSize() )
- Form f = temp.getAt(i)
- if (f)
- ;The form is not none and not yet in the flst. Add it again.
- flst.addForm(f)
- if (f as Formlist)
- ;wait a short time to reduce script lag
- ;Utility.wait(0.5)
- ;The form is a formlist itself, so do the same with it
- removeNoneValuesFromFlst(f as Formlist)
- endif
- endif
- i += 1
- endwhile
- EndFunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement