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

Items dropped from NPCS


Snoozey
 Share

Recommended Posts

Been using the search and it seems there already is a feature in game for this, but it is not working on my game. (tried a fresh install too)

When you kill a monster it drops an item. It seems everyone on the map can see the item instantly.

Now, that I think of it. I am testing it with my self. Is this based of IP so the same IP can see the drops?
Link to comment
Share on other sites

@Soul:

> What's the expected behavior and what's the actual behavior?`

From searching Loot stealing I found topics about items dropping
Example

Expected

Player A kills monster
Monster drops swords
Player A sees sword
Player B sees nothing

Actual

Player A kills monsters
Monster drops sword
Player A sees sword
Player B sees sword.

This allows play b to steal the item from Player A
Link to comment
Share on other sites

Looking at the code, it looks like it does. Bug fix time! Try it out and tell me if it works.

* * *

At the time of posting, I do not have access to Eclipse Origins. Please make a backup before continuing! (I'm pretty sure it will work, though.)

**Server-side**:

First find:
```
            Call SpawnItem(Npc(npcNum).DropItem, Npc(npcNum).DropItemValue, mapNum, MapNpc(mapNum).Npc(mapNpcNum).x, MapNpc(mapNum).Npc(mapNpcNum).y)

```
and change it to:
```
            Call SpawnItem(Npc(npcNum).DropItem, Npc(npcNum).DropItemValue, mapNum, MapNpc(mapNum).Npc(mapNpcNum).x, MapNpc(mapNum).Npc(mapNpcNum).y, GetPlayerName(attacker))

```
Link to comment
Share on other sites

No dice sadly, but if I am not mistaken won't that new code just send a request for the player who killed it. Not reserve the item. hm, I am going to have a look at the drop item coding. It seems that is working properly. I will post what I can find, but I am very new at this.

I think this is the code I need to duplicate. I am assuming "locked" means reserved for the player. A lot of jibberish to me, not quit sure how to go about this.

```
Function CanPlayerPickupItem(ByVal index As Long, ByVal mapItemNum As Long)
Dim mapNum As Long

    mapNum = GetPlayerMap(index)

    ' no lock or locked to player?
    If MapItem(mapNum, mapItemNum).playerName = vbNullString Or MapItem(mapNum, mapItemNum).playerName = Trim$(GetPlayerName(index)) Then
        CanPlayerPickupItem = True
        Exit Function
    End If

    CanPlayerPickupItem = False
End Function
```
Link to comment
Share on other sites

Hmm, that's weird. I was almost sure that would work.

The SpawnItem function is a wrapper function for SpawnItemSlot. There's a really important line in SpawnItemSlot:
```
MapItem(mapNum, i).playerName = playerName

```
as you can see, that influences your pickup code:
```
    ' no lock or locked to player?
    If MapItem(mapNum, mapItemNum).playerName = vbNullString Or MapItem(mapNum, mapItemNum).playerName = Trim$(GetPlayerName(index)) Then
        CanPlayerPickupItem = True
        Exit Function
    End If

