1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. 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.

Argh! picking up more than one armor piece?

Discussion in 'Programming' started by FireSlash, Oct 27, 2001.

  1. FireSlash

    FireSlash Whats a FireSlash?

    Joined:
    Feb 3, 2001
    Messages:
    4,300
    Likes Received:
    0
    im working on a Armor Shard, and it should be able to pickup more than one at a time... heres my code, i cant figure out where it checks if the item is already present... (just using the armor2 code)
    PHP:
    //=============================================================================
    // Armor Shard.
    //=============================================================================
    class AShard extends TournamentPickup;

    #exec MESH IMPORT MESH=AShard ANIVFILE=MODELS\AShard_a.3d DATAFILE=MODELS\AShard_d.3d X=0 Y=0 Z=0
    #exec MESH ORIGIN MESH=AShard X=0 Y=0 Z=0

    #exec MESH SEQUENCE MESH=AShard SEQ=All STARTFRAME=0 NUMFRAMES=30
    //#exec MESH SEQUENCE MESH=AShard SEQ=??? STARTFRAME=0 NUMFRAMES=30

    #exec MESHMAP NEW MESHMAP=AShard MESH=AShard
    #exec MESHMAP SCALE MESHMAP=AShard X=0.1 Y=0.1 Z=0.2

    #exec TEXTURE IMPORT NAME=JSHD1 FILE=AShardtex.pcx GROUP=Skins FLAGS=2
    #exec TEXTURE IMPORT NAME=JSHD1 FILE=AShardtex.pcx GROUP=Skins PALETTE=JSHD1
    #exec MESHMAP SETTEXTURE MESHMAP=AShard NUM=1 TEXTURE=JSHD1

    function bool HandlePickupQueryinventory Item )
    {
        
    local inventory S;

        if ( 
    item.class == class ) 
        {
            
    Pawn(Owner).FindInventoryType(class'UT_Shieldbelt');    
            if (  
    S==None )
            {
                if ( 
    Charge<Item.Charge )    
                    
    Charge Item.Charge;
            }
            else
                
    Charge Clamp(S.Default.Charge S.ChargeChargeItem.Charge );
            if (
    Level.Game.LocalLog != None)
                
    Level.Game.LocalLog.LogPickup(ItemPawn(Owner));
            if (
    Level.Game.WorldLog != None)
                
    Level.Game.WorldLog.LogPickup(ItemPawn(Owner));
            if ( 
    PickupMessageClass == None )
                
    Pawn(Owner).ClientMessage(PickupMessage'Pickup');
            else
                
    Pawn(Owner).ReceiveLocalizedMessagePickupMessageClass0NoneNoneSelf.Class );
            
    Item.PlaySound (PickupSound,,2.0);
            
    Item.SetReSpawn();
            return 
    true;                
        }
        if ( 
    Inventory == None )
            return 
    false;

        return 
    Inventory.HandlePickupQuery(Item);
    }

    function 
    inventory SpawnCopypawn Other )
    {
        
    local inventory CopyS;

        
    Copy Super.SpawnCopy(Other);
        
    Other.FindInventoryType(class'UT_Shieldbelt');    
        if ( 
    != None )
        {
            
    Copy.Charge Min(Copy.ChargeS.Default.Charge S.Charge);
            if ( 
    Copy.Charge <= )
            { 
                
    S.Charge -= 1;
                
    Copy.Charge 1;
            }
        }
        return 
    Copy;
    }

    defaultproperties
    {
         
    bDisplayableInv=True
         PickupMessage
    ="You got an Armor Shard."
         
    ItemName="Armor Shard"
         
    RespawnTime=20.000000
         Charge
    =5
         PickupViewMesh
    =AShard
         ArmorAbsorption
    =5
         bIsAnArmor
    =True
         AbsorptionPriority
    =7
         MaxDesireability
    =1.000000
         PickupSound
    =Sound'botpack.Pickups.ArmorUT'
         
    Mesh=AShard
         AmbientGlow
    =64
         CollisionHeight
    =11.000000
    }
     
  2. Magus

    Magus New Member

    Joined:
    Oct 7, 2001
    Messages:
    69
    Likes Received:
    0
    Well I dont have much to do at the moment so i think i might as well be of some use. The function that is called when you pickup an item to check to see if you have it and could pick another up or not is HandlePickupQuery(....).

    Here is basicly what HandlePickupQuery should be to pickup multiply copies, (note this should work)

    function bool HandlePickupQuery( inventory Item )
    {
    local inventory S;

    if ( item.class == class )
    {
    S = Pawn(Owner).FindInventoryType(class'UT_Shieldbelt');

    //This the section that should be modified to take advantage of multiply copies
    if ( S==None )
    {
    //if the item has less then 150 charge add the new items charge to the old charge
    if ( Charge < 150) Charge += Item.Charge;
    // this limits the charge so the player can't have over 150 armor
    if (Charge > 150) Charge = 150;
    }
    else
    {
    //If the player has a shieldbelt, give the charge to it instead since it was the item with the greatest armor compacity in ut
    Charge = Clamp(S.Default.Charge - S.Charge, Charge, Item.Charge );
    }

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


    You may want to consider have ArmorAbsorption=100, to test the armor with. Since 5 absorbs very little damage, to see if it is working right, even with that i recommend at least around 50 for this particular type of item in the long run, else the item will be of little use even if you had 150 Armor.
     
  3. FireSlash

    FireSlash Whats a FireSlash?

    Joined:
    Feb 3, 2001
    Messages:
    4,300
    Likes Received:
    0
    considering the charge is 5, seems like 10 is < 150... ;)
     
  4. Wormbo

    Wormbo Administrator Staff Member

    Joined:
    Jun 4, 2001
    Messages:
    5,910
    Likes Received:
    35
    You should keep in mind that Armor2 and ThighPads store their charge independently (max: Armor2 = 100, ThighPads = 50), so now there is a maximum of 300 points if you use all three kind of armor.
     
  5. Lemoni

    Lemoni The Philosapher

    Joined:
    Feb 17, 2001
    Messages:
    628
    Likes Received:
    0
    hears a good tip

    do u have chaos Ut?, why dont u look in the code for info:confused: :confused:
     
  6. Kangus

    Kangus Zombie on your pwn!

    Joined:
    Jan 29, 2001
    Messages:
    978
    Likes Received:
    0
    my only comment is that the dirty wrotten shieldbelt will remove all the armor no matter what.... dirty wrotten shieldbelt....
     
  7. FireSlash

    FireSlash Whats a FireSlash?

    Joined:
    Feb 3, 2001
    Messages:
    4,300
    Likes Received:
    0
    .....
    *waits for a helpful comment*
    ;)
     
  8. Papapishu

    Papapishu 我是康

    Joined:
    Jun 18, 2001
    Messages:
    2,043
    Likes Received:
    0
    base it on the healthvial code instead, but switch it from upgrading you health to upgrading you armor...
     
  9. FireSlash

    FireSlash Whats a FireSlash?

    Joined:
    Feb 3, 2001
    Messages:
    4,300
    Likes Received:
    0
    that code uses a HealingAmount=5 property, which i dont know the armor equiv.

    is there a if P.Armor property i dont know about?
     
  10. Eater1

    Eater1 Coder

    Joined:
    Oct 22, 2000
    Messages:
    176
    Likes Received:
    0
    Nope. This has nothing to do with the health vial. The health vial just adds a little to your health. You could, of course, make yours an "armor repairing" shard that will check if you have, say, body armor in your inventory (Armor2) and adds 5 to that, but if you want this to be a true armor shard, Magus's code should work.

    Eater.
     
  11. FireSlash

    FireSlash Whats a FireSlash?

    Joined:
    Feb 3, 2001
    Messages:
    4,300
    Likes Received:
    0
    hmm. whoops! i didnt realise he posted new code, i thought he was documenting the code i posted, heh. shoudent have been foruming soo late...
     
  12. FireSlash

    FireSlash Whats a FireSlash?

    Joined:
    Feb 3, 2001
    Messages:
    4,300
    Likes Received:
    0
    ok, using magus's code, it now picks up more armor, but the armor isnt used. it never goes down till i die, no matter how much damage i take.
     
  13. FireSlash

    FireSlash Whats a FireSlash?

    Joined:
    Feb 3, 2001
    Messages:
    4,300
    Likes Received:
    0
    fixed. thanks guys.
     

Share This Page