As nearly everyone knows Jack and Me are working on a weaponpack. Now nearly everything is finished expect some script bug.
Ok to solve the problem with the dual pricing of the mk23 i have to add some code to the KFPawn and to the KFBuyMenuSaleList and KFBuyMenuInvList script. Also i have to modify the veteran scripts. But I don’t know how to that without touching the source code. Can i just extent the classes and add to the functions my code? But how do i let the engine know that this code got extended? So who to make this with a mutator.
So here is a example of the KFPawn Script, the orange part should be added somehow to it: I would be very happy if some could help me
Quote:
//================================================== ===========================
// KFPawn
//================================================== ===========================
class KFPawn extends xPawn
dependsOn(xPawnGibGroup);
...
...
function ServerBuyWeapon( Class<Weapon> WClass )
{
local Inventory I, J;
local float Price;
if( !CanBuyNow() || Class<KFWeapon>(WClass)==None || Class<KFWeaponPickup>(WClass.Default.PickupClass)= =None )
{
Return;
}
Price = class<KFWeaponPickup>(WClass.Default.PickupClass). Default.Cost;
if ( KFPlayerReplicationInfo(PlayerReplicationInfo).Cli entVeteranSkill != none )
{
Price *= KFPlayerReplicationInfo(PlayerReplicationInfo).Cli entVeteranSkill.static.GetCostScaling(KFPlayerRepl icationInfo(PlayerReplicationInfo), WClass.Default.PickupClass);
}
for ( I=Inventory; I!=None; I=I.Inventory )
{
if( I.Class==WClass )
{
Return; // Already has weapon.
}
}
if ( WClass == class'DualDeagle' )
{
for ( J = Inventory; J != None; J = J.Inventory )
{
if ( J.class == class'Deagle' )
{
Price = Price / 10;
bHasDeagle = true;
break;
}
}
}
if ( !bHasDeagle && !CanCarry(Class<KFWeapon>(WClass).Default.Weight) )
{
bHasDeagle = false;
Return;
}
if ( PlayerReplicationInfo.Score < Price )
{
bHasDeagle = false;
Return; // Not enough CASH.
}
I = Spawn(WClass);
if ( I != none )
{
KFWeapon(I).UpdateMagCapacity(PlayerReplicationInf o);
KFWeapon(I).FillToInitialAmmo();
KFWeapon(I).SellValue = Price * 0.75;
I.GiveTo(self);
PlayerReplicationInfo.Score -= Price;
ClientForceChangeWeapon(I);
}
bHasDeagle = false;
SetTraderUpdate();
if( !CanBuyNow() || Class<KFWeapon>(WClass)==None || Class<KFWeaponPickup>(WClass.Default.PickupClass)= =None )
{
Return;
}
Price = class<KFWeaponPickup>(WClass.Default.PickupClass). Default.Cost;
if ( KFPlayerReplicationInfo(PlayerReplicationInfo).Cli entVeteranSkill != none )
{
Price *= KFPlayerReplicationInfo(PlayerReplicationInfo).Cli entVeteranSkill.static.GetCostScaling(KFPlayerRepl icationInfo(PlayerReplicationInfo), WClass.Default.PickupClass);
}
for ( I=Inventory; I!=None; I=I.Inventory )
{
if( I.Class==WClass )
{
Return; // Already has weapon.
}
}
if ( WClass == class'DualMK23' )
{
for ( J = Inventory; J != None; J = J.Inventory )
{
if ( J.class == class'MK23' )
{
Price = Price / 2;
bHasMK23 = true;
break;
}
}
}
if ( !bHasMK23 && !CanCarry(Class<KFWeapon>(WClass).Default.Weight) )
{
bHasMK23 = false;
Return;
}
if ( PlayerReplicationInfo.Score < Price )
{
bHasMK23 = false;
Return; // Not enough CASH.
}
I = Spawn(WClass);
if ( I != none )
{
KFWeapon(I).UpdateMagCapacity(PlayerReplicationInf o);
KFWeapon(I).FillToInitialAmmo();
KFWeapon(I).SellValue = Price * 0.75;
I.GiveTo(self);
PlayerReplicationInfo.Score -= Price;
ClientForceChangeWeapon(I);
}
bHasMK23 = false;
SetTraderUpdate();
}
function ServerSellWeapon( Class<Weapon> WClass )
{
local Inventory I;
local Single NewSingle;
local Deagle NewDeagle;
local MK23 NewMK23;
local float Price;
if ( !CanBuyNow() || Class<KFWeapon>(WClass) == none || Class<KFWeaponPickup>(WClass.Default.PickupClass) == none )
{
SetTraderUpdate();
Return;
}
for ( I = Inventory; I != none; I = I.Inventory )
{
if ( I.Class == WClass )
{
if ( KFWeapon(I) != none && KFWeapon(I).SellValue != -1 )
{
Price = KFWeapon(I).SellValue;
}
else
{
Price = int(class<KFWeaponPickup>(WClass.default.PickupCla ss).default.Cost * 0.75);
if ( KFPlayerReplicationInfo(PlayerReplicationInfo).Cli entVeteranSkill != none )
{
Price *= KFPlayerReplicationInfo(PlayerReplicationInfo).Cli entVeteranSkill.static.GetCostScaling(KFPlayerRepl icationInfo(PlayerReplicationInfo), WClass.Default.PickupClass);
}
}
if ( Dualies(I) != none && DualDeagle(I) == none )
{
NewSingle = Spawn(class'Single');
NewSingle.GiveTo(self);
}
if ( DualDeagle(I) != none )
{
NewDeagle = Spawn(class'Deagle');
NewDeagle.GiveTo(self);
Price = Price / 5;
}
if ( DualMK23(I) != none )
{
NewMK23 = Spawn(class'MK23');
NewMK23.GiveTo(self);
Price = Price / 2;
}
if ( I == Weapon || I == PendingWeapon )
{
ClientCurrentWeaponSold();
}
PlayerReplicationInfo.Score += Price;
I.Destroyed();
I.Destroy();
SetTraderUpdate();
return;
}
}
}
|