morrowind1979 Posted October 8, 2018 Share Posted October 8, 2018 (edited) After reading about TheSkoomaKings broken/unfinishe DeathKnight Race mod I am trying to remake it. I have created a quest and attached the following script to the Quest (it is supposed to add spells to the player as he levels up, but when i reach the desired levels in game the script does not work the message box isn't shown and the spells are not added.) Can anyone tell me what is wong? Scriptname MWDKDeathKnightLevelingScript extends Quest SPELL Property DeathCoil Auto SPELL Property DeathCharger Auto SPELL Property RuneBlade Auto SPELL Property IceChains Auto SPELL Property DeathGrip Auto SPELL Property SGargoyle Auto SPELL Property RaiseAlly Auto SPELL Property SoulReaper Auto Message Property DKLUM Auto Message Property DKLUCM Auto Keyword Property MWDKDeathKnightKeyword Auto GlobalVariable Property SDCG Auto GlobalVariable Property DCG Auto GlobalVariable Property SGG Auto GlobalVariable Property SRBG Auto GlobalVariable Property DGG Auto GlobalVariable Property ICG Auto GlobalVariable Property RAG Auto GlobalVariable Property SRPG Auto Event OnStoryIncreaseLevel (int aiNewLevel) If Game.GetPlayer().GetLevel() >= 10 && game.Getplayer().Haskeyword(MWDKDeathKnightKeyword) == 1 && DCG.GetValue() == 0 DKLUM.show() Game.GetPlayer().addspell(DeathCoil) DCG.SetValue(1) If Game.GetPlayer().GetLevel() >= 20 && game.Getplayer().Haskeyword(MWDKDeathKnightKeyword) == 1 && SDCG.GetValue() == 0 DKLUM.show() Game.GetPlayer().addspell(DeathCharger) SDCG.SetValue(1) If Game.GetPlayer().GetLevel() >= 30 && game.Getplayer().Haskeyword(MWDKDeathKnightKeyword) == 1 && SRBG.GetValue() == 0 DKLUM.show() Game.GetPlayer().addspell(RuneBlade) SRBG.SetValue(1) If Game.GetPlayer().GetLevel() >= 40 && game.Getplayer().Haskeyword(MWDKDeathKnightKeyword) == 1 && ICG.GetValue() == 0 DKLUM.show() Game.GetPlayer().addspell(IceChains) ICG.SetValue(1) If Game.GetPlayer().GetLevel() >= 50 && game.Getplayer().Haskeyword(MWDKDeathKnightKeyword) == 1 && DGG.GetValue() == 0 DKLUM.show() Game.GetPlayer().addspell(DeathGrip) DGG.SetValue(1) If Game.GetPlayer().GetLevel() >= 60 && game.Getplayer().Haskeyword(MWDKDeathKnightKeyword) == 1 && SGG.GetValue() == 0 DKLUM.show() Game.GetPlayer().addspell(SGargoyle) SGG.SetValue(1) If Game.GetPlayer().GetLevel() >= 70 && game.Getplayer().Haskeyword(MWDKDeathKnightKeyword) == 1 && RAG.GetValue() == 0 DKLUM.show() Game.GetPlayer().addspell(RaiseAlly) RAG.SetValue(1) If Game.GetPlayer().GetLevel() >= 80 && game.Getplayer().Haskeyword(MWDKDeathKnightKeyword) == 1 && SRPG.GetValue() == 0 DKLUM.show() Game.GetPlayer().addspell(SoulReaper) DKLUCM.show() SRPG.SetValue(1) Endif Endif Endif Endif Endif EndIf EndIf EndIf EndEvent Edited October 8, 2018 by morrowind1979 Link to comment Share on other sites More sharing options...
ReDragon2013 Posted October 8, 2018 Share Posted October 8, 2018 (edited) I had never used that event, nevertheless the event OnStoryIncreaseLevel() is a part of "Scriptname Quest extends Form Hidden", not of type Alias or better ReferenceAlias. So next script should work and make sure "quest is started via an increase level story manager event." You edited your posting, I noticed it too late!TestPSLQuestScript Scriptname TestPSLQuestScript extends Quest ; https://forums.nexusmods.com/index.php?/topic/7052346-script-to-add-spells-as-the-player-reaches-certain-levels/ ; morrowind1979 wrote: "the script does not work the message box isnt shown and the spells are not added.) Can anyone tell me what is wong?" Spell[] PROPERTY SpellArray auto ; fill with CK your eight spells here ;/ 0 - DeathCoil 1 - DeathCharger 2 - RuneBlade 3 - IceChains 4 - DeathGrip 5 - SGargoyle 6 - RaiseAlly 7 - SoulReaper /; GlobalVariable[] PROPERTY GlobalArray auto ; fill with CK like spells Keyword PROPERTY MWDKDeathKnightKeyword auto Message PROPERTY msgDKLUM auto Message PROPERTY msgDKLUCM auto ; -- EVENT -- EVENT OnStoryIncreaseLevel(Int aiNewLevel) ; https://www.creationkit.com/index.php?title=OnStoryIncreaseLevel_-_Quest ; "The event fires when you increase a stat and exit from the perk menu." (Bethesda) myF_Action(aiNewLevel) ENDEVENT ; -- FUNCTION -- ;---------------------------------- FUNCTION myF_Action(Int aiNewLevel) ;---------------------------------- actor player = Game.GetPlayer() ;;; int i = player.GetLevel() ; get it once and store it for comparing quickly int i = aiNewLevel IF player.Haskeyword(MWDKDeathKnightKeyword) ELSE RETURN ; - STOP - nothing to do ENDIF ;--------------------- IF (i == 10) || (i == 20) || (i == 30) || (i == 40) || (i == 50) || (i == 60) || (i == 70) || (i == 80) ELSE RETURN ; - STOP - nothing to do ENDIF ;--------------------- msgDKLUM.Show() int j = (i / 10) - 1 ; 80 -> 8 -> 7 player.Addspell( SpellArray[j] ) ; use array here ;;; Game.GetPlayer().AddSpell( SpellArray[j] ) IF (i == 80) msgDKLUCM.Show() ; show end message, if needed ENDIF ENDFUNCTION Edited October 8, 2018 by ReDragon2013 Link to comment Share on other sites More sharing options...
morrowind1979 Posted October 8, 2018 Author Share Posted October 8, 2018 (edited) Hi used your script and set the quest event to level increase. But it still does not work. Nothing happens when the player reaches level 10. I even tried levelling up, selecting my perk and exiting the menu but still nothing nada. Dont know if it is the way I am testing it. What I do is use the following console commands: coc whiterun: teleport to whiterun exteriorshowracemenu: I choose my Death Knight race with the keyword attachedplayer.setlevel 9: Sets the players level to 9player.modav health 999999: gives me enough health to take a beating so I can level up Next I attack the whiterun guards then stand and let them attack me till I level up to level 10 and nothing happens the script does not work. Edited October 8, 2018 by morrowind1979 Link to comment Share on other sites More sharing options...
Evangela Posted October 8, 2018 Share Posted October 8, 2018 The trigger quest(not the actual OnIncreaseLevel node) needs to be set to the event Increase Level, so check if that is set first. The node needs to be "stacked" and has "Shares event" checked. Further more it needs to be higher in the list than any other nodes/quests. Link to comment Share on other sites More sharing options...
morrowind1979 Posted October 8, 2018 Author Share Posted October 8, 2018 (edited) ummm so how do I do all that? Lol the only quest event I can find that can be set to level increase is the one on the Quest data tab Edited October 8, 2018 by morrowind1979 Link to comment Share on other sites More sharing options...
JonathanOstrus Posted October 8, 2018 Share Posted October 8, 2018 (edited) ummm so how do I do all that? Lol the only quest event I can find that can be set to level increase is the one on the Quest data tab Maybe this screenshot sequence will help you get where you need to go. https://imgur.com/a/NUSOyWC The only thing I did not include is putting the script you have above on the quest. I assume you know how to do that if you've gotten this far already. Edit: This should get your quest to fire and run the script. But I think you have a logic fault in the if tree. They're all nested. Which means if it doesn't run them all on the first time, then after the first run sets the matched globals, any subsequent run will fail. Also, your repeated calls to Game.GetPlayer() and GetLevel() are going to put a huge slow down burden on things. Try this Scriptname MWDKDeathKnightLevelingScript extends Quest SPELL Property DeathCoil Auto SPELL Property DeathCharger Auto SPELL Property RuneBlade Auto SPELL Property IceChains Auto SPELL Property DeathGrip Auto SPELL Property SGargoyle Auto SPELL Property RaiseAlly Auto SPELL Property SoulReaper Auto Message Property DKLUM Auto Message Property DKLUCM Auto Keyword Property MWDKDeathKnightKeyword Auto GlobalVariable Property SDCG Auto GlobalVariable Property DCG Auto GlobalVariable Property SGG Auto GlobalVariable Property SRBG Auto GlobalVariable Property DGG Auto GlobalVariable Property ICG Auto GlobalVariable Property RAG Auto GlobalVariable Property SRPG Auto Event OnStoryIncreaseLevel (int aiNewLevel) Actor PlayerREF = Game.GetPlayer() ; set a function variable once which is accessed much faster If PlayerREF.Haskeyword(MWDKDeathKnightKeyword) ; check the keyword first to short circuit all the level checks if we do not match int iLevel = PlayerREF.GetLevel() ; get the level once to speed things up and not repeatedly call out ; separate each level check entirely so as to not fail on a second or further run If iLevel >= 10 && DCG.GetValue() == 0 DKLUM.show() PlayerREF.addspell(DeathCoil) DCG.SetValue(1) Endif If iLevel >= 20 && SDCG.GetValue() == 0 DKLUM.show() PlayerREF.addspell(DeathCharger) SDCG.SetValue(1) Endif If iLevel >= 30 && SRBG.GetValue() == 0 DKLUM.show() PlayerREF.addspell(RuneBlade) SRBG.SetValue(1) Endif If iLevel >= 40 && ICG.GetValue() == 0 DKLUM.show() PlayerREF.addspell(IceChains) ICG.SetValue(1) Endif If iLevel >= 50 && DGG.GetValue() == 0 DKLUM.show() PlayerREF.addspell(DeathGrip) DGG.SetValue(1) Endif If iLevel >= 60 && SGG.GetValue() == 0 DKLUM.show() PlayerREF.addspell(SGargoyle) SGG.SetValue(1) Endif If iLevel >= 70 && RAG.GetValue() == 0 DKLUM.show() PlayerREF.addspell(RaiseAlly) RAG.SetValue(1) Endif If iLevel >= 80 && SRPG.GetValue() == 0 DKLUM.show() PlayerREF.addspell(SoulReaper) DKLUCM.show() SRPG.SetValue(1) Endif EndIf EndEvent Edited October 8, 2018 by BigAndFlabby Link to comment Share on other sites More sharing options...
morrowind1979 Posted October 8, 2018 Author Share Posted October 8, 2018 ummm so how do I do all that? Lol the only quest event I can find that can be set to level increase is the one on the Quest data tab Maybe this screenshot sequence will help you get where you need to go. https://imgur.com/a/NUSOyWC The only thing I did not include is putting the script you have above on the quest. I assume you know how to do that if you've gotten this far already. Edit: This should get your quest to fire and run the script. But I think you have a logic fault in the if tree. They're all nested. Which means if it doesn't run them all on the first time, then after the first run sets the matched globals, any subsequent run will fail. Also, your repeated calls to Game.GetPlayer() and GetLevel() are going to put a huge slow down burden on things. Try this Scriptname MWDKDeathKnightLevelingScript extends Quest SPELL Property DeathCoil Auto SPELL Property DeathCharger Auto SPELL Property RuneBlade Auto SPELL Property IceChains Auto SPELL Property DeathGrip Auto SPELL Property SGargoyle Auto SPELL Property RaiseAlly Auto SPELL Property SoulReaper Auto Message Property DKLUM Auto Message Property DKLUCM Auto Keyword Property MWDKDeathKnightKeyword Auto GlobalVariable Property SDCG Auto GlobalVariable Property DCG Auto GlobalVariable Property SGG Auto GlobalVariable Property SRBG Auto GlobalVariable Property DGG Auto GlobalVariable Property ICG Auto GlobalVariable Property RAG Auto GlobalVariable Property SRPG Auto Event OnStoryIncreaseLevel (int aiNewLevel) Actor PlayerREF = Game.GetPlayer() ; set a function variable once which is accessed much faster If PlayerREF.Haskeyword(MWDKDeathKnightKeyword) ; check the keyword first to short circuit all the level checks if we do not match int iLevel = PlayerREF.GetLevel() ; get the level once to speed things up and not repeatedly call out ; separate each level check entirely so as to not fail on a second or further run If iLevel >= 10 && DCG.GetValue() == 0 DKLUM.show() PlayerREF.addspell(DeathCoil) DCG.SetValue(1) Endif If iLevel >= 20 && SDCG.GetValue() == 0 DKLUM.show() PlayerREF.addspell(DeathCharger) SDCG.SetValue(1) Endif If iLevel >= 30 && SRBG.GetValue() == 0 DKLUM.show() PlayerREF.addspell(RuneBlade) SRBG.SetValue(1) Endif If iLevel >= 40 && ICG.GetValue() == 0 DKLUM.show() PlayerREF.addspell(IceChains) ICG.SetValue(1) Endif If iLevel >= 50 && DGG.GetValue() == 0 DKLUM.show() PlayerREF.addspell(DeathGrip) DGG.SetValue(1) Endif If iLevel >= 60 && SGG.GetValue() == 0 DKLUM.show() PlayerREF.addspell(SGargoyle) SGG.SetValue(1) Endif If iLevel >= 70 && RAG.GetValue() == 0 DKLUM.show() PlayerREF.addspell(RaiseAlly) RAG.SetValue(1) Endif If iLevel >= 80 && SRPG.GetValue() == 0 DKLUM.show() PlayerREF.addspell(SoulReaper) DKLUCM.show() SRPG.SetValue(1) Endif EndIf EndEvent Thanks! The leveling system is now working perfectly as it should! Thats the race, spells and leveling system down now I need to recreate the quests. Im gonna sit and have a long think about this part. I know how to do it but the original quests are unfinished and buggy so knowing nothing about WoW lore I'm going to have to do some research first lol. Link to comment Share on other sites More sharing options...
Recommended Posts