```
So it sets the "lock", so to speak. It certainly reserves the item. I'll test it when I get the chance, but make sure that you've compiled it and all that.
Link to comment
Share on other sites

@Soul:

> Hmm, that's weird. I was almost sure that would work.
>
> The SpawnItem function is a wrapper function for SpawnItemSlot. There's a really important line in SpawnItemSlot:
> ```
> MapItem(mapNum, i).playerName = playerName
>
> ```
> as you can see, that influences your pickup code:
> ```
>     ' no lock or locked to player?
>     If MapItem(mapNum, mapItemNum).playerName = vbNullString Or MapItem(mapNum, mapItemNum).playerName = Trim$(GetPlayerName(index)) Then
>         CanPlayerPickupItem = True
>         Exit Function
>     End If
>
> ```
> So it sets the "lock", so to speak. It certainly reserves the item. I'll test it when I get the chance, but make sure that you've compiled it and all that.

Hm, When I did full run compile it did not appear to work. Now I actually compiled it worked. I think I am loosing my mind haha. Anyways the original code appears to be working now.  Will post if it stops working. I could of swore I compiled it the first time…

Thanks for the help!
Link to comment
Share on other sites

@Soul:

> Looking at the code, it looks like it does. Bug fix time! Try it out and tell me if it works.
>
> * * *
>
> At the time of posting, I do not have access to Eclipse Origins. Please make a backup before continuing! (I'm pretty sure it will work, though.)
>
> **Server-side**:
>
> First find:
> ```
>             Call SpawnItem(Npc(npcNum).DropItem, Npc(npcNum).DropItemValue, mapNum, MapNpc(mapNum).Npc(mapNpcNum).x, MapNpc(mapNum).Npc(mapNpcNum).y)
>
> ```
> and change it to:
> ```
>             Call SpawnItem(Npc(npcNum).DropItem, Npc(npcNum).DropItemValue, mapNum, MapNpc(mapNum).Npc(mapNpcNum).x, MapNpc(mapNum).Npc(mapNpcNum).y, GetPlayerName(attacker))
>
> ```

This is working correctly for me currently. I am hoping I just derped and forgot to compile when I said it did not.
Link to comment
Share on other sites

How it is now is that he who does the killing blow gets the drop. This is very unfair to some hardcore player who nearly solos that really hard boss and some random noob who comes in at the end and hits a measly 1 which finishes off the boss, and he gets the drop. I also noticed this is how it is for resources as well. I dont know how hard it is to change it, but it would be nice if it was whoever delt most damage.
Link to comment
Share on other sites

~~Im guessing something along the lines of~~

~~If player damage to npc > NpcHealth/number of players who attacked then~~

~~Edit: Nevermind. It wouldnt work.~~

Edit2: I thought about it and the formula would work, but not as whoever does most damage. Lets say your npc has 20,000 health and 5 people are attacking it. You would need 4,000 damage dealt to get in on the drop. The formula is in this case, "Those who did their share of the work or more can get in on the drop". This formula would also work well with multiple drop systems. It would allow loot to be shared.
Link to comment
Share on other sites

Ah i see. I was talking about it in general. "he who does the killing blow gets the drop"

Edit: Not only that, but how this is the same system for the resourses. We're also talking about how to fix it. I came up with the equation above. I dont know how to implement it though.
Link to comment
Share on other sites

If you check out my threat tutorial, that adds data to the NPC that tracks the people who attacked him and how much damage they did to the NPC. From there, you can always reward the item to the person highest on the threat list if you want it to always go to the person who did most damage.
Link to comment
Share on other sites

I was planning on adding your system to my game anyways xD
Building on top of your tutorial, how could i implement the formula "player damage to npc > NpcHealth/number of players who attacked"?

I'm using a multiple drop system so i'm interested in having this "loot sharing to those who deserve it".
Link to comment
Share on other sites

This is how i would implement that formula. Please make sure you read the code.

```
Sub LootRights(ByVal MapNum As Long, MapNpcNum As Long)
Dim i As Byte, TotalThreat As Long
Dim Playah(0 To 13) As Long

For i = 0 To 13
    TotalThreat = TotalThreat + MapNpc(MapNum).Npc(MapNpcNum).threat(i)
Next i
'This counts the total threat that the mob has, in theory the total threat should be equal to the NPC's health since 1 point of damage = 1 threat
'However, if you use my taunting code, taunting sets your threat very high so that will kind of mess up this code
'Also it doesn't account for being in a party, so its a bit unfair for healers and shitty DPS

For i = 0 To 13
    Playah(i) = (MapNpc(MapNum).Npc(MapNpcNum).threat(i) / TotalThreat) * 100
Next i

'This gives us the percentage of damage Playah(i) did to the monster. You can do whatever you want from here to divide the loot

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

I imagine that the reason this was never added was because of parties. If you don't want to use Joost's threat system, you should add a party condition to the "lock", and then check if the player is in a party. If they are, then allow it so that anyone in the party can pick it up.

However, this still puts mages and healers at a disadvantage. If the tanks decide to keep all the loot, they can take it and run off. Also, what if a mage item and a warrior item, both bind on pickup, are on the ground? What dictates who should get which item?

Overall, a smarter loot system is needed. Perhaps a combination of Joost's system, as well as a loot system that automatically awards items directly to the player's inventory. For example, if a boss is killed, it will go through the "threat list". Starting at the highest threat, it rewards items based on class, or randomly/evenly if there is no class set.

You could also extend this to items on the ground. When a player wants to pick up an item, an algorithm is run deciding which item the player most likely wants. It could use class or level to determine this. (I believe Crystalshire has a system which warns you if you are picking up a BoP item that is not for your class.)

So overall, you'd probably need to modify the actual loot system itself in order to completely remove unfairness.
Link to comment
Share on other sites

I don't think my system is the best way of handling this, since when you have threat you also want to have abilities that give threat (taunts) and reduce threat (invisibility) which obv. shouldn't affect the loot chances.
Link to comment
Share on other sites

@Joost:

> I don't think my system is the best way of handling this, since when you have threat you also want to have abilities that give threat (taunts) and reduce threat (invisibility) which obv. shouldn't affect the loot chances.

I was under the impression that the code was something like 1 damage -> 1 threat, unless that is you changed it. (And if the player added more additions to this threat system, that would affect the loot system.)

But the idea behind my looting is that there's one tank, one mage, one rogue, et cetera, in each party. Therefore, if there are two warriors, the one with the higher threat (and taking most of the damage) would be the one who would get the "best" reward, and the next warrior would get the "second best" reward. Even though mages may have a low threat, they would still get the reward the same if they are the only mage.

I feel like not using the threat system would cause a lot of redundancy, you would have to store two different variables for damage. Alternatively, you could decide by an algorithm what loot the player should get (which I described above).

But I'm rambling on from the original post now.
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...