Page 1 of 1

Inventory tossable?

Posted: Mon Oct 16, 2023 12:08 pm
by Barbie
Is there any method to decide if an inventory is tossable? (Worst case would be using a white- or blacklist.)

Re: Inventory tossable?

Posted: Tue Oct 17, 2023 7:34 am
by ExpEM
In the base Inventory class, no.
Pickup class also no.
Weapon class has bCanThrow.

What are you trying to do?

Re: Inventory tossable?

Posted: Tue Oct 17, 2023 10:03 am
by Barbie
Players should be able to toss some inventory things like Scuba or Flashlight. Also they should drop some (random) inventory items on death.

Re: Inventory tossable?

Posted: Wed Oct 18, 2023 8:53 am
by Kismet
Look at Pinata mutator. It throws all items including Flashlight.

Re: Inventory tossable?

Posted: Wed Oct 18, 2023 9:48 am
by Barbie
Kismet wrote: Wed Oct 18, 2023 8:53 am Look at Pinata mutator. It throws all items including Flashlight.
Thanks, but that mutator drops everything that is not Ammo. (For example I realized personal light as an inventory item and that should never be dropped.)

Re: Inventory tossable?

Posted: Thu Oct 19, 2023 12:58 am
by EvilGrins
True, pinata doesn't drop ammo... but every weapon it does drop has as much ammo in it that it had when it was still held.

Re: Inventory tossable?

Posted: Thu Oct 19, 2023 7:17 am
by ExpEM
Are you talking about a drop on death sort of thing or a drop with KeyBind sort of thing?
Looks like both, if you can give us a full detailed explanation of what you want then we would be better able to assist.

Re: Inventory tossable?

Posted: Thu Oct 19, 2023 5:42 pm
by Barbie
Thanks for all comments. I'll try with a blacklist:

Code: Select all

var config string	NoneTossableInventory[8]; // format: <Packagename.classname>, e.g. "Botpack.Pulsegun" (I've chosen "string", because the outer name may contain illegal name characters)

function bool InventoryIsTossable(Inventory Inv) {
local byte i;

	if (Weapon(Inv) != None)
		return Weapon(Inv).bCanThrow;

	if (Ammo(Inv) != None)
		return false;

	for (i = 0; i < ArrayCount(NoneTossableInventory); i++)
		if (NoneTossableInventory[i] != "" )
			if (NoneTossableInventory[i] ~= String(Inv.Class))
				return false;

	return true;
}
FIX: changed "(string(Inv.Class.Outer) $ "." $ String(Inv.Class))" to "String(Inv.Class)"