Advertisement
Guest User

Full health message

a guest
Oct 27th, 2022
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Health.
  3. //=============================================================================
  4. class Health expands Items;
  5.  
  6. //#exec MESH IMPORT MESH=health_m SKELFILE=health.ngf
  7.  
  8. // pickup sound
  9. //#exec AUDIO IMPORT  FILE="I_HealthPU01.wav" NAME="I_HealthPU01" GROUP="Inventory"
  10. //#exec AUDIO IMPORT  FILE="P_Heal_Breath01.WAV" NAME="P_Heal_Breath01" GROUP="Inventory"
  11.  
  12. var() int HealingAmount;
  13. var AeonsPlayer AP;
  14. var bool bHealthVial;
  15. var bool bHealingRoot;
  16. var vector InitialLocation;
  17. var ParticleFX pfx;
  18. var localized string MaxHealthMessage;
  19. var localized string FulllHealthMessage;
  20.  
  21. function BecomeHealthVial()
  22. {
  23.     bHealthVial = true;
  24.  
  25.     InitialLocation = Location;
  26.    
  27.     if ( Owner == none )
  28.     {
  29.         pfx = spawn(class 'HealthVialParticleFX',self,,Location);
  30.         pfx.SetBase(self);
  31.     }
  32.  
  33.     //PickupMessage = "You gained a Health Vial";
  34.     PickupViewMesh = SkelMesh'Aeons.Meshes.StalkerLure_m';
  35.     PickupViewScale = 2.2;
  36.     PickupSound = Sound'Wpn_Spl_Inv.Inventory.I_GlassPU01';
  37.     SetPhysics(PHYS_None);
  38.     Mesh = SkelMesh'Aeons.Meshes.StalkerLure_m';
  39.     ShadowImportance = 0;
  40.     DrawScale = 2.2;
  41.     bMRM = False;
  42.     bUnlit=true;
  43.     LightType = LT_Steady;
  44.     LightBrightness = 127;
  45.     LightHue = 139;
  46.     LightSaturation = 129;
  47.     LightRadius = 16;
  48. }
  49.  
  50. function BecomeHealingRoot()
  51. {
  52.      //PickupMessage = "You gained some Healing Roots";
  53.      PickupViewMesh = SkelMesh'Aeons.Meshes.HealingRoot_m';
  54.      PickupViewScale = 2;
  55.      PickupSound = Sound'Wpn_Spl_Inv.Inventory.I_HealthRootPU01';
  56.      Mesh = SkelMesh'Aeons.Meshes.HealingRoot_m';
  57.      DrawScale = 2;
  58.      //CollisionRadius=16;
  59.      //CollisionHeight=44;
  60. }
  61.  
  62. function Tick(float DeltaTime)
  63. {
  64.     local vector Loc;
  65.     local rotator r;
  66.    
  67.     if ( bHealthVial )
  68.     {
  69.         if ( GetStateName() == 'Pickup' )
  70.         {
  71.             r = rotation;
  72.             r.yaw += (4096 * deltaTime);
  73.  
  74.             SetRotation(r);
  75.         }
  76.     }
  77. }
  78.  
  79. auto state Pickup
  80. {  
  81.     function Touch( actor Other )
  82.     {
  83.         local Inventory Copy;
  84.         local AeonsPlayer AP;
  85.         local bool bContinue;
  86.         local int HealthPacks;
  87.  
  88.         if ( Other.IsA('AeonsPlayer') )
  89.         {
  90.             AP = AeonsPlayer(Other);
  91.             HealthPacks = Pickup(PlayerPawn(Other).Inventory.FindItemInGroup(101)).numCopies + 1;
  92.  
  93.             if (((Level.Game.Difficulty == 0) && ( HealthModifier(AP.HealthMod).ProjectedHealthTarget <= 65 )) || bHealthVial)
  94.             {
  95.                 // Picking up health when I really need it.
  96.                 if (HealthModifier(AP.HealthMod).ProjectedHealthTarget < 100)
  97.                 {
  98.                     HealthModifier(AP.HealthMod).HealthSurplus += healingAmount;
  99.                     if ( PickupMessageClass == None )
  100.                     {
  101.                         Pawn(Other).ClientMessage(PickupMessage, 'Pickup');
  102.                     } else
  103.                         Pawn(Other).ReceiveLocalizedMessage( PickupMessageClass, 0, None, None, Self.Class );
  104.                     PlaySound (PickupSound,,2.0);
  105.                     Destroy();
  106.                 }
  107.             } else {
  108.                 if ((Level.Game.Difficulty == 0 && HealthPacks < 15) ||
  109.                     (Level.Game.Difficulty == 1 && HealthPacks < 10) ||
  110.                     (Level.Game.Difficulty == 2 && HealthPacks < 5)) {
  111.                     bContinue = true;
  112.                 } else {
  113.                     Pawn(Other).ClientMessage(MaxHealthMessage, 'Pickup');
  114.                 }
  115.                    
  116.                 //Other.ConsoleCommand("say " $ HealthPacks);
  117.             }
  118.         }
  119.         if ( bContinue && ValidTouch(Other) )
  120.         {
  121.             // anything but the player
  122.             if (Level.Game.LocalLog != None)
  123.                 Level.Game.LocalLog.LogPickup(Self, Pawn(Other));
  124.             if (Level.Game.WorldLog != None)
  125.                 Level.Game.WorldLog.LogPickup(Self, Pawn(Other));
  126.             if (bActivatable && Pawn(Other).SelectedItem==None)
  127.                 Pawn(Other).SelectedItem=Copy;
  128.             if (bActivatable && bAutoActivate && Pawn(Other).bAutoActivate) Copy.Activate();
  129.             if ( PickupMessageClass == None )
  130.                 Pawn(Other).ClientMessage(PickupMessage, 'Pickup');
  131.             else
  132.                 Pawn(Other).ReceiveLocalizedMessage( PickupMessageClass, 0, None, None, Self.Class );
  133.  
  134.             Copy = SpawnCopy(Pawn(Other));
  135.             Pickup(Copy).PickupFunction(Pawn(Other));
  136.             AmbientSound = none;
  137.             if ( Other.IsA('AeonsPlayer') )
  138.             {
  139.                 HealthModifier(AeonsPlayer(Other).HealthMod).NumHealths ++;
  140.             }
  141.             PlaySound (PickupSound,,2.0);  
  142.         }
  143.        
  144.     }
  145.  
  146.     function Trigger( Actor Other, Pawn EventInstigator )
  147.     {
  148.         local PlayerPawn P;
  149.        
  150.         ForEach AllActors(class 'PlayerPawn', P)
  151.         {
  152.             break;
  153.         }
  154.  
  155.         if ( p!= none )
  156.             Touch(P);
  157.     }
  158.  
  159.     function BeginState()
  160.     {
  161.         Super.BeginState();
  162.         NumCopies = 0;
  163.     }
  164. }
  165.  
  166.  
  167. state Activated
  168. {
  169.     function Activate()
  170.     {
  171.         local int Diff, HealAmt, ProjectedHealth;
  172.  
  173.         if ( (Pawn(Owner) != None) )
  174.         {
  175.             AP = AeonsPlayer(Owner);
  176.             ProjectedHealth = HealthModifier(AP.HealthMod).ProjectedHealthTarget;
  177.             if ( ProjectedHealth < 100 )
  178.             {
  179.                 Diff = (200 - ProjectedHealth + 1);
  180.                
  181.                 if ( Diff > HealingAmount )
  182.                     HealAmt = HealingAmount;
  183.                 else
  184.                     HealAmt = Diff;
  185.                
  186.                 Owner.PlaySound(ActivateSound);
  187.                 HealthModifier(AP.HealthMod).HealthSurplus += HealAmt;
  188.                 numCopies --;
  189.                 //HealthModifier(AP.HealthMod).NumHealths --;
  190.             }
  191.             else
  192.             {
  193.                 Pawn(Owner).ClientMessage(FulllHealthMessage, 'Pickup');
  194.             }
  195.         }
  196.    
  197.         Super.Activate();
  198.         if ( numCopies < 0 )
  199.         {
  200.             SelectNext();
  201.             Pawn(Owner).DeleteInventory(self);
  202.         }
  203.     }
  204.  
  205.     Begin:
  206.         Activate();
  207. }
  208.  
  209. state Deactivated
  210. {
  211.  
  212.     Begin:
  213.         bActive = false;
  214. }
  215.  
  216. defaultproperties
  217. {
  218.      M_Activated=""
  219.      M_Deactivated=""
  220.      HealingAmount=35
  221.      bCanHaveMultipleCopies=True
  222.      bCanActivate=True
  223.      ItemType=ITEM_Inventory
  224.      InventoryGroup=101
  225.      bActivatable=True
  226.      bDisplayableInv=True
  227.      bAmbientGlow=False
  228.      PickupMessage="You gained a Health Pack"
  229.      MaxHealthMessage="You cannot carry any more Health"
  230.      FulllHealthMessage="Your health is already full"
  231.      ItemName="Health"
  232.      PickupViewMesh=SkelMesh'Aeons.Meshes.health_m'
  233.      PickupSound=Sound'Aeons.Inventory.I_HealthPU01'
  234.      ActivateSound=Sound'Wpn_Spl_Inv.Inventory.I_HealthUse01'
  235.      Icon=Texture'Aeons.Icons.Health_Icon'
  236.      Texture=Texture'Engine.S_Ammo'
  237.      Mesh=SkelMesh'Aeons.Meshes.health_m'
  238.      AmbientGlow=0
  239.      CollisionRadius=20
  240.      CollisionHeight=21
  241. }
  242.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement