IronDusk33 Posted June 30, 2015 Share Posted June 30, 2015 I'm attempting to create a mod that allows the player to research spells and spell archetypes by casting them, among other methods. However, I have not figured out how to implement a few crucial parts of my mod. Here is what I have yet to figure out:-Detect what spells the player has equipped-Detect when the player casts said spells-Detect when the player equips a new spell I have attempted to look at TaichiKid's Spell Crafting, (found here: http://www.nexusmods.com/skyrim/mods/33598/?) but I wasn't able to fully figure out how his mod detects spells. I would really appreciate someone explaining how to do this. Link to comment Share on other sites More sharing options...
leron9999 Posted July 2, 2015 Share Posted July 2, 2015 I'll help you. -Detect what spells the player has equipped This one's from the Actor script. So you have to initialize the actor first (or the player, in this case) as such: Actor Property wiseman Auto wiseman = Game.GetPlayer() Initialize your spell, too: Spell Property equippedSpell Auto Then check if the equipped item on hand is a spell: if(wiseman.GetEquippedItemType(0) == 9) ; Use GetEquippedItemType(1) for right hand; 9 pertains to the magic spell item type equippedSpell = wiseman.GetEquippedSpell(0) ;Use GetEquippedSpell(1) for right hand or GetEquippedSpell(2) for voice slot else Debug.Trace("It's not a spell!") endif equippedSpell is now the spell that you have on-hand -Detect when the player casts said spells You can use an event listener for this. Event OnSpellCast(Form akSpell) if(akSpell == equippedSpell) ; essentially means the spell you cast was the equipped spell from a while ago, so do something here endif endEvent -Detect when the player equips a new spell Again, you can use an event listener for this. Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference) if(akBaseObject as Spell) ;essentially checks whether the thing you just equipped is a spell equippedSpell = akBaseObject as Spell ;essentially sets your equipped spell as the spell that was just equipped by the player endif endEvent Hope it helps! Link to comment Share on other sites More sharing options...
IronDusk33 Posted July 3, 2015 Author Share Posted July 3, 2015 Thanks for the help! I'll give this a shot soon. Link to comment Share on other sites More sharing options...
magnomine Posted November 21, 2017 Share Posted November 21, 2017 Do you know how to make it where the equipped spell has to be a fire spell? Link to comment Share on other sites More sharing options...
Recommended Posts