morrowind1979 Posted April 21, 2018 Share Posted April 21, 2018 Hi all I am making a custom demon transformation spell. Everything is working except one thing. I made a revert form shout that I want to be added and equipped on the player when in demon form. Here is teh script I have, but it does not add the shout nor does it equip it when I press Z to shout in demon form it just makes the little "something not right" sound. Can anyone help please? Scriptname DWShadowDemonChangeScript extends ActiveMagicEffect Quest Property CompanionsTrackingQuest auto Faction Property PlayerWerewolfFaction auto Race Property PolymorphRace auto Race Property DemonRaceAbsorb Auto GlobalVariable Property FeedCNT Auto Spell Property DemonForm auto SPELL Property Claws25 Auto SPELL Property Claws50 Auto SPELL Property Claws75 Auto SPELL Property Claws100 Auto SPELL Property Arm25 Auto SPELL Property Arm50 Auto Perk Property HeartFeedPerk Auto SPELL Property SPELLCLEAR1 Auto SPELL Property SPELLCLEAR2 Auto WEAPON Property WEAPONCLEAR1 Auto WEAPON Property WEAPONCLEAR2 Auto Shout Property SDRF Auto Event OnEffectStart(Actor Target, Actor Caster) If (Target.GetActorBase().GetRace() != PolymorphRace) (CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalRace = Target.GetRace() Game.ForceThirdPerson() Game.DisablePlayerControls(false, false, true, false, false, false, false) Target.SetRace(PolymorphRace) Game.GetPlayer().SetHeadTracking(false) Game.GetPlayer().UnequipAll() Game.GetPlayer().RemoveSpell(DemonForm) Game.GetPlayer().AddSpell(SPELLCLEAR1) Game.GetPlayer().EquipSpell(SPELLCLEAR1, 0) Game.GetPlayer().AddSpell(SPELLCLEAR2) Game.GetPlayer().EquipSpell(SPELLCLEAR2, 1) Game.GetPlayer().AddItem(WEAPONCLEAR1) Game.GetPlayer().EquipItem(WEAPONCLEAR1, 0) Game.GetPlayer().AddItem(WEAPONCLEAR2) Game.GetPlayer().EquipItem(WEAPONCLEAR2, 1) Game.SetPlayerReportCrime(false) Game.GetPlayer().SetAttackActorOnSight(true) Game.GetPlayer().AddToFaction(PlayerWerewolfFaction) Game.GetPlayer().AddPerk(HeartFeedPerk) Game.GetPlayer().AddShout(SDRF) Game.GetPlayer().EquipShout(SDRF) If FeedCNT.GetValue() >= 49 Game.GetPlayer().AddSpell(Claws25) If FeedCNT.GetValue() >= 74 Game.GetPlayer().AddSpell(Arm25) If FeedCNT.GetValue() >= 99 Game.GetPlayer().RemoveSpell(Claws25) Game.GetPlayer().RemoveSpell(Claws75) Game.GetPlayer().RemoveSpell(Claws100) Game.GetPlayer().AddSpell(Claws50) If FeedCNT.GetValue() >= 199 Game.GetPlayer().RemoveSpell(Claws25) Game.GetPlayer().RemoveSpell(Claws50) Game.GetPlayer().RemoveSpell(Claws100) Game.GetPlayer().AddSpell(Claws75) If FeedCNT.GetValue() >= 299 Game.GetPlayer().RemoveSpell(Arm25) Game.GetPlayer().AddSpell(Arm50) If FeedCNT.GetValue() >= 499 Game.GetPlayer().RemoveSpell(Claws25) Game.GetPlayer().RemoveSpell(Claws50) Game.GetPlayer().RemoveSpell(Claws75) Game.GetPlayer().AddSpell(Claws100) If FeedCNT.GetValue() >= 999 Game.GetPlayer().SetRace(DemonRaceAbsorb) Game.GetPlayer().AddShout(SDRF) Game.GetPlayer().EquipShout(SDRF) Endif Endif EndIf EndIf EndIf EndIf EndIf EndIf EndEvent Link to comment Share on other sites More sharing options...
IsharaMeradin Posted April 21, 2018 Share Posted April 21, 2018 Obvious question first: Have you made sure that the property for that shout is filled in correctly? Have you tested the shout by adding it with the console? Could be possible that the shout itself does not work as intended. Irrelevant to your issue, but may help speed up execution. With all those calls of Game.GetPlayer() you'd be better off creating a local variable and storing the player within it. Short example: Actor PlayerRef Event OnEffectStart(Actor Target, Actor Caster) PlayerRef = Game.GetPlayer() If (Target.GetActorBase().GetRace() != PolymorphRace) PlayerRef.SetHeadTracking(false) PlayerRef.UnequipAll() EndIf EndEvent Link to comment Share on other sites More sharing options...
morrowind1979 Posted April 21, 2018 Author Share Posted April 21, 2018 Hi thanks for the reply but I finally got it working after a bit of digging (well a lot of digging and stress lol) on Google. I simply had to add the line "Game.UnlockWord(SDHW)" Link to comment Share on other sites More sharing options...
morrowind1979 Posted April 21, 2018 Author Share Posted April 21, 2018 Hi thanks for the reply but I finally got it working after a bit of digging (well a lot of digging and stress lol) on Google. I simply had to add the line "Game.UnlockWord(SDHW)" Link to comment Share on other sites More sharing options...
ReDragon2013 Posted April 21, 2018 Share Posted April 21, 2018 (edited) You got it working. Nevertheless the next could be useful to make your script more comfortable. DWShadowDemonChangeScript Scriptname DWShadowDemonChangeScript extends ActiveMagicEffect {rewritten by ReDragon 2018} ; https://forums.nexusmods.com/index.php?/topic/6579341-custom-form-script-shout-wont-add-or-equip/ ; morrowind1979 wrote: "Everything is working except one thing. Can anyone help please?" Quest PROPERTY CompanionsTrackingQuest auto GlobalVariable PROPERTY FeedCNT auto Faction PROPERTY PlayerWerewolfFaction auto Race PROPERTY PolymorphRace auto Race PROPERTY DemonRaceAbsorb auto Perk PROPERTY HeartFeedPerk auto Shout PROPERTY SDRF auto Spell PROPERTY Claws25 auto Spell PROPERTY Claws50 auto Spell PROPERTY Claws75 auto Spell PROPERTY Claws100 auto Spell PROPERTY Arm25 auto Spell PROPERTY Arm50 auto Spell PROPERTY DemonForm auto Spell PROPERTY SPELLCLEAR1 auto Spell PROPERTY SPELLCLEAR2 auto Weapon PROPERTY WEAPONCLEAR1 auto Weapon PROPERTY WEAPONCLEAR2 auto ; -- EVENTs -- EVENT OnEffectStart(Actor akTarget, Actor akCaster) IF (akTarget == Game.GetPlayer()) ELSE self.Dispel() RETURN ; - STOP - target is not the player ENDIF ;--------------------- IF myF_IsTransform(akTarget) ELSE RETURN ; - STOP - player is already a werewolf ENDIF ;--------------------- myF_Update(akTarget) ; https://www.creationkit.com/index.php?title=EnablePlayerControls_-_Game Game.EnablePlayerControls(False, False, TRUE, False, False, False, False) ; * missing !!! ENDEVENT EVENT OnEffectFinish(Actor akTarget, Actor akCaster) ENDEVENT ; -- FUNCTIONs -- 2 ;-------------------------------------------- Bool FUNCTION myF_IsTransform(Actor akTarget) ;-------------------------------------------- race r = akTarget.GetRace() IF (r == PolymorphRace) || (r == DemonRaceAbsorb) Return False ; /1 ENDIF ;--------- Game.DisablePlayerControls(False, False, TRUE, False, False, False, False) ; * Disable the ability to switch point of view. akTarget.SetRace(PolymorphRace) ; set new race (CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalRace = r ; update this external property Game.ForceThirdPerson() ; just in case third person view akTarget.SetHeadTracking(False) akTarget.UnequipAll() akTarget.RemoveSpell(DemonForm) ; "AddSpell(DemonForm)" Where does it come from? !!! akTarget.AddSpell(SPELLCLEAR1) akTarget.AddSpell(SPELLCLEAR2) akTarget.EquipSpell(SPELLCLEAR1, 0) ; spell in Left hand akTarget.EquipSpell(SPELLCLEAR2, 1) ; spell in Right hand ;;; akTaget.AddShout(SDRF) ;;; akTarget.EquipShout(SDRF) akTarget.AddItem(WEAPONCLEAR1 as Form) akTarget.AddItem(WEAPONCLEAR2 as Form) akTarget.EquipItem(WEAPONCLEAR1 as Form, 0) ; weapon in Left hand once again !? akTarget.EquipItem(WEAPONCLEAR2 as Form, 1) ; weapon in Right hand once again !? Game.SetPlayerReportCrime(False) akTarget.SetAttackActorOnSight(TRUE) akTarget.AddToFaction(PlayerWerewolfFaction) akTarget.AddPerk(HeartFeedPerk) ; add special perk Return TRUE ; /2 ENDFUNCTION ;---------------------------------- FUNCTION myF_Update(Actor akTarget) ;---------------------------------- float f = FeedCNT.GetValue() ; get the counter value only once spell sp IF (f < 49) RETURN ; - STOP - 0..48 ENDIF ;--------------------- sp = Claws25 IF (f < 74) akTarget.AddSpell(sp) ; 25 RETURN ; - STOP - 48..73 ENDIF ;--------------------- akTarget.AddSpell(Arm25) IF (f < 99) akTarget.AddSpell(sp) ; 25 RETURN ; - STOP - 74..98 ENDIF ;--------------------- sp = Claws50 IF (f < 199) akTarget.AddSpell(sp) ; 50 RETURN ; - STOP - 99..198 ENDIF ;--------------------- sp = Claws75 IF (f < 299) akTarget.AddSpell(sp) ; 75 RETURN ; - STOP - 199..298 ENDIF ;--------------------- akTarget.AddSpell(Arm50) akTarget.RemoveSpell(Arm25) IF (f < 499) akTarget.AddSpell(sp) ; 75 RETURN ; - STOP - 299..498 ENDIF ;--------------------- sp = Claws100 IF (f < 999) akTarget.AddSpell(sp) ; 100 RETURN ; - STOP - 499..998 ENDIF ;--------------------- akTarget.AddSpell(sp) ; 100 akTarget.SetRace(DemonRaceAbsorb) ; player race switch !!! akTarget.AddShout(SDRF) akTarget.EquipShout(SDRF) ;; Game.UnlockWord(SDHW) ; ??? ENDFUNCTION ;; WordOfPower PROPERTY SDHW auto ; ??? Edited April 21, 2018 by ReDragon2013 Link to comment Share on other sites More sharing options...
morrowind1979 Posted April 21, 2018 Author Share Posted April 21, 2018 Awesome script! And your probably right, but after the hassle I had getting the whole thing working from scratch and it now works 100% flawlessly, so I ain't touching it no more and risking breaking it again lol. My motto is if its not broken don't fix it Link to comment Share on other sites More sharing options...
Recommended Posts