Jump to content

Rx_Mutator_GiveSniper 1.0.0

   (0 reviews)

About This File

* This is an example of how to create a mutator that can be triggered with the mutate command.
* This gives the player a sniper rifle when they type "Mutate Sniper" into the commandline.


 

Version 1.0.0

Compatible with Renegade X v5.271

Mutator :

Rx_Mutator_GiveSniper.uc (Download)

Source :

Rx_Mutator_GiveSniper.u (Download)

Spoiler

/** 
 *  This is an example of how to create a mutator that can be triggered with the mutate command.
 *  This gives the player a sniper rifle when they type "Mutate Sniper" into the commandline.
 * */
class Rx_Mutator_GiveSniper extends UTMutator;

function Mutate(string MutateString, PlayerController Sender)
{
	local Rx_InventoryManager InvManager;
	local class<Rx_Weapon> WeaponClass;

	WeaponClass = class'Rx_Weapon_SniperRifle_Nod';
	InvManager = Rx_InventoryManager(Sender.Pawn.InvManager);

    if (MutateString ~= "sniper" && InvManager != none)
    {
		if (InvManager.PrimaryWeapons.Find(WeaponClass) < 0) // Make sure it isn't in there already.
			InvManager.PrimaryWeapons.AddItem(WeaponClass);

		if(InvManager.FindInventoryType(WeaponClass) != None) 
		{
			InvManager.SetCurrentWeapon(Rx_Weapon(InvManager.FindInventoryType(WeaponClass)));
		}
		else
		{
			InvManager.SetCurrentWeapon(Rx_Weapon(InvManager.CreateInventory(WeaponClass, false)));
		}

		Rx_Pawn(Owner).RefreshBackWeapons();			
    }
       
    Super.Mutate(MutateString, Sender);
}

DefaultProperties
{ 
}
 

 

 


User Feedback

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
×
×
  • Create New...