Jump to content

Script problems


andbressan

Recommended Posts

Hey guys. I'm working on a simple mod, but it's giving me a headache. In summary, I'm trying to add a perk via script but I don't know why the hell it's not working. I'm adding lines of code into the original Bethesda script.

 

 

Scriptname DA02CuirassScript extends ObjectReference  
{Script on the DA02Cuirass base object.}

Quest Property DA02 Auto
Spell Property DA02ArmorAbility Auto

Perk Property BoethiahGrace Auto
{Default = DA02BoethiahGracePerk.}

;This script assumes that the only way to get the armor is to kill the champion. If this assumption becomes incorrect, we will likely need handling and extra objectives for seperating out the killing and getting of Armor

;Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
;	
; ;	Debug.Trace(self + "OnContainerChanged()")
;	
;	if DA02.GetStageDone(20)	;Boethiah told the player to do this because he slayed his friend and killed all the cultists at the shrine - if not, stage 20 will poll to see if the player has the armor
;		if DA02.GetStageDone(30) == false && akNewContainer == Game.GetPlayer()
; ;			Debug.Trace(self + "OnContainerChanged() now in player's inventory.")
;			DA02.SetStage(30)
;		EndIf
;	EndIf
;EndEvent

Event OnEquipped(Actor akActor)

	IF akActor == Game.GetPlayer()
		IF !akActor.HasPerk(BoethiahGrace)
			IF akActor.AddPerk(BoethiahGrace)
				Debug.Notification("Boethiah's Grace added!")
			ELSE
				Debug.Notification("Unable to add Boethiah's Grace perk.")
			ENDIF
		ENDIF
	ENDIF

; 	Debug.Trace(self + "OnEquipped()")

	if DA02.GetStageDone(30)	;player's killed everyone at the bandit lair
		if DA02.GetStageDone(40) == false && akActor == Game.GetPlayer()
; 			Debug.Trace(self + "OnEquipped() by player.")
			DA02.setstage(40)
		endIf
	EndIf
	
	;akActor.AddSpell(DA02ArmorAbility) -- handled directly by enchantment on the armor
EndEvent

Event OnUnequipped(Actor akActor)

	IF akActor == Game.GetPlayer()
		IF akActor.HasPerk(BoethiahGrace)
			IF akActor.RemovePerk(BoethiahGrace)
				Debug.Notification("Boethiah's Grace removed!")
			ELSE
				Debug.Notification("Unable to remove Boethiah's Grace perk.")
			ENDIF
		ENDIF
	ENDIF

; 	Debug.Trace(self + "OnUnequipped()")

	;akActor.RemoveSpell(DA02ArmorAbility) -- handled directly by enchantment on the armor
EndEvent

The script itself works, the problem is that the variable (property) "BoethiahGrace" is always empty (null) even if I set a value (content), so, the "IF akActor.AddPerk(BoethiahGrace)" function always returns FALSE.

 

 

 

I have tried several ways to solve the problem but without success.

 

Help will be welcome.

 

Link to comment
Share on other sites

I hope you got an .esp plugin to go with that script? The one that overloads the DA02Armor form?

With that .esp enabled, launch SSEEdit. expand Skyrim.esm, Armor category, locate 00052794 (DA02Armor), see what overloads it and if your .esp does not have top priority, you need to resolve why.

 

 

XlsYdmD.jpg

 

As you can see, for me that armor is only overloaded by WACCF, and the shown section describes only two original properties on the script.

 

If your .esp has top priority, and it adds 3rd property, check the FormID it uses. I recall having this issue with one of my mods where filling property in CK would not 'take'. I had to manually set the FormID in SSEEdit.

Link to comment
Share on other sites

Another thing to consider, if you are adding a property to an existing script and then using an existing save to test. If that save already has an item loaded running that script, that instance may not update and continue to use only those properties that were previously present. This could explain why you are receiving notifications but not getting the perk applied.

 

Always test on a new game or save that has not seen the mod / quest / object in question. If necessary, use COC at the main menu to jump to the correct area. If part of a particular quest chain with specific requirements, use console commands to advance the character to the correct point. Or just use god mode and speed run through everything till at the correct testing point.

Link to comment
Share on other sites

 

Another thing to consider, if you are adding a property to an existing script and then using an existing save to test. If that save already has an item loaded running that script, that instance may not update and continue to use only those properties that were previously present. This could explain why you are receiving notifications but not getting the perk applied.

 

@IsharaMeradin You're right, I hadn't thought of that. The script is already running... :confused:

 

Is there any way via console to reset the script?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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