pxd2050 Posted December 26, 2021 Share Posted December 26, 2021 (edited) Event OnLoad() :This event is only sent when an object's 3d is loaded. This may or may not have anything to do with its parent cell and/or the player's location in the world.It do nothing when loadgame.What function can replace it more efficiently? Scriptname outfit__MainScript extends ReferenceAlias import debug import UI import utility import StorageUtil Outfit Property EmptyOutfit Auto MiscObject Property Gold001 Auto Actor Property ActorRef Auto bool IsFollower Event OnLoad() wait(0.25) Outfit_Init() EndEvent Edited December 26, 2021 by pxd2050 Link to comment Share on other sites More sharing options...
pxd2050 Posted December 26, 2021 Author Share Posted December 26, 2021 (edited) Onplayerloadgame() ? Scriptname outfit__MainScript extends ReferenceAlias import debug import UI import utility import StorageUtil Outfit Property EmptyOutfit Auto MiscObject Property Gold001 Auto Actor Property ActorRef Auto bool IsFollower Event OnPlayerLoadGame() wait(0.25) Cell targetCell = ActorRef.GetParentCell() Cell playerCell = Game.GetPlayer().GetParentCell() if (targetCell = playerCell) Outfit_Init() endif EndEvent Event OnLoad() wait(0.25) Outfit_Init() EndEvent Edited December 26, 2021 by pxd2050 Link to comment Share on other sites More sharing options...
pxd2050 Posted December 26, 2021 Author Share Posted December 26, 2021 (edited) :mellow: :mellow: :mellow: Edited December 26, 2021 by pxd2050 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 26, 2021 Share Posted December 26, 2021 OnPlayerLoadGame is the event to use when the player loads a game. However, this event can only be run on a player alias script. It will not function on any other script. Link to comment Share on other sites More sharing options...
pxd2050 Posted December 26, 2021 Author Share Posted December 26, 2021 (edited) Thank you for your reply. Is there any other way? It don't work. Scriptname outfit__PlayerScript extends ReferenceAlias Event OnPlayerLoadGame() (GetOwningQuest() as outfit__MainQuest).LoadGmae_Init() EndEvent --------------------------------- Scriptname outfit__MainQuest extends Quest Function LoadGmae_Init() Cell playerCell = Game.GetPlayer().GetParentCell() Int iElement = Targets.Length Int i = 0 While i < iElement Cell targetCell = Targets[i].GetActorRef().GetParentCell() if targetCell == playerCell (Targets[i] as outfit__MainScript).Outfit_Init() EndIf i += 1 EndWhile EndFunction --------------------------------- Scriptname outfit__MainScript extends ReferenceAlias function Outfit_Init() Form[] ItemRef = FormListToArray(ActorRef, "Equipment02") if !ItemRef ItemRef = FormListToArray(ActorRef, "Equipment01") endif int i = ItemRef.length while i > 0 i -= 1 ActorRef.EquipItem(ItemRef[i]) endwhile (GetOwningQuest() as outfit__MainQuest).HairColor_Init(ActorRef) endfunction Edited December 26, 2021 by pxd2050 Link to comment Share on other sites More sharing options...
Sphered Posted December 26, 2021 Share Posted December 26, 2021 OnLoad() has never been reliable for me unless I am extending Form. Extending Form is a can of worms if you dont know how to manage between the base and the ref so probably should avoid that route You can always use perks or abilitys that have Is3DLoaded() conditions in the CK, to then fire off a script. Add a second condition to avoid repeat procs. Just throwing that out there Link to comment Share on other sites More sharing options...
pxd2050 Posted December 26, 2021 Author Share Posted December 26, 2021 (edited) OnLoad() has never been reliable for me unless I am extending Form. Extending Form is a can of worms if you dont know how to manage between the base and the ref so probably should avoid that route You can always use perks or abilitys that have Is3DLoaded() conditions in the CK, to then fire off a script. Add a second condition to avoid repeat procs. Just throwing that out thereThank you for your reply. I don't quite understand, This is a new idea I'll try it. Edited December 26, 2021 by pxd2050 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 27, 2021 Share Posted December 27, 2021 Thank you for your reply. Is there any other way? It don't work. Scriptname outfit__PlayerScript extends ReferenceAlias Event OnPlayerLoadGame() (GetOwningQuest() as outfit__MainQuest).LoadGmae_Init() EndEvent --------------------------------- Scriptname outfit__MainQuest extends Quest Function LoadGmae_Init() Cell playerCell = Game.GetPlayer().GetParentCell() Int iElement = Targets.Length Int i = 0 While i < iElement Cell targetCell = Targets[i].GetActorRef().GetParentCell() if targetCell == playerCell (Targets[i] as outfit__MainScript).Outfit_Init() EndIf i += 1 EndWhile EndFunction --------------------------------- Scriptname outfit__MainScript extends ReferenceAlias function Outfit_Init() Form[] ItemRef = FormListToArray(ActorRef, "Equipment02") if !ItemRef ItemRef = FormListToArray(ActorRef, "Equipment01") endif int i = ItemRef.length while i > 0 i -= 1 ActorRef.EquipItem(ItemRef[i]) endwhile (GetOwningQuest() as outfit__MainQuest).HairColor_Init(ActorRef) endfunction Are you testing on a new game? On a game that has not seen the mod? On a game that the quest in question has not been started? If not, please do. Quests are notorious for not recognizing changes once they have already been started and "baked" into the save file. Link to comment Share on other sites More sharing options...
pxd2050 Posted December 27, 2021 Author Share Posted December 27, 2021 haha Thank you for your reply. Is there any other way? It don't work. Scriptname outfit__PlayerScript extends ReferenceAlias Event OnPlayerLoadGame() (GetOwningQuest() as outfit__MainQuest).LoadGmae_Init() EndEvent --------------------------------- Scriptname outfit__MainQuest extends Quest Function LoadGmae_Init() Cell playerCell = Game.GetPlayer().GetParentCell() Int iElement = Targets.Length Int i = 0 While i < iElement Cell targetCell = Targets[i].GetActorRef().GetParentCell() if targetCell == playerCell (Targets[i] as outfit__MainScript).Outfit_Init() EndIf i += 1 EndWhile EndFunction --------------------------------- Scriptname outfit__MainScript extends ReferenceAlias function Outfit_Init() Form[] ItemRef = FormListToArray(ActorRef, "Equipment02") if !ItemRef ItemRef = FormListToArray(ActorRef, "Equipment01") endif int i = ItemRef.length while i > 0 i -= 1 ActorRef.EquipItem(ItemRef[i]) endwhile (GetOwningQuest() as outfit__MainQuest).HairColor_Init(ActorRef) endfunction Are you testing on a new game? On a game that has not seen the mod? On a game that the quest in question has not been started? If not, please do. Quests are notorious for not recognizing changes once they have already been started and "baked" into the save file. haha, You're right. It's all caused by not new Gamen. But now there is a problem that OnLoad() is very unstable. I'm trying Sphered's method. Link to comment Share on other sites More sharing options...
pxd2050 Posted December 27, 2021 Author Share Posted December 27, 2021 OnLoad() has never been reliable for me unless I am extending Form. Extending Form is a can of worms if you dont know how to manage between the base and the ref so probably should avoid that route You can always use perks or abilitys that have Is3DLoaded() conditions in the CK, to then fire off a script. Add a second condition to avoid repeat procs. Just throwing that out thereHow to set this type of perk in ssedit and second condition?There are too many parameters to be clear. Link to comment Share on other sites More sharing options...
Recommended Posts