Jump to content

[LE] Script Help


Kynnkaid

Recommended Posts

Heey.. I'm working on a mod for Xbox and trying to make a script for a spell that when fired at an NPC it makes them either Essential or Protected, depending on which one is desired, and gives them a spell, perk and adds an item to their inventory. I also need to make a script that reverses those changes. I've dabbled with scripts before and had a function/argument guide but that was a VERY long time ago and that PC has since died so I no longer have it. I'm hoping by asking I'll have a "light bulb" moment as usual but incase I don't, hopefully one of you pros can help me out.

 

TIA for taking the time to read this!

Link to comment
Share on other sites

Here's an example script that should get you started. Attach to a magic effect. It's a toggle, so when cast on an actor it either protects and adds the stuff or clears protection and removes the stuff.

 

Scriptname MyMagicEffectScript extends ActiveMagicEffect
Spell Property MySpell Auto
Perk Property MyPerk Auto
MiscObject Property MyItem Auto
Event OnEffectStart(Actor akTarget, Actor akCaster)
If akTarget.HasSpell(MySpell)
akTarget.RemoveSpell(MySpell)
akTarget.RemovePerk(MyPerk)
akTarget.RemoveItem(MyItem, 1)
akTarget.GetActorBase().SetProtected(False)
Debug.Notification("Target is no longer protected")
Else
akTarget.AddSpell(MySpell)
akTarget.AddPerk(MyPerk)
akTarget.AddItem(MyItem, 1)
akTarget.GetActorBase().SetProtected()
Debug.Notification("Target is protected")
Endif
EndEvent
Link to comment
Share on other sites

I really gotta stop forgetting when I post on the forums lol

Thank you soo much!! I've never been good with scripts and I tend to over think everything so I definitely wasn't gonna figure this out on my own anytime soon. I really appreciate the help!

Link to comment
Share on other sites

  • 3 weeks later...
I'm now trying to combine some mods and have a shout based options menu that allows customizing in-game. Is it possible to apply actor effects based on keywords, race or specific flags and factions? Meaning, in the menu have an option that gives an actor effect to everything with "ActorTypeNPC" or "Essential/protected"? Not sure this is possible without SPID but still hopeful I can accomplish somthing workable without it.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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