Guest User

Ability Craft Auto Turret

a guest
Feb 17th, 2015
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. //1.1
  2. class AbilityCraftAutoTurret extends RPGAbility
  3. abstract;
  4.  
  5.  
  6. static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
  7. {
  8. if (Data.Abilities.length > 0 && class<AbilityClassMechanic>(Data.Abilities[0]) != None)
  9. return Super(RPGAbility).Cost(Data, CurrentLevel);
  10. Return 0;
  11. }
  12.  
  13. static function ModifyPawn(Pawn Other, int AbilityLevel)
  14. {
  15. local ArtifactCraftAutoTurret Artifact;
  16. local RPGStatsInv StatsInv;
  17. local InvScrapMetal InvMetal;
  18. local Inventory Inv;
  19. local int Count;
  20.  
  21.  
  22. if (Other.Role < ROLE_Authority)
  23. return;
  24.  
  25. if(Monster(Other) != None)
  26. return;
  27.  
  28. InvMetal = InvScrapMetal(Other.FindInventoryType(class'InvScrapMetal'));
  29.  
  30. if (InvMetal == None)
  31. return; //this should not happen if you are a mechanic
  32.  
  33. StatsInv = RPGStatsInv(Other.FindInventoryType(class'RPGStatsInv'));
  34.  
  35. for( Inv=Other.Inventory; Inv!=None && Count < 1000; Inv=Inv.Inventory ) // Artifact = ...
  36. {
  37. if ( Inv.class == class'ArtifactCraftAutoTurret' )
  38. {
  39. Artifact = ArtifactCraftAutoTurret(Inv);
  40. break;
  41. }
  42. Count++;
  43. }
  44.  
  45. if (Artifact != None)
  46. {
  47. if (Artifact.AbilityLevel == AbilityLevel)
  48. return;
  49. }
  50. else
  51. {
  52. Artifact = Other.spawn(class'ArtifactCraftAutoTurret', Other,,, rot(0,0,0));
  53.  
  54. if (Artifact != None)
  55. {
  56. Artifact.giveTo(Other);
  57. Other.NextItem();
  58. }
  59. }
  60.  
  61. if (Artifact != None)
  62. {
  63. Artifact.AbilityLevel = AbilityLevel;
  64. Artifact.InvMetal = InvMetal;
  65. if (StatsInv != None)
  66. Artifact.AmmoBonus = StatsInv.DataObject.AmmoMax;
  67. }
  68. }
  69.  
  70.  
  71. defaultproperties
  72. {
  73. AbilityName="Craft Auto Turret"
  74. Description="Using spare parts of any metal, the mechanic is able to generate auto turret.|Mana cost (per level): 40, 30, 20, 10|Turrets generated: 1|Metal cost: 1|Max level: 4"
  75. StartingCost=4
  76. CostAddPerLevel=-1
  77. BotChance=0
  78. MaxLevel=4
  79. PackageName="SillyRPG"
  80. ClassFilterName="Mechanic Class"
  81. RequiredRanking(0)=1
  82. RequiredRanking(1)=1
  83. RequiredRanking(2)=2
  84. RequiredRanking(3)=2
  85. bGivesArtifact=True
  86. }
Advertisement
Add Comment
Please, Sign In to add comment