Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Problem with attacking npc's


viesty
 Share

Recommended Posts

Hello everyone!
I have big problem with npc attack. I can hurt npc's with weapons (bows,swords)  BUT i can't hurt them with my fists (without any weapon). This is my whole attack sub.. Is there something wrong?
```
'######### ATTACK AND DEATH #########

'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Sub OnAttack(Index, Damage, Hit)
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Dim SkillCheck
Dim Weapon
Dim Dir
Dim RequiredWeapon
Dim Target

Weapon = GetPlayerInvItemNum(Index, GetPlayerWeaponSlot(Index))
Dir = GetPlayerDir(Index)

    If Int(Hit) = 1 Then
        If Int(Damage) > 0 Then
            If Int(GetPlayerTarget(Index)) > 0 Then
                Target = GetPlayerTarget(Index)
                Call DamagePlayer(Index, Target, Damage)
            Else
                Target = GetPlayerTargetNPC(Index)
                Call DamageNPC(Index, Target, Damage)
            End If
        End If
    End If

Select Case Int(Dir)

    Case 0 'Up
        SkillCheck = CheckSkill(GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index) - 1)
    Case 1 'Down
        SkillCheck = CheckSkill(GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index) + 1)
    Case 2 'Left
        SkillCheck = CheckSkill(GetPlayerMap(Index), GetPlayerX(Index) - 1, GetPlayerY(Index))
    Case 3 'Right
        SkillCheck = CheckSkill(GetPlayerMap(Index), GetPlayerX(Index) + 1, GetPlayerY(Index))
    Case Else
      Call PlayerMsg(Index, "BUGGER!", 4)

End Select

RequiredWeapon = GetVar("Scripts\Skill\Skill" & SkillCheck & ".ini", "General", "Item")

'end sub

If Cint(SkillCheck) > 0 Then
    If CInt(RequiredWeapon) = CInt(Weapon) Then
        Call SkillDo(Int(Index), Int(SkillCheck))
    End If
End If

End Sub
```
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...