View Full Version : How to remove items from the inventory
legacy-3ddd
09-01-2003, 01:47 PM
Hi all,
I am working on a simple mutator that switches everyone in the game to the same random weapon every so many timer ticks. However, I don't know how to remove all the other weapons once the new one is added. Any ideas?
Thanks,
Derek
legacy-Ciced
09-01-2003, 02:28 PM
I've been using this to delete all inventory.
Level.Game.DiscardInventory(Other);
How can I selectively delete certain weapons?
legacy-CyberTao
09-01-2003, 04:38 PM
3ddd:There's already a mutator like that,loojk for "no Item UT2k3" or "NIUT2k3" or a similar name
Ciced: either use a mutator or if you know the desired class o finventory to delete :
local inventory inv;
do
{
if (inv!=none)
inv.destroy();
inv=pawn(other).FindInventoryType(desiredClass);
} until (inv==none)
Sir_Brizz
09-01-2003, 09:55 PM
that's a really bad way to do it if you already know the class. In general you should never Destroy() something that a pawn is attached to.
local Inventory inv;
for( inv=Pawn.Inventory;inv!=none;inv=inv.Inventory )
{
if( inv.IsA('ShockRifle') )
PredPawn.DeleteInventory(inv);
}
That will work a million times better.
legacy-3ddd
09-02-2003, 12:57 AM
Thanks for the help everyone! It turns out I came across the mods mentioned and another really good one called AngelWeaponSwitcherII.zip. We are going to test it out on a LAN game tomorrow. I plan on trying out the code posted above to see if I can get it to work anyway. This is a good project to learn a bit of UnrealScript. Thanks again!
I also want to add something new to it. Check it out: Certain people I play against at work tend to hog powerups which makes the game unbalanced. I want to include a "feature" where say, 1 out of 3 times, picking up a sheild takes you down to 1 health or a damage amp takes away all your weapons. I have an idea how to implement it... I'm going to give it a shot.
D
Sir_Brizz
09-03-2003, 03:41 AM
yeh don't give up even if someone else has already done it. at least you get some good experience coding if nothing else.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.