Jump to content

Get if sneaking?


kieranfoy

Recommended Posts

I'm trying to make a scripted enchantment that only works if the player is sneaking when it's used, but I can't seem to find any suitable commands. Tell me, Nexus, is there a script command (or block, or whatever) to begin a script effect only if the PC is sneaking?
Link to comment
Share on other sites

You can do it the way I added the sneak function to my creature companions so they detect if you are sneaking. You need a reference which is "ref GetSelf" in this case, which refers to the lion. If you have other conditions you'll need to adjust "if" and "endif" blocks to tell it when to start and stop.

 

scn AASherJaScript

ref rEnemy
short doOnce
ref GetSelf


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

begin OnActivate

  if IsActionRef player
     SetIgnoreFriendlyHits 1
     if doOnce == 0
        Player.addspell AASherJaSpell
     set doOnce to 1
     endif
  if (GetSelf.GetForceSneak == 0) && (player.IsSneaking == 1)
        GetSelf.SetForceSneak 1
       elseif (GetSelf.GetForceSneak == 1) && (player.IsSneaking == 0)
        GetSelf.SetForceSneak 0
     endif
     if LionFollow == 1
        set LionFollow to 0
        Message "'Sher Ja, wait for me.'"
     elseif  LionFollow == 0
        set LionFollow to 1
        Message "'Sher Ja, come with me.'"
     endif
     EvaluatePackage
     playGroup Idle 1
          else
     activate
          endif
end

 

That should get you started. :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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