Taboen
01-02-2008, 08:00 AM
I am using this code to let people spawn with all weapons, but I want to add a shieldbelt to it. And it gives an error when doing so.
function PostBeginPlay()
{
// Perform a check if the config is there and if not, write a default config.
if (CfgCheck!="ConfigCheck_001") {
CfgCheck="ConfigCheck_001";
bUseInfiniteAmmo=false;
EnforcerAmmo=60;
BioAmmo=30;
ShockAmmo=20;
LinkAmmo=100;
StingerAmmo=75;
FlakAmmo=15;
RocketAmmo=12;
SniperAmmo=9;
bNoArrows=true;
}
SaveConfig();
Super.PostBeginPlay();
// Give everybody a default weapon if the Ammo is set higher than 0.
// DefaultInventory[DefaultInventory.Length] = class'UTGame.UTArmorPickup_Helmet'; // <= Doesnt work, type mismatch in '='
if(BioAmmo>0)
DefaultInventory[DefaultInventory.Length] = class'UTGameContent.UTWeap_BioRifle_Content';
if(ShockAmmo>0)
DefaultInventory[DefaultInventory.Length] = class'UTGame.UTWeap_ShockRifle';
if(LinkAmmo>0)
DefaultInventory[DefaultInventory.Length] = class'UTGame.UTWeap_LinkGun';
if(StingerAmmo>0)
DefaultInventory[DefaultInventory.Length] = class'UTGame.UTWeap_Stinger';
if(FlakAmmo>0)
DefaultInventory[DefaultInventory.Length] = class'UTGame.UTWeap_FlakCannon';
if(RocketAmmo>0)
DefaultInventory[DefaultInventory.Length] = class'UTGame.UTWeap_RocketLauncher';
if(SniperAmmo>0)
DefaultInventory[DefaultInventory.Length] = class'UTGame.UTWeap_SniperRifle';
}
function SetPlayerDefaults(Pawn PlayerPawn)
{
// bInfiniteAmmo is a recognized variable. If the config states bUseInfiniteAmmo=true this will trigger the bInfiniteAmmo.
if(bUseInfiniteAmmo)
{
UTInventoryManager(PlayerPawn.InvManager).bInfinit eAmmo=true;
}
// If bUseInfiniteAmmo=false than add ammo to every weapon.
else
{
UTInventoryManager(PlayerPawn.InvManager).AddAmmoT oWeapon(EnforcerAmmo-50,class'UTGame.UTWeap_Enforcer');
UTInventoryManager(PlayerPawn.InvManager).AddAmmoT oWeapon(BioAmmo-25,class'UTGameContent.UTWeap_BioRifle_Content');
UTInventoryManager(PlayerPawn.InvManager).AddAmmoT oWeapon(ShockAmmo-20,class'UTGame.UTWeap_ShockRifle');
UTInventoryManager(PlayerPawn.InvManager).AddAmmoT oWeapon(LinkAmmo-50,class'UTGame.UTWeap_Linkgun');
UTInventoryManager(PlayerPawn.InvManager).AddAmmoT oWeapon(StingerAmmo-100,class'UTGame.UTWeap_Stinger');
UTInventoryManager(PlayerPawn.InvManager).AddAmmoT oWeapon(FlakAmmo-10,class'UTGame.UTWeap_FlakCannon');
UTInventoryManager(PlayerPawn.InvManager).AddAmmoT oWeapon(RocketAmmo-9,class'UTGame.UTWeap_RocketLauncher');
UTInventoryManager(PlayerPawn.InvManager).AddAmmoT oWeapon(SniperAmmo-10,class'UTGame.UTWeap_SniperRifle');
}
Super.SetPlayerDefaults(PlayerPawn);
}
BTW this is in a gametype not a mutator.
"Type mismatch in '=' " - what to do?
Help is appreciated.
function PostBeginPlay()
{
// Perform a check if the config is there and if not, write a default config.
if (CfgCheck!="ConfigCheck_001") {
CfgCheck="ConfigCheck_001";
bUseInfiniteAmmo=false;
EnforcerAmmo=60;
BioAmmo=30;
ShockAmmo=20;
LinkAmmo=100;
StingerAmmo=75;
FlakAmmo=15;
RocketAmmo=12;
SniperAmmo=9;
bNoArrows=true;
}
SaveConfig();
Super.PostBeginPlay();
// Give everybody a default weapon if the Ammo is set higher than 0.
// DefaultInventory[DefaultInventory.Length] = class'UTGame.UTArmorPickup_Helmet'; // <= Doesnt work, type mismatch in '='
if(BioAmmo>0)
DefaultInventory[DefaultInventory.Length] = class'UTGameContent.UTWeap_BioRifle_Content';
if(ShockAmmo>0)
DefaultInventory[DefaultInventory.Length] = class'UTGame.UTWeap_ShockRifle';
if(LinkAmmo>0)
DefaultInventory[DefaultInventory.Length] = class'UTGame.UTWeap_LinkGun';
if(StingerAmmo>0)
DefaultInventory[DefaultInventory.Length] = class'UTGame.UTWeap_Stinger';
if(FlakAmmo>0)
DefaultInventory[DefaultInventory.Length] = class'UTGame.UTWeap_FlakCannon';
if(RocketAmmo>0)
DefaultInventory[DefaultInventory.Length] = class'UTGame.UTWeap_RocketLauncher';
if(SniperAmmo>0)
DefaultInventory[DefaultInventory.Length] = class'UTGame.UTWeap_SniperRifle';
}
function SetPlayerDefaults(Pawn PlayerPawn)
{
// bInfiniteAmmo is a recognized variable. If the config states bUseInfiniteAmmo=true this will trigger the bInfiniteAmmo.
if(bUseInfiniteAmmo)
{
UTInventoryManager(PlayerPawn.InvManager).bInfinit eAmmo=true;
}
// If bUseInfiniteAmmo=false than add ammo to every weapon.
else
{
UTInventoryManager(PlayerPawn.InvManager).AddAmmoT oWeapon(EnforcerAmmo-50,class'UTGame.UTWeap_Enforcer');
UTInventoryManager(PlayerPawn.InvManager).AddAmmoT oWeapon(BioAmmo-25,class'UTGameContent.UTWeap_BioRifle_Content');
UTInventoryManager(PlayerPawn.InvManager).AddAmmoT oWeapon(ShockAmmo-20,class'UTGame.UTWeap_ShockRifle');
UTInventoryManager(PlayerPawn.InvManager).AddAmmoT oWeapon(LinkAmmo-50,class'UTGame.UTWeap_Linkgun');
UTInventoryManager(PlayerPawn.InvManager).AddAmmoT oWeapon(StingerAmmo-100,class'UTGame.UTWeap_Stinger');
UTInventoryManager(PlayerPawn.InvManager).AddAmmoT oWeapon(FlakAmmo-10,class'UTGame.UTWeap_FlakCannon');
UTInventoryManager(PlayerPawn.InvManager).AddAmmoT oWeapon(RocketAmmo-9,class'UTGame.UTWeap_RocketLauncher');
UTInventoryManager(PlayerPawn.InvManager).AddAmmoT oWeapon(SniperAmmo-10,class'UTGame.UTWeap_SniperRifle');
}
Super.SetPlayerDefaults(PlayerPawn);
}
BTW this is in a gametype not a mutator.
"Type mismatch in '=' " - what to do?
Help is appreciated.