View Full Version : Mutator: Removing default weapons

29th Sep 2004, 07:54 PM
Hi, I'm trying to make a mutator that removes the starting weapons from all players and bots. (thus, they have to pick up a weapon first before they can shoot anything). I'm pretty much an unrealscript newbie, although I have coded before.
On a quick search through the forums and the web I noticed many tips on how to replace your default weapons, but not much that immediately suggests how to remove them.

I've looked at the Arena mutator and have tried to modify it, and I do end up removing the weapons from the player, but for some reason I cant pick up any weapons - it does nothing when I run over them.

I've also seen code similar to something like:

pawn.giveWeapon("New Weapon Name");

Is there something simple like that, that works in reverse? It would be nicer to just remove the hammer and assault rifle from the players as they spawn, rather than what Arena seems to do - go through everything and replace it with the ArenaWeapon.


30th Sep 2004, 12:13 PM
I'm not sure how "correct" this solution is, but it works, at least :)

In my mutator file:

function string GetInventoryClassOverride(string InventoryClassName)
if (InventoryClassName ~= "xWeapons.AssaultRifle")
return ("");

if (InventoryClassName ~= "xWeapons.ShieldGun")
return ("");

return Super.GetInventoryClassOverride(InventoryClassName);

30th Sep 2004, 05:04 PM
Thats about the best way to do it, yeah. UT doesnt really like it when players have no weapons, especially the bots, but im sure thats something youve already got under control.

2nd Oct 2004, 03:20 PM
Yeah, if you look in the log file you'll probably see a load of lines saying the equivalent of "OMG BOTS HAVE NO WEAPONS YUO AER TEH SUCK."

Or something. :)

If you won't be needing the weapons at all (shieldgun and rifle, I assume), then use Checkreplacement to check if they exist, and return false. What you could also do is then give bots only a "dumb" weapon that has a priority and AIrating of 0 so they would at least have a weapon, then when they pick up another weapon, they'll go "Ooh, yay, a better weapon!".

And yeah, tis me, I have returned from the dead. Or at least those with no ability to breathe.