Zer0Zer0
24th Jun 2004, 04:37 PM
Hey there all, I'm trying to replace the weapon from which this function is from with another weapon, I can't seem to get it to work, when i press my exec key the weapon just dissappears any ideas.
I've tried loads of different combinations of code.
What i'm essentially trying to do is replace the Firemodes but all attempts at doing this directly have failed. So I've decided to replace the weapon with a subclass which has a different firemode.
And yes i've read the multi ammo weapons thing on the wiki over and over.
Anyway any help at all would be great thx!
exec function UpgradeWeapon()
{
//On Keypress performs an upgrade of the weapon
//this one upgrades the secondaryfire of the rifle to
//a minigun standard fire.
local Pawn P;
local Inventory Inv;
//set the owner
P = Pawn(Owner);
//Check adrenaline allows upgrade
if (P.Controller.Adrenaline == 100) {
log("Weapon Upgradable");
// dont let them upgrade if they are firing
if (FireMode[0].bIsFiring || FireMode[1].bIsFiring)
return;
//Stops stuff firing when upgrading
if (Pawn(Owner) != none && Pawn(Owner).Controller != none)
{
Pawn(Owner).Controller.bFire = 0;
Pawn(Owner).Controller.bAltFire = 0;
}
//Find this class
Inv = P.FindInventoryType(class'MutWeaponsUpgrades.WPAssaultRifle');
if (Inv != class'MutWeaponsUpgrades.WPAssaultRifle')
{
log("Broken");
}
else
{
//Check
log("Using Minigun Fire Upgrade");
Inv = Spawn(Class'MutWeaponsUpgrades.UpgradeOne',self);
Inv.GiveTo(P);
//Destroy the weapon
self.Destroy();
}
log("Used Minigun Fire Upgrade");
}
else
{
log("Not Enough Adrenaline");
}
}
I've tried loads of different combinations of code.
What i'm essentially trying to do is replace the Firemodes but all attempts at doing this directly have failed. So I've decided to replace the weapon with a subclass which has a different firemode.
And yes i've read the multi ammo weapons thing on the wiki over and over.
Anyway any help at all would be great thx!
exec function UpgradeWeapon()
{
//On Keypress performs an upgrade of the weapon
//this one upgrades the secondaryfire of the rifle to
//a minigun standard fire.
local Pawn P;
local Inventory Inv;
//set the owner
P = Pawn(Owner);
//Check adrenaline allows upgrade
if (P.Controller.Adrenaline == 100) {
log("Weapon Upgradable");
// dont let them upgrade if they are firing
if (FireMode[0].bIsFiring || FireMode[1].bIsFiring)
return;
//Stops stuff firing when upgrading
if (Pawn(Owner) != none && Pawn(Owner).Controller != none)
{
Pawn(Owner).Controller.bFire = 0;
Pawn(Owner).Controller.bAltFire = 0;
}
//Find this class
Inv = P.FindInventoryType(class'MutWeaponsUpgrades.WPAssaultRifle');
if (Inv != class'MutWeaponsUpgrades.WPAssaultRifle')
{
log("Broken");
}
else
{
//Check
log("Using Minigun Fire Upgrade");
Inv = Spawn(Class'MutWeaponsUpgrades.UpgradeOne',self);
Inv.GiveTo(P);
//Destroy the weapon
self.Destroy();
}
log("Used Minigun Fire Upgrade");
}
else
{
log("Not Enough Adrenaline");
}
}