Jump to content

[Mod] Rx_Mutator_GiveSniper


JeepRubi

Recommended Posts

Rx_Mutator_GiveSniper

View 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
{ 
}
 

 

 


 

Link to comment
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...