Advertisement
Guest User

Ability Silly Vehicle Override

a guest
Oct 9th, 2014
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. Class AbilitySillyVehicleOverride extends RPGAbility
  2. Abstract;
  3.  
  4.  
  5. static function bool AbilityIsAllowed(GameInfo Game, MutUT2004RPG RPGMut)
  6. {
  7. Return Game.bAllowVehicles;
  8. }
  9.  
  10. static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
  11. {
  12. if (Data.Abilities.Length > 0)
  13. {
  14. Return Super(RPGAbility).Cost(Data, CurrentLevel);
  15. }
  16.  
  17. Return 0;
  18. }
  19.  
  20. /* Modify the owning player's current vehicle. Called by MutUT2004RPG.DriverEnteredVehicle() serverside
  21. * and RPGStatsInv.ClientEnteredVehicle() clientside.
  22. */
  23. static simulated function ModifyVehicle(Vehicle V, int AbilityLevel)
  24. {
  25. local float HealthPerc;
  26. local int OldMax;
  27. local int NewMax;
  28. local InvVehicleNfo Nfo;
  29. local Inventory Inv;
  30.  
  31. //log(V$"Override Hi ");
  32.  
  33. Inv = V.FindInventoryType(class'InvVehicleNfo');
  34. if (Inv == None)
  35. {
  36. //log(V$" Making Nfo ");
  37. Nfo = V.spawn(class'InvVehicleNfo', V,,,rot(0,0,0));
  38. //if (Nfo == None)
  39. //log(V$" No Nfo -1 ");
  40. Nfo.GiveTo(V);
  41. //if (Nfo == None)
  42. //log(V$" No Nfo 0 ");
  43. }
  44. else
  45. {
  46. //log(V$" Nfo already done "$Inv);
  47. Nfo = InvVehicleNfo(Inv);
  48. }
  49. if (Nfo == None)
  50. {
  51. log(V$" Override No Nfo 1 ");
  52. return;
  53. }
  54.  
  55.  
  56. if (Nfo.PermaBonusHp != 0)
  57. {
  58. HealthPerc = float(V.Health) / V.HealthMax;
  59.  
  60. if(Nfo.VitalityLevel != 0)
  61. {
  62. OldMax = V.HealthMax;
  63. V.HealthMax +=( (1.0 + (0.05 * float(AbilityLevel))) * float(Nfo.PermaBonusHp) );
  64. NewMax = V.HealthMax;
  65. Nfo.VitalityBonus += NewMax - OldMax;
  66. }
  67. else
  68. {
  69. V.HealthMax += Nfo.PermaBonusHp;
  70. }
  71. V.Health = V.HealthMax * HealthPerc;
  72. }
  73. Nfo.CurrHpMax = V.HealthMax;
  74.  
  75. //log(V$" "$Nfo.CurrHpMax);
  76.  
  77.  
  78. //Inv = V.FindInventoryType(class'InvVehicleNfo');
  79.  
  80. //if (Inv == None)
  81. //log(V$" No Nfo 2 ");
  82. }
  83.  
  84. /* Remove any modifications to this vehicle, because the player is no longer driving it.
  85. */
  86. static simulated function UnModifyVehicle(Vehicle V, int AbilityLevel)
  87. {
  88. local InvVehicleNfo Nfo;
  89. local Inventory Inv;
  90.  
  91.  
  92. //log(V$"Override bye ");
  93.  
  94. Inv = V.FindInventoryType(class'InvVehicleNfo');
  95. if (Inv == None)
  96. {
  97. log(V$" Override No Nfo 3 ");
  98. return;
  99. }
  100. Nfo = InvVehicleNfo(Inv);
  101. if (Nfo == None)
  102. {
  103. log(V$" Override No Nfo 4 ");
  104. return;
  105. }
  106.  
  107. Nfo.CurrHpMax *= -1;
  108. //log(V$" bye bye ");
  109. }
  110.  
  111. defaultproperties
  112. {
  113. AbilityName="Silly Vehicle Override"
  114. Description="Skill for handling some of vehicle stats "
  115. StartingCost=1
  116. CostAddPerLevel=-2
  117. MaxLevel=2
  118. PackageName="SillyRPG"
  119. ClassFilterName="Misc Abilities"
  120. RequiredRanking(0)=1
  121. RequiredRanking(1)=1
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement