UT Armor 2 subclass code

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Silver_Ibex

Member
Feb 27, 2001
654
0
16
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.
 

gor

New Member
Dec 30, 2001
40
0
0
AUS
Visit site
hey I think you best wait for someone more experienced to reply but this is my guess :)

class yourwhatever extends armor2;

defaultproperties
{
bCanHaveMultipleCopies=false
}
 

Brood_of_Evil

Selene's martyr
Nov 3, 2001
147
0
0
45
Look outside your window!
Visit site
You can try this:
Code:
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;
	}
}
 

Silver_Ibex

Member
Feb 27, 2001
654
0
16
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.

Getting this error, this is the first time I have seen the FindInventoryType, so I’m not sure what needs fixed...

Line 28
if(Pawn(Other).FindInventoryType('Armor2') != None) ||

Is there a way to test for the charge left in the armor and if it is below a set level then it allows pickup?
 

RegularX

Master of Dagoth Lies
Feb 2, 2000
1,215
0
0
Chicago, IL
yeah, that's how I handle ammo and armor in Freehold. It simply checks' the Pawns current charge and handles accordingly.

Look at the code for health packs for similarities on dealing with stat "ceilings", the HUD DrawStatus code for figuring out the player's current charge/armor, add some brown sugar and let simmer for 10 minutes.



rgx
 

Raeled

Feuer Frei!
Jul 1, 2001
161
0
0
39
Dordrecht, The Netherlands
Visit site
Not tested
doesn't take into account some check with sb, like the default script does.

PHP:
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);
}
 

Silver_Ibex

Member
Feb 27, 2001
654
0
16
Both versions compiled without errors, yet they still are not working, the armor still disappears when walked over, so what’s wrong???
 

RegularX

Master of Dagoth Lies
Feb 2, 2000
1,215
0
0
Chicago, IL
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???

Note - I'm stabbing in the dark here, because I'm really just waiting for someone :)


Try and figure out exactly what's going on. Is the armor being added to the inventory? Does the Players' armor go up? Or does it just disappear?

Remember, picking items is really pretty complicated. The engine detects a "touch", passes on the corresponding event, both objects (possibly) react to it.

In other words, it's possible that the item isn't being picked up, but is disappearing. So you may have actually accomplished one task. The next would be - how do you keep it from being destroyed/respawned?


rgx


bored and overworked. Weird combo.
 

Bytekeeper

Last of the Brunnen G
Jul 15, 2001
181
0
0
Germany
Visit site
Hmm take Raeled`s code, but change the lines:

   S = Pawn(Owner).FindInventoryType(class'armor2'); 



    if (  S != None )

      if (S.Charge == S.default.Charge)

        return false;

to:

if ( Charge < Default.Charge )
return true;
 

Silver_Ibex

Member
Feb 27, 2001
654
0
16
This is what I have so far, it works as a standard armor pickup, just needs the "don’t pick up unless needed" function to work.

It still is disappearing.

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
}
 
Last edited:

Magus

New Member
Oct 7, 2001
69
0
0
Visit site
Code:
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

}

my guess
 

Silver_Ibex

Member
Feb 27, 2001
654
0
16
It shows up fine, the new item class is just an abstract container for putting all new Pickup Items inside of one dropdown for ease of use in UnrealED

“Class NewItems expands TournamentPickup abstract;”

The problem is with being able to pick it up when your armor is still at 100.

I am right now working on Laser, Light, and Night vision functions for a new weapon class, if someone can get this Armor working I’d really appreciate it.

Just post the code when it works, I think everyone could find a use for it.
 

Bytekeeper

Last of the Brunnen G
Jul 15, 2001
181
0
0
Germany
Visit site
@Magus:
I doesn`t make sense to search for armor2 in the inventory, because the object where it`s called is actually a "armor2", item.class == class wouldn`t make sense otherwise, no ?

The default 'armor2' class checks for another inventory item: the ut_shieldbelt

@Silver_Ibex:
Change that line:

if ( Charge < Default.Charge )
return true;

TO:

if ( Charge >= Default.Charge )
return false;

Sorry, my first reply for sure doesn`t make any sense, since return true was always called, but this one above should work, and remove the findinventory() stuff and the s variable therefore
 

Silver_Ibex

Member
Feb 27, 2001
654
0
16
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.
 

Lemoni

The Philosapher
Feb 17, 2001
628
0
0
members.lycos.co.uk
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.
i got this error messege with one of my experements but what is going on,anyone?