Jump to content

what to replace OnLoad() when loadgame?


pxd2050

Recommended Posts

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 by pxd2050
Link to comment
Share on other sites

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 by pxd2050
Link to comment
Share on other sites

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 by pxd2050
Link to comment
Share on other sites

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

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

Thank you for your reply. I don't quite understand, This is a new idea I'll try it.

Edited by pxd2050
Link to comment
Share on other sites

 

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

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

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

How 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

  • Recently Browsing   0 members

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