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

Party Randomized Share Loot!


JohnPony
 Share

Recommended Posts

in the server in modCombat in the PlayerAttackNpc procedure replace your npc item drop code with this:

```

' Check if the player is in a party!

If TempPlayer(Attacker).inParty <> 0 Then

Num = rand(1, Party(TempPlayer(Attacker).inParty).MemberCount)

'Drop the goods if they get it

For n = 1 To MAX_NPC_DROPS

If NPC(NpcNum).DropItem(n) = 0 Then Exit For

If Rnd <= NPC(NpcNum).DropChance(n) Then

Call GiveInvItem(Party(TempPlayer(Attacker).inParty).Member(Num), NPC(NpcNum).DropItem(n), NPC(NpcNum).DropItemValue(n), True)

Call PartyMsg(TempPlayer(Attacker).inParty, GetPlayerName(Party(TempPlayer(Attacker).inParty).Member(Num)) & " Won " & Trim$(Item(NPC(NpcNum).DropItem(n)).Name) & "!", Red)

End If

Next

End If

If TempPlayer(Attacker).inParty = 0 Then

'Drop the goods if they get it

For n = 1 To MAX_NPC_DROPS

If NPC(NpcNum).DropItem(n) = 0 Then Exit For

If Rnd <= NPC(NpcNum).DropChance(n) Then

Call SpawnItem(NPC(NpcNum).DropItem(n), NPC(NpcNum).DropItemValue(n), mapnum, MapNpc(mapnum).NPC(MapNpcNum).x, MapNpc(mapnum).NPC(MapNpcNum).y)

End If

Next

End If

```

You may need to change the code to match your server's drop procedure, but you should get the idea ![;)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/wink.png)
Link to comment
Share on other sites

  • 2 weeks later...
> in the server in modCombat in the PlayerAttackNpc procedure replace your npc item drop code with this:
>
> ```
>
> ' Check if the player is in a party!
>
>
>
> If TempPlayer(Attacker).inParty <> 0 Then
>
>
>
> Num = rand(1, Party(TempPlayer(Attacker).inParty).MemberCount)
>
>
>
> 'Drop the goods if they get it
>
> For n = 1 To MAX_NPC_DROPS
>
> If NPC(NpcNum).DropItem(n) = 0 Then Exit For
>
> If Rnd <= NPC(NpcNum).DropChance(n) Then
>
> Call GiveInvItem(Party(TempPlayer(Attacker).inParty).Member(Num), NPC(NpcNum).DropItem(n), NPC(NpcNum).DropItemValue(n), True)
>
> Call PartyMsg(TempPlayer(Attacker).inParty, GetPlayerName(Party(TempPlayer(Attacker).inParty).Member(Num)) & " Won " & Trim$(Item(NPC(NpcNum).DropItem(n)).Name) & "!", Red)
>
> End If
>
> Next
>
>
>
> End If
>
>
>
> If TempPlayer(Attacker).inParty = 0 Then
>
>
>
> 'Drop the goods if they get it
>
> For n = 1 To MAX_NPC_DROPS
>
> If NPC(NpcNum).DropItem(n) = 0 Then Exit For
>
> If Rnd <= NPC(NpcNum).DropChance(n) Then
>
> Call SpawnItem(NPC(NpcNum).DropItem(n), NPC(NpcNum).DropItemValue(n), mapnum, MapNpc(mapnum).NPC(MapNpcNum).x, MapNpc(mapnum).NPC(MapNpcNum).y)
>
> End If
>
> Next
>
>
>
> End If
>
> ```
>
> You may need to change the code to match your server's drop procedure, but you should get the idea ![;)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/wink.png)

Nice, big code i ever seen.
Link to comment
Share on other sites

If you are in a party, it picks a random member from your party using the line```
Num = rand(1, Party(TempPlayer(Attacker).inParty).MemberCount)
```Then when it drops the item it only gives it to that random party member it selected earlier and drops the item directly into their backpack.

So only one member gets the loot, not everyone.
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...