jarari Posted May 6, 2018 Share Posted May 6, 2018 (edited) Hi all, I'm currently trying to make a follower that uses custom spells. The first solution I came up with was using a "UseMagic" procedure. It worked for some spells, but it had limitations. TargetSelector data in the package could not recognize some spells as "Spells," even if I set it as "Spells: Any." I had to directly assign the object ID for the spell as a package target to make it work. That means I would have to make packages for every single spells that I want my follower to use. Not a good idea. What I'm assuming is that if the spell has other magic effects than value modifiers, then the game can't recognize it as a spell. I'm not sure if there is any way to modify the TargetSelector or package public data on run-time. The second solution was sending animation events. AFAIK, Debug.SendAnimationEvent or PlayIdle not only makes the actor play an animtion, but also makes the actor "behave" like they're actually doing that action (Like death, swing weapon, etc..) ...but no luck. Maybe I did something wrong with my code. I've been stuck on this for like two days and any help would be appreciated. Cheers. Edit: Piece of my code Function equipCustomSpell(Spell _spell, int slot) ;Get the cost of the spell, and return if she doesn't have enough Magicka int cost = spells[currentSpellIndex].GetEffectiveMagickaCost(Self) if(cost > GetAV("Magicka")) isCasting = false return endif ;Unequip any spells just in case UnequipSpell(GetEquippedSpell(0), 0) UnequipSpell(GetEquippedSpell(1), 1) ;Remove the last spell if she still has it. if(lastSpell && HasSpell(lastSpell)) RemoveSpell(lastSpell) endif ;Add the spell, then force-equip it to her AddSpell(_spell) if(slot == 0 || slot == 2) EquipSpell(_spell, 0) endif if(slot == 1 || slot == 2) EquipSpell(_spell, 1) endif lastSpell = _spell; ;Change global value to change package BingleSlaveMagicianCombatStyle.SetValue(1) EvaluatePackage() ;Wait for package evaluation Utility.Wait(1.0) ;Send animation events if(slot == 0) ;PlayIdle(CastLeftFireForget) Debug.SendAnimationEvent(Self, "MLh_SpellAimedStart") elseif(slot == 1) ;PlayIdle(CastRightFireForget) Debug.SendAnimationEvent(Self, "MRh_SpellAimedStart") elseif(slot == 2) ;PlayIdle(CastDualMagic) Debug.SendAnimationEvent(Self, "DualMagic_SpellAimedStart") endif ;Debug.Messagebox("Sending event to " + Self.GetDisplayName()) EndFunction Edited May 6, 2018 by jarari Link to comment Share on other sites More sharing options...
Recommended Posts