Advertisement
Guest User

Untitled

a guest
Oct 7th, 2014
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.05 KB | None | 0 0
  1. class ArtifactCraftAutoTurret extends ArtifactCraftSpiderMines;
  2.  
  3. var class<Weapon> WeaponClass;
  4. //// v Yeah, I don't know how to let timer() acces those without making some additional var-s.
  5. var xWeaponBaseSilly A;
  6. var string TempParam;
  7.  
  8. function int GetCost()
  9. {
  10. return Max(0, 50 - (10 * AbilityLevel));
  11. }
  12.  
  13. //// It's actually unused as it is :p
  14. function int GetAmmo()
  15. {
  16. return 1;
  17. }
  18.  
  19. function Activate()
  20. {
  21. AltActivate();
  22. }
  23.  
  24.  
  25. function AltActivate(optional string Param)
  26. {
  27. local float TimeDelta;
  28. local Vector StartTrace, EndTrace, SpawnLocation, HitNormal;
  29. ////local xWeaponBaseSilly A;
  30. ////local int i;
  31.  
  32. if (Instigator == None || InvMetal == None)
  33. {
  34. Destroy();
  35. return;
  36. }
  37.  
  38. //Can't use this if you don't have enough adrenaline...
  39. if (Instigator.Controller.Adrenaline < GetCost())
  40. {
  41. Instigator.ReceiveLocalizedMessage(MessageClass, GetCost(), None, None, Class);
  42. bActive = false;
  43. GotoState('');
  44. return;
  45. }
  46.  
  47. //Can't use this if we don't have scrap metal
  48. if (Param != "")
  49. {
  50. if (int(Param) > 5 || int(Param) <= 0)
  51. {
  52. Instigator.ReceiveLocalizedMessage(MessageClass, 4000, None, None, Class);
  53. bActive = false;
  54. GotoState('');
  55. return;
  56. }
  57.  
  58. if (InvMetal.ScrapMetal[int(Param) - 1] <= 0)
  59. {
  60. Instigator.ReceiveLocalizedMessage(MessageClass, 1000 + int(Param), None, None, Class);
  61. bActive = false;
  62. GotoState('');
  63. return;
  64. }
  65. }
  66. else if (InvMetal.ScrapMetal[0] <= 0 && InvMetal.ScrapMetal[1] <= 0 && InvMetal.ScrapMetal[2] <= 0 && InvMetal.ScrapMetal[3] <= 0 && InvMetal.ScrapMetal[4] <= 0)
  67. {
  68. Instigator.ReceiveLocalizedMessage(MessageClass, 1000, None, None, Class);
  69. bActive = false;
  70. GotoState('');
  71. return;
  72. }
  73.  
  74. //Check to see if we are allowed to use this again by time.
  75. TimeDelta = Level.TimeSeconds - LastUseTime;
  76. if (Level.TimeSeconds - LastUseTime < UseDelay)
  77. {
  78. Instigator.ReceiveLocalizedMessage(MessageClass, 5000 + UseDelay - TimeDelta, None, None, Class);
  79. bActive = false;
  80. GotoState('');
  81. return;
  82. }
  83.  
  84. LastUseTime = Level.TimeSeconds;
  85.  
  86. StartTrace = Instigator.Location;
  87. EndTrace = Instigator.Location + vector(Instigator.Rotation) * Instigator.GroundSpeed;
  88. if (Instigator.Trace(SpawnLocation, HitNormal, EndTrace, Instigator.Location) != None)
  89. {
  90. SpawnLocation -= vector(Instigator.Rotation) * 40;
  91.  
  92. //// That's where 'warzone' begins XD . Basically RPG system was stealing mah turret without me knowing about it :/
  93.  
  94. A = spawn(Class'SillyRPG.xWeaponBaseSilly',,, SpawnLocation, Instigator.Rotation);
  95. }
  96. else
  97. A = spawn(Class'SillyRPG.xWeaponBaseSilly',,, EndTrace, Instigator.Rotation);
  98.  
  99. //// However our evil RPG system has no desire for WeaponBase but engine won't let me spawn it without edit (bNoDelete = false; bStatic = false;)
  100.  
  101. if (A != None)
  102. {
  103. A.WeaponType=WeaponClass;
  104.  
  105. A.PostBeginPlay();
  106. ////A.Destroy();
  107.  
  108. //// Turns out RPGWeaponPickup gives Pickup back to its PickupBase (here: my WeaponBase) after a lil bit, so I decided to delay accesing it, to get around that.
  109. TempParam=Param;
  110. SetTimer(1,false);
  111.  
  112. ////if (A.bSucces == true)
  113. /*if (A.myPickUp != None)
  114. {
  115.  
  116. A.myPickUp.RespawnTime = 0;
  117. A.myPickUp.bDropped = true;
  118. A.myPickUp.RespawnEffect();
  119. ////A.AmmoAmount = GetAmmo();
  120. A.myPickUp.SetTimer(120, false);
  121.  
  122. //cost
  123. Instigator.Controller.Adrenaline -= GetCost();
  124. if (Instigator.Controller.Adrenaline < 0)
  125. Instigator.Controller.Adrenaline = 0;
  126.  
  127. //Remove scrap metal
  128. if (Param != "")
  129. InvMetal.RemoveMetal(int(Param) - 1);
  130. else
  131. {
  132. i = 4;
  133. while (InvMetal.ScrapMetal[i] <= 0 && i >= 0)
  134. i--;
  135. InvMetal.RemoveMetal(i);
  136. }
  137. }*/
  138. ////A.Destroy();
  139.  
  140. }
  141. }
  142.  
  143. function Timer()
  144. {
  145. local int i;
  146.  
  147. if (A.myPickUp != None)
  148. {
  149.  
  150. A.myPickUp.RespawnTime = 0;
  151. A.myPickUp.bDropped = true;
  152. A.myPickUp.RespawnEffect();
  153. ////A.AmmoAmount = GetAmmo();
  154. A.myPickUp.SetTimer(120, false);
  155.  
  156. //cost
  157. Instigator.Controller.Adrenaline -= GetCost();
  158. if (Instigator.Controller.Adrenaline < 0)
  159. Instigator.Controller.Adrenaline = 0;
  160.  
  161. //Remove scrap metal
  162. if (TempParam != "")
  163. InvMetal.RemoveMetal(int(TempParam) - 1);
  164. else
  165. {
  166. i = 4;
  167. while (InvMetal.ScrapMetal[i] <= 0 && i >= 0)
  168. i--;
  169. InvMetal.RemoveMetal(i);
  170. }
  171. }
  172.  
  173. A.Destroy();
  174. //// Oops :| //// Well: kill(), no reset, auto kill wherever I put them don't do the job, eh, don't care abot it anyway. ////A.myEmitter.Destroy();
  175. }
  176.  
  177. defaultproperties
  178. {
  179. AbilityLevel=1
  180. UseDelay=2
  181. WeaponClass=Class'SillyRPG.AutoTurretDeployRb'
  182. MinActivationTime=0.000001
  183. ActivateSound=Sound'WeaponSounds.BaseGunTech.BReload2'
  184. IconMaterial=Texture'ME_RPGExpansion.Icons.CraftSpiderMines'
  185. ItemName="Craft Auto Turret"
  186. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement