Mutator: Removing default weapons

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

zeech

New Member
Sep 29, 2004
2
0
0
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:

ModifyPlayer()
{
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.

Thanks!
 

zeech

New Member
Sep 29, 2004
2
0
0
Well, I figured it out on my own.

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);
}
 

EvilDrWong

Every line of code elevates you
Jun 16, 2001
932
0
0
40
Inside the machine
Visit site
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.
 

Parser

Hello
May 7, 2002
1,531
0
0
119
England baby!
fraghouse.beyondunreal.com
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.