Akardo Posted September 2, 2018 Share Posted September 2, 2018 Just start learning about scripts and CK,I'm trying to make a mod follower to use a special spell from a magic pack mod.Because that spell is a lesser power,so I wrote a combat script for him to cast it during the battle.My question is do I have to add that spell to his spell list?Or I just need to add spell by console in game?If I have to add it to the spell list,then how to do it?I tried to open those two esps with CK and directly add the spell to actor's spell list but it won't save(Well,of course it won't..)Also,here is the script i wrote,I just start learning,so it may be lots of mistakes..so if you can point my mistakes,i'll be very,very grateful. Scriptname ActorCombatScript extends Actor SPELL Property flameSpellBW Auto Event OnCombatStateChanged(Actor akTarget, int aeCombatState) if(aeCombatState == 1) EquipSpell(flameSpellBW,2) DoCombatSpellApply(flameSpellBW, akTarget) elseif(aeCombatState == 2) Debug.Trace("We are searching for the enemy...") endIf endEvent Link to comment Share on other sites More sharing options...
Zebsi Posted September 3, 2018 Share Posted September 3, 2018 First off, the ElseIf line and the one proceeding it are unnecessary. And I may be wrong, but I'm pretty sure that the EquipSpell function is also unnecessary. Also, DoCombatSpellApply won't make him cast the spell. From what I can tell, that's used for stuff like adding diseases, like when a vampire hits you and you contract vampirism. It's late so I'm a bit out of it, but I think you could use: Scriptname ActorCombatScript extends Actor SPELL Property flameSpellBW Auto Actor Property MyActor Auto Event OnCombatStateChanged(Actor akTarget, int aeCombatState) If(aeCombatState == 1) MyActor.AddSpell(flameSpellBW) MyActor.Cast(Self, ObjectReference akTarget) EndIf EndEvent You normally wouldn't use a cast function with an NPC (as it doesn't play any casting animation), but if it's a lesser power, then I don't see the harm. Also, you should rename the script to something more unique. If you use a mod adding another ActorCombatScript, it could overwrite your current script and screw up your mod. Link to comment Share on other sites More sharing options...
Akardo Posted September 3, 2018 Author Share Posted September 3, 2018 First off, the ElseIf line and the one proceeding it are unnecessary. And I may be wrong, but I'm pretty sure that the EquipSpell function is also unnecessary. Also, DoCombatSpellApply won't make him cast the spell. From what I can tell, that's used for stuff like adding diseases, like when a vampire hits you and you contract vampirism. It's late so I'm a bit out of it, but I think you could use: Scriptname ActorCombatScript extends Actor SPELL Property flameSpellBW Auto Actor Property MyActor Auto Event OnCombatStateChanged(Actor akTarget, int aeCombatState) If(aeCombatState == 1) MyActor.AddSpell(flameSpellBW) MyActor.Cast(Self, ObjectReference akTarget) EndIf EndEvent You normally wouldn't use a cast function with an NPC (as it doesn't play any casting animation), but if it's a lesser power, then I don't see the harm. Also, you should rename the script to something more unique. If you use a mod adding another ActorCombatScript, it could overwrite your current script and screw up your mod.Thank you for your reply:)Still have some problems about the code...so is it just typing in "MyActor"or I have to replace it with my follower's id? Also,since there's an "addspell" line in the code,does that mean i won't need to add that spell to spell list? Link to comment Share on other sites More sharing options...
SeraphimKensai Posted September 3, 2018 Share Posted September 3, 2018 You could use the UseMagic script command to force an NPC to cast the spell while performing the casting animation for it. Link to comment Share on other sites More sharing options...
Akardo Posted September 3, 2018 Author Share Posted September 3, 2018 You could use the UseMagic script command to force an NPC to cast the spell while performing the casting animation for it.Thanks for the reply.By"UseMagic script",do you mean "UseMagic(Procedure)"?Just read about it from creation kit net..but it seems just order an actor to go to a certain location and cast spell to a certain target...Have no idea how it will work in combat..or may be I misunderstand? Link to comment Share on other sites More sharing options...
SeraphimKensai Posted September 3, 2018 Share Posted September 3, 2018 Yes that's the one I was thinking of. I haven't ever used it as I don't really do quests, but I remember someone telling me that function would allow NPC's to actually perform the animations to cast spells. You might have to Google a better tutorial on how to use it though. Link to comment Share on other sites More sharing options...
Akardo Posted September 5, 2018 Author Share Posted September 5, 2018 First off, the ElseIf line and the one proceeding it are unnecessary. And I may be wrong, but I'm pretty sure that the EquipSpell function is also unnecessary. Also, DoCombatSpellApply won't make him cast the spell. From what I can tell, that's used for stuff like adding diseases, like when a vampire hits you and you contract vampirism. It's late so I'm a bit out of it, but I think you could use: Scriptname ActorCombatScript extends Actor SPELL Property flameSpellBW Auto Actor Property MyActor Auto Event OnCombatStateChanged(Actor akTarget, int aeCombatState) If(aeCombatState == 1) MyActor.AddSpell(flameSpellBW) MyActor.Cast(Self, ObjectReference akTarget) EndIf EndEvent You normally wouldn't use a cast function with an NPC (as it doesn't play any casting animation), but if it's a lesser power, then I don't see the harm. Also, you should rename the script to something more unique. If you use a mod adding another ActorCombatScript, it could overwrite your current script and screw up your mod.So...I've tried the code,and it doesn't seem to work,do I have to add that spell to my actor's spell list to make the script active?If so,how to add a spell from another mod to the spell list?Lots of thanks. Link to comment Share on other sites More sharing options...
Recommended Posts