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

If above lvl 11 npc don't drop the item


willunited
 Share

Recommended Posts

[What have you tried?](http://whathaveyoutried.com)

The actual problem is quite simple, but from now on, you should be prepared to show us what you have tried that didn't work, or what you have searched for.

Here's how you get the level of a player:
```
GetPlayerLevel(index)

```
Here's how you get the level of an NPC:
```
NPC(npcNum).Level ' or npcNum's equivalent, depending on where you are.

```
Here's the part of the code that deals with handing out items (Sub PlayerAttackNpc server-side):
```
        'Drop the goods if they get it
        n = Int(Rnd * Npc(npcNum).DropChance) + 1

        If n = 1 Then
            Call SpawnItem(Npc(npcNum).DropItem, Npc(npcNum).DropItemValue, mapNum, MapNpc(mapNum).Npc(mapNpcNum).x, MapNpc(mapNum).Npc(mapNpcNum).y)
        End If

```
now replace the above with this:
```
        'Drop the goods if they get it
        n = Int(Rnd * Npc(npcNum).DropChance) + 1

        If n = 1 And GetPlayerLevel(attacker) - Npc(npcNum).Level < 11 Then
            Call SpawnItem(Npc(npcNum).DropItem, Npc(npcNum).DropItemValue, mapNum, MapNpc(mapNum).Npc(mapNpcNum).x, MapNpc(mapNum).Npc(mapNpcNum).y)
        End If

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