View Full Version : Replacing start weapons
legacy-Blaag
09-12-2003, 07:35 PM
i am workign on a little weapon mut, taht replaces the Translocator with my new weapon... however whenever i try to replace any of the weapons taht are in the starting inventory (trans, shield, assault rifle) the gun and replacement are no where to be seen...
class MutNightCrawler extends Mutator;
function bool CheckReplacement( Actor Other, out byte bSuperRelevant )
{
bSuperRelevant = 0;
if ( Other.IsA('Translauncher' && !Other.IsA('NightCrawler') )
ReplaceWith(Other,"NightCrawler.NightCrawler");
else
return true;
return false;
}
defaultproperties
{
IconMaterialName="MutatorArt.nosym"
GroupName="NightCrawler"
FriendlyName="NightCrawler"
Description="Replaces the Translocator with the Night Crawler teleporter."
}
i had to put in the "&& !Other.IsA('NightCrawler')" part, because my "nightcrawler" weapon extends "Translauncher". but i have also tried it without that part, and replacing with the flak cannon...
anyone have any idea whats going on, or how i could get aroudn the problem?
Sir_Brizz
09-13-2003, 05:12 AM
ERGGGGGG!!!!! AIIIGGGHHHHH!!!!!!!!
Ok bascially, it is a HORRIBLE idea to run a CheckReplacement on ANYTHING that is attached to a Pawn/Controller. Problems aplenty when you do.
The best way to do what you want its to either change the RequiredEquipment[0] variable to your item, or this:
function ModifyPlayer(Pawn Other)
{
for( inv=Other.Inventory;inv!=none;inv=inv.Inventory )
{
if( inv.IsA('TransLauncher') && !inv.IsA('myPackage.NightCrawler') )
Other.DeleteInventory(inv);
}
Other.CreateInventory('NightCrawler');
}
hope that helps. :)
legacy-the Adster
09-13-2003, 05:52 AM
Sir_Brizz:
How do you get rid of the shield gun? I've used the code you supplied and it kills everything but the shield gun.
Also, do you know how to start a mutator from within a game? I want to strip all the weapons of a player as they join and the ModifyPlayer( ) route uses a mutator, I don't want the mutator to show up in the mutator list as it MUST be used with the game type I'm writing.
I've tried the method that worked in UT; that is:
function PreBeginPlay( )
{
Super.PreBeginPlay( );
Spawn( class'USB.USB_InvKiller' );
}
but it doesn't work for UT 2003.
legacy-Mr Evil
09-13-2003, 06:58 AM
Originally posted by the Adster
Sir_Brizz:
How do you get rid of the shield gun? I've used the code you supplied and it kills everything but the shield gun.
Also, do you know how to start a mutator from within a game? I want to strip all the weapons of a player as they join and the ModifyPlayer( ) route uses a mutator, I don't want the mutator to show up in the mutator list as it MUST be used with the game type I'm writing.
I've tried the method that worked in UT; that is:
function PreBeginPlay( )
{
Super.PreBeginPlay( );
Spawn( class'USB.USB_InvKiller' );
}
but it doesn't work for UT 2003.
Here's an example of mutator code to replace default weapons (should be able to get rid of them by stting them to ""):
function string GetInventoryClassOverride(string InventoryClassName)
{
if(InventoryClassName == "XWeapons.AssaultRifle")
{
InventoryClassName = "WildWest_v105.Bowie";
return InventoryClassName;
}
if(InventoryClassName == "XWeapons.ShieldGun")
{
InventoryClassName = "WildWest_v105.Colt";
return InventoryClassName;
}
return Super.GetInventoryClassOverride(InventoryClassName );
}
To have a mutator always run for a particular gametype and to not show up in the mutator list, use the 'MutatorClass' GameInfo variable.
legacy-the Adster
09-13-2003, 07:24 AM
Cheers Mr Evil (not sure what saying that will do to my karma?),
I've not tried it yet as I'm burning some discs at the moment, I'll give it a try and post the results.
Sir_Brizz
09-13-2003, 05:16 PM
or just do the same thing I did replacing ('TransLauncher') with ('ShieldGun') :)
legacy-the Adster
09-13-2003, 06:38 PM
Mr Evil:
The GetInventoryClassOverride function worked, I defined the function in USB_InvKiller and simply get it to return "". The MutatorClass definition also worked for me so thanks a bunch, only 497 more 'little' issues to iron-out!
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.