Jump to content

[LE] Adding spell on equip isn't working.


Recommended Posts

[solution]

There is more to a script than just the source and the binary. Apparently the CK adds some kind of input. I had to double click on the script in the armor window in the CK.

[/solution]

 

My ultimate goal is to make a suit of armor that can be infused with magic granting penalties to cast and bonus to defense and unarmed strike.

 

For starters, I figured I'd do something a little smaller -- simply add an existing spell to the player's spell list. In this case, Firebolt.

 

Quick bit of back ground: I'm proficient with BASH, Python 2 (and 3 to a lesser extent), and C. BASH lets me maintain my system without stroking out, and Python and C are for scientific computing. In general, not a lot of experience with object oriented programming. I do NOT care for Python and it shares the sentiment, but is a necessary evil.

Scriptname ChainmailPowerUp extends ObjectReference  
 
SPELL Property Firebolt  Auto 
 
Event OnEquipped(Actor akActor)
akActor.AddSpell(Firebolt)
EndEvent
 
Event OnUnEquipped(Actor akActor)
 
akActor.Removespell(Firebolt)
EndEvent
[edit]This compiles by the way.[/edit]
My understanding is that "SPELL Property Firebolt Auto" is calling the property/variable It's not casting it, since it's already been defined. "Event OnEquipped(Actor akActor)" is a conditional statement of sorts which also casts akActor as an Actor, and then sets akActor to the object doing the equipping. "akActor.AddSpell(Firebolt)" then is sort of like a bivarient function in that it takes both akActor and Firebolt as input, adding the spell Firebolt to the Actor object akActor. I don't really care much for that notation since it makes me think I'm calling the function AddSpell from the script akActor. Maybe this is a C++ thing? The rest is more of the same.
I tried Googling this issue and game up with https://forums.nexusmods.com/index.php?/topic/1012129-adding-spell-onequipped/ which was not useful at all. So my question is "What am I doing wrong?" I haven't actually seen any examples of this in action.
Edited by tomtheclone
Link to comment
Share on other sites

  On 3/25/2017 at 10:13 PM, tomtheclone said:

 

[solution]

There is more to a script than just the source and the binary. Apparently the CK adds some kind of input. I had to double click on the script in the armor window in the CK.

[/solution]

 

 

Sure there is more to it. It's called "property". Rather "filling properties". :)

 

Just by NAMING a property like a CK object doesn't assign it this particular object. You have to "fill" is wherever a script is attached in the CK.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...