I want the code for a subclass of armor2, one that will not be picked up if the player still has undamaged armor on.
Can anyone help? I really need the code that can do this.
Can anyone help? I really need the code that can do this.
class YourArmor2 extends Armor2;
auto state Pickup
{
function Touch( actor Other )
{
local Inventory Copy;
if ( ValidTouch(Other) )
{
if(Other.IsA('Pawn'))
{
[color=limegreen] //Checks if any of these items are in the pawn's inventory
//if any of them are pressent, the armor will not be picked up - Brood[/color]
if(Pawn(Other).FindInventoryType('Armor2') != None ||
Pawn(Other).FindInventoryType('ThighPads') != None ||
Pawn(Other).FindInventoryType('UT_ShieldBelt') != None)
return;
}
Copy = SpawnCopy(Pawn(Other));
if (Level.Game.LocalLog != None)
Level.Game.LocalLog.LogPickup(Self, Pawn(Other));
if (Level.Game.WorldLog != None)
Level.Game.WorldLog.LogPickup(Self, Pawn(Other));
if (bActivatable && Pawn(Other).SelectedItem==None)
Pawn(Other).SelectedItem=Copy;
if (bActivatable && bAutoActivate && Pawn(Other).bAutoActivate) Copy.Activate();
if ( PickupMessageClass == None )
Pawn(Other).ClientMessage(PickupMessage, 'Pickup');
else
Pawn(Other).ReceiveLocalizedMessage( PickupMessageClass, 0, None, None, Self.Class );
PlaySound (PickupSound,,2.0);
Pickup(Copy).PickupFunction(Pawn(Other));
}
}
function BeginState()
{
Super.BeginState();
NumCopies = 0;
}
}
Log: Compiling Bvest
Error: C:\UnrealTournament\newax\Classes\Bvest.uc(28) : Error, Call to 'FindInventoryType': type mismatch in parameter 1
Critical: appError called:
Critical: Failed due to errors.
if(Pawn(Other).FindInventoryType('Armor2') != None) ||
if(Pawn(Other).FindInventoryType('Armor2') != None) ||
// should be
if(Pawn(Other).FindInventoryType(class'Armor2')!=None) ||
function bool HandlePickupQuery( inventory Item )
{
local inventory S;
if ( item.class == class )
{
S = Pawn(Owner).FindInventoryType(class'armor2');
if ( S != None )
if (S.Charge == S.default.Charge)
return false;
if (Level.Game.LocalLog != None)
Level.Game.LocalLog.LogPickup(Item, Pawn(Owner));
if (Level.Game.WorldLog != None)
Level.Game.WorldLog.LogPickup(Item, Pawn(Owner));
if ( PickupMessageClass == None )
Pawn(Owner).ClientMessage(PickupMessage, 'Pickup');
else
Pawn(Owner).ReceiveLocalizedMessage( PickupMessageClass, 0, None, None, Self.Class );
Item.PlaySound (PickupSound,,2.0);
Item.SetReSpawn();
return true;
}
if ( Inventory == None )
return false;
return Inventory.HandlePickupQuery(Item);
}
Originally posted by Silver_Ibex
Both versions compiled without errors, yet they still are not working, the armor still disappears when walked over, so what’s wrong???
class Bvest expands NewItems;
#exec MESH IMPORT MESH=Bvest ANIVFILE=MODELS\Bvest_a.3d DATAFILE=MODELS\Bvest_d.3d X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=Bvest X=0 Y=0 Z=0
#exec MESH SEQUENCE MESH=Bvest SEQ=All STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=Bvest SEQ=Still STARTFRAME=0 NUMFRAMES=1
#exec MESHMAP NEW MESHMAP=Bvest MESH=Bvest
#exec MESHMAP SCALE MESHMAP=Bvest X=0.1 Y=0.1 Z=0.2
#exec TEXTURE IMPORT NAME=BVestSkin FILE=MODELS\BVestSkin.bmp GROUP=Skins FLAGS=0
#exec MESHMAP SETTEXTURE MESHMAP=Bvest NUM=1 TEXTURE=BVestSkin
//Icon=Texture'---.Icons.---'
function bool HandlePickupQuery( inventory Item )
{
local inventory S;
if ( item.class == class )
{
S = Pawn(Owner).FindInventoryType(class'armor2');
if ( Charge < Default.Charge )
return true;
if (Level.Game.LocalLog != None)
Level.Game.LocalLog.LogPickup(Item, Pawn(Owner));
if (Level.Game.WorldLog != None)
Level.Game.WorldLog.LogPickup(Item, Pawn(Owner));
if ( PickupMessageClass == None )
Pawn(Owner).ClientMessage(PickupMessage, 'Pickup');
else
Pawn(Owner).ReceiveLocalizedMessage( PickupMessageClass, 0, None, None, Self.Class );
Item.PlaySound (PickupSound,,2.0);
Item.SetReSpawn();
return true;
}
if ( Inventory == None )
return false;
return Inventory.HandlePickupQuery(Item);
}
defaultproperties
{
bDisplayableInv=True
PickupMessage="Some Body Armor"
RespawnTime=5.000000
PickupViewMesh=LodMesh'newax.Bvest'
Charge=100
ArmorAbsorption=75
bIsAnArmor=True
AbsorptionPriority=5
MaxDesireability=1.400000
PickupSound=Sound'UnrealI.Pickups.suitsnd'
Physics=PHYS_Falling
Mesh=LodMesh'newax.Bvest'
AmbientGlow=0
bNoSmooth=True
CollisionRadius=11.000000
CollisionHeight=8.000000
Mass=10.000000
Icon=Texture'UnrealShare.Icons.I_Health'//fix this
RemoteRole=ROLE_DumbProxy
bAmbientGlow=False
bFixedRotationDir=false
RemoteRole=ROLE_DumbProxy
}
function bool HandlePickupQuery( inventory Item )
{
local inventory S;
if ( item.class == class )
{
S = Pawn(Owner).FindInventoryType(class'armor2');
if(S != None)
if ( S.Charge < S.Default.Charge )
return true;
rest of code that you had
}
i got this error messege with one of my experements but what is going on,anyone?Originally posted by Silver_Ibex
I’m going back to finish modifying the weapon code
If someone gets this to work it would be really nice, right now I just am totally burnt out on this piece of code, which should be extremely simple.
If someone gets it to work then they should post the entire script.