Jump to content

EquipItem/EquipItemEx not working


irswat

Recommended Posts

trying to force Wispmother superior to equip the aetherial crown when she conjures summons to visually differentiate the wisp mother from the summons.

I add the item, and have tried EquipItem with the disallow unequip flag set to true, as well as EquipItemEx with the armor slot ID set to 42, which from what I understand is the circlet slot.

Neither function seems to equip the item even though my debug message appears saying the item is equipped.

Do I need to some way link the Armor Property to the crown baseID? After reading Cipscis tutorial it seems to suggest that name the armor property after the editor id of the item is enough.

here is my code:

 

Scriptname WispActorScript extends ActiveMagicEffect  
{Abilities and FX for Wisp/Glimmerwitch}
;======================================================================================;
; IMPORTS     /
;=============/
import utility
import form
import debug
;======================================================================================;
; PROPERTIES  /
;=============/
keyword property wispChild01 auto
keyword property wispChild02 auto
keyword property wispChild03 auto
 
spell property wispBuff01 auto
spell property wispBuff02 auto
spell property wispBuff03 auto
 
spell property Phase1ConcSpell auto
{A long range concentration spell for phase #1}
spell property Phase2ConcSpell auto
{Shorter range spell for phase #2}
 
actorBase property encWispShade auto
 
VisualEffect Property WispFXAttachEffect Auto
explosion property ExplosionIllusionLight01 auto
Activator property AshPileObject auto
{The object we use as a pile.}
 
float property PhaseThreeHPPercent auto
{At what % of HP should I spawn my dopplegangers?. DEFAULT: 0.2}
 
Armor Property DLC1LD_AetherialCrown auto
;======================================================================================;
; VARIABLES   /
;=============/
ObjectReference selfRef
 
; let's refer to the witchlights as "orbs" to avoid confusion.
objectReference orb01
objectReference orb02
objectReference orb03
 
objectReference Shade01 
objectReference Shade02
 
;track number of living orb babies
int liveLights = 3
 
; have my FX been attached?
bool bFX = FALSE
 
;counter for number of summoned wisps
int WispChildCount = 0
int ShadeCount = 0
int WispCount = 0
int SpawnFlag = 0
int RemainingWispChildren=9
int RemainingShades=3
 
bool CrownofPowerStatus=FALSE
bool IsOrb01Dead=TRUE
bool IsOrb02Dead=TRUE
bool IsOrb03Dead=TRUE
bool IsShade01Dead=TRUE
bool IsShade02Dead=TRUE
;======================================================================================;
; EVENTS     /
;=============/
EVENT onLoad()
trace("Wisp: Has Loaded 3D ("+selfRef+")")
EVPall()
endEVENT
 
EVENT OnEffectStart(Actor Target, Actor Caster)
trace("AbWisp Effect Start on: "+SelfRef+"")
selfRef = caster
 
if selfref.getLinkedRef() == NONE
; only attack FX at this point if I am not in an ambush link
WispFXAttachEffect.Play(selfRef, -1)
bFX = TRUE
endif
;how many wisps can wispmother superior spawn?
; as many as 9, up to 3 at a time
RemainingWispChildren=(9-WispChildCount)
if RemainingWispChildren>=3
orb01 = selfref.getLinkedRef(WispChild01)
orb02 = selfRef.getLinkedRef(WispChild02)
orb03 = selfRef.getLinkedRef(WispChild03)
WispCount = 3
WispChildCount+=3
elseif RemainingWispChildren == 2
orb01 = selfref.getLinkedRef(WispChild01)
orb02 = selfRef.getLinkedRef(WispChild02)
WispCount = 2
WispChildCount+=2
elseif RemainingWispChildren==1
orb01 = selfref.getLinkedRef(WispChild01)
WispCount = 1
WispChildCount+=1
endif
Debug.Notification("Wisp Child Count: " +WispChildCount)
Debug.Notification("Wisp Count: " +WispCount)
EVPall()
 
if phaseThreeHPpercent > 1.0
; if we passed a high value, the user probably meant a whole number percentage like 30%
phaseThreeHPpercent = phaseThreeHPpercent/100
endif 
endEVENT
 
EVENT onGetup(ObjectReference akFurniture)
if akFurniture == selfRef.getLinkedRef() && bFX == FALSE
; if I was in a furniture ambush, then add my FX when I leave it
WispFXAttachEffect.Play(selfRef, -1)
bFX = TRUE
endif
endEVENT
 
Event OnCombatStateChanged(Actor victim, int aeCombatState)
if aeCombatState != 0 ; 0 means not in combat, so non-zero means we entered combat
;  debug.trace("Wisp began combat with "+victim+"  ("+self+")")
if aeCombatState == 1
if WispCount==1
(orb01 as actor).startCombat(victim)
Debug.Notification("1 orb spawned")
elseif WispCount == 2
(orb01 as actor).startCombat(victim)
(orb02 as actor).startCombat(victim)
Debug.Notification("2 orbs spawned")
elseif WispCount == 3
(orb01 as actor).startCombat(victim)
(orb02 as actor).startCombat(victim)
(orb03 as actor).startCombat(victim)
Debug.Notification("3 orbs spawned")
endif
; Start listening for critically low HP
registerforSingleupdate(1.0)
endif
endif
endEVENT
 
EVENT onActivate(objectReference actronaut)
;  debug.trace("Wisp Activated")
if actronaut == orb01 || orb02 || orb03
utility.wait(0.1)
;  debug.trace("Actronaut was one of my orbs")
liveLights -= 1
;  debug.trace("Livelights = "+livelights)
if liveLights <= 0
;  debug.trace("All child lights dead for "+selfref)
;Variable07 sets up the berserk package/combat style
(selfRef as actor).setActorValue("Variable07",1)
;also "eliminate" her ability to cast spells - take all her magicka away.
trace("WISPS: move to combat phase 2")
; Take away her magicka (she'll regen) and shuffle her spell set
(selfRef as actor).damageActorValue("Magicka", -((selfref as actor).getActorValue("Magicka"))) 
(selfref as actor).removeSpell(Phase1ConcSpell)
(selfref as actor).addSpell(Phase2ConcSpell)
endif
endif
endEVENT
 
EVENT onUpdate()
; Check HP for Phase 3 Combat - Last ditch doppleganger attack!
if (selfRef as actor).getActorValuePercentage("health") >  phaseThreeHPpercent
; HP still high, so hold off.
;utility.wait(0.5)
RegisterforSingleUpdate(0.5)
else
; create my dopplegangers and unregister for update
RemainingShades=(3-ShadeCount)
if RemainingShades>=2
Shade01 = (selfref as actor).placeAtMe(EncWispShade)
Shade02 = (selfref as actor).placeAtMe(EncWispShade)
Debug.Notification("2 shades spawned")
ShadeCount+=2
elseif RemainingShades == 1
Shade01 = (selfref as actor).placeAtMe(EncWispShade)
ShadeCount+=1
Debug.Notification("1 shade spawned")
endif
;Set AV06 to 1 as a flag for being in this state (used in Frostmere Crypt)
(selfref as actor).SetAV("Variable06", 1)
 
; Dump the orbs.
(orb01 as actor).kill()
(orb02 as actor).kill()
(orb03 as actor).kill()
; restore her longer-range spell
(selfref as actor).addSpell(Phase1ConcSpell)
endif
 
 
IsOrb01Dead=(orb01 as actor).IsDead()
IsOrb02Dead=(orb02 as actor).IsDead()
IsOrb03Dead=(orb03 as actor).IsDead()
 
if (IsOrb01Dead==TRUE)
WispChildCount-=1
Debug.Notification("Wisp Child has died")
endif
if (IsOrb02Dead==TRUE)
WispChildCount-=1
Debug.Notification("Wisp Child has died")
endif
if (IsOrb03Dead==TRUE)
WispChildCount-=1
Debug.Notification("Wisp Child has died")
endif
 
IsShade01Dead=(Shade01 as actor).IsDead()
IsShade02Dead=(Shade02 as actor).IsDead()
 
 
if (IsShade01Dead==TRUE)
ShadeCount-=1
Debug.Notification("Shade has died")
endif
if (IsShade02Dead==TRUE)
ShadeCount-=1
Debug.Notification("Shade has died")
endif
 
 
CrownofPowerStatus=(selfRef as actor).IsEquipped(DLC1LD_AetherialCrown)
 
if (((WispChildCount >= 1)||(ShadeCount >= 1)) && (CrownofPowerStatus==FALSE))
(selfRef as actor).AddItem(DLC1LD_AetherialCrown, 1, TRUE)
(selfRef as actor).EquipItemEx(DLC1LD_AetherialCrown, 42, TRUE, FALSE)
CrownofPowerStatus=(selfRef as actor).IsEquipped(DLC1LD_AetherialCrown)
Debug.Notification("Diadem of the Wispmother Superior equipped")
elseif (((WispChildCount == 0)&&(ShadeCount == 0)) && (CrownofPowerStatus==TRUE))
(selfRef as actor).UnequipItem(DLC1LD_AetherialCrown, TRUE)
CrownofPowerStatus=(selfRef as actor).IsEquipped(DLC1LD_AetherialCrown)
Debug.Notification("Diadem of the Wispmother Superior unequipped")
endif
endEVENT
 
EVENT OnDying(Actor akKiller)
; Effects automatically finish onDeath so use this EVENT hook instead 
trace("Actor has died: "+selfref)
(selfRef as actor).SetCriticalStage((selfRef as actor).CritStage_DisintegrateStart)
WispFXAttachEffect.Stop(selfRef)
utility.wait(0.90)
selfRef.placeatme(ExplosionIllusionLight01)
(selfRef as actor).AttachAshPile(AshPileObject)
; pause a second before killing inheritors - I've seen massive damage skip over this
utility.wait(0.5)
(orb01 as actor).kill()
(orb02 as actor).kill()
(orb03 as actor).kill()
(Shade01 as actor).kill()
(Shade02 as actor).kill()
(selfRef as actor).SetCriticalStage((selfRef as actor).CritStage_DisintegrateEnd)
WispCount=0
ShadeCount=0
ENDEVENT
 
 
FUNCTION EVPall()
trace("Sending EVP to self and witchlight children ("+selfRef+")")
trace("Witchlights are the Following:")
trace("--------------------------------")
trace(orb01)
trace(orb02)
trace(orb03)
trace("--------------------------------")
(orb01 as actor).evaluatePackage()
(orb02 as actor).evaluatePackage()
(orb03 as actor).evaluatePackage()
endFUNCTION

 



ctrl+f="crown" for relevant code.

Edited by irswat
Link to comment
Share on other sites

I mean, it's possible not, but I would assume they could. Interesting point. are you able to answer my question about armor properties and linking them to base forms, or editor id? Is it enough to just name the property the same as the editor id?

Edited by irswat
Link to comment
Share on other sites

You can always remake the wisp mother as an NPC. I don't know exactly what modification needs to be done to convert a creature skeleton to work as an NPC skeleton so it might be impossible or at least more trouble than it's worth but it may be easier than it sounds.

Edited by dalsio
Link to comment
Share on other sites

  • Recently Browsing   0 members

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