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

Npc attack


iHero
 Share

Recommended Posts

**Introduction**

The animation of the attack of NPC is only sent when the NPC cause damage to the player.

**Server~Side**

> modCombat

Find:

```
Sub NpcAttackPlayer(ByVal mapNpcNum As Long, ByVal victim As Long, ByVal Damage As Long)
```

In _Sub NpcAttackPlayer_ find:

```
' Send this packet so they can see the npc attacking

Set Buffer = New clsBuffer

Buffer.WriteLong ServerPackets.SNpcAttack

Buffer.WriteLong mapNpcNum

SendDataToMap MapNum, Buffer.ToArray()

Set Buffer = Nothing
```

Erase. Now in _Function CanNpcAttackPlayer_ find:

```
Dim npcNum As Long
```

Below add:

```
Dim Buffer As clsBuffer
```

Find:

```
MapNpc(MapNum).Npc(mapNpcNum).AttackTimer = GetTickCount
```

Above add:

```
' Send this packet so they can see the npc attacking

Set Buffer = New clsBuffer

Buffer.WriteLong ServerPackets.SNpcAttack

Buffer.WriteLong mapNpcNum

SendDataToMap MapNum, Buffer.ToArray()

Set Buffer = Nothing
```

In _Sub TryNpcAttackPlayer_ find:

```
If Damage > 0 Then

Call NpcAttackPlayer(mapNpcNum, index, Damage)
```

Below add:

```
Else

SendActionMsg mapNum, "Block!", Cyan, 1, (GetPlayerX(index) * 32), (GetPlayerY(index) * 32)
```

Credits

**Ricard**o
Link to comment
Share on other sites

  • 3 months later...

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...