noxworld-dev / opennox

OpenNox main repository.
GNU General Public License v3.0
451 stars 25 forks source link

Equip function seems to have a cap #599

Open Ephreaym opened 1 year ago

Ephreaym commented 1 year ago

Put a NPC in a room with all items and run equip. It'll only pick-up a couple of them. There seems to be a cap integrated with equip?

Ephreaym commented 7 months ago

https://youtu.be/t3gzW2hhCUw

func findLootRedBot() {
    const dist = 75
    // Melee weapons.
    armor := ns.FindAllObjects(
        ns.InCirclef{Center: RedBot, R: dist},
        ns.HasClass(object.ClassArmor),
        //ns.HasClass(object.ClassWeapon),
    )
    if armor != nil {
        //RedBot.Pickup(item[0])
        RedBot.Equip(armor[0])
    }

    weapon := ns.FindAllObjects(
        ns.InCirclef{Center: RedBot, R: dist},
        //ns.HasClass(object.ClassArmor),
        ns.HasClass(object.ClassWeapon),
    )
    if weapon != nil {
        //RedBot.Pickup(item[0])
        RedBot.Equip(weapon[0])
    }

    ns.NewTimer(ns.Frames(15), func() {
        findLootRedBot()
    })
}

test equip cap.zip

Ephreaym commented 7 months ago

Here's the video that demonstrates the weird cap. I haven't found out the conditions exactly. But there's something limiting the amount of items that can be equipped and picked up.