Jump to content

Script - OnHit


Recommended Posts

Posted

- So I was wanting to do a script, That When you shoot an NPC with an object it will run a menu system with a few choices,

 

So here is what I got so far:

Compiles correctly, Seems to work correctly. Menu doesn't pop up when I shoot an NPC though, I know I have to be doing something wrong.

 

 

 

 

Event OnHit(ObjectReference akTarget, ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked, string apMaterial)
    if (akAggressor == game.GetPlayer())
        Bool abMenu = True
        Int aiButton = 0
        Int iButton = MessageNameCommander.Show()
            If(iButton == 0) ; Cancel
            Return
            ElseIf(iButton == 1) ; Follow Me
            akTarget.AddKeyword(Follower)
            akTarget.AddKeyword(DontUseAmmo)
            RecruitLimit.Mod(1)
            ElseIf(iButton == 2) ; Guard Area
            akTarget.RemoveKeyword(Follower)
            akTarget.AddKeyword(DontUseAmmo)
            akTarget.AddKeyword(GuardArea)
            RecruitLimit.Mod(-1)
            ElseIf(iButton == 3) ; Stand Still
            akTarget.RemoveKeyword(Follower)
            akTarget.RemoveKeyword(GuardArea)
            akTarget.AddKeyword(StandStill)
            akTarget.AddKeyword(GuardArea)
            RecruitLimit.Mod(-1)
            ElseIf(iButton == 4) ; Send Home
            akTarget.RemoveKeyword(Follower)
            akTarget.RemoveKeyword(GuardArea)
            akTarget.RemoveKeyword(StandStill)
            akTarget.RemoveKeyword(DontUseAmmo)
            RecruitLimit.Mod(-1)
        EndIf
    EndIf
EndEvent

 

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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