Advertisement
Guest User

Artifact Craft Weapon [1.1]

a guest
Feb 17th, 2015
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.99 KB | None | 0 0
  1. //1.1
  2.  
  3. class ArtifactCraftWeapon extends ArtifactCraftAutoTurret;
  4.  
  5. var bool bIsFree;
  6. var bool bIsDropped;
  7. var bool bSuccess;
  8.  
  9. var PickUp Changeling;
  10. var class<PickUp> ChangelingClass;
  11.  
  12.  
  13.  
  14. function bool GetUsability()
  15. {
  16. //Can't use this if you don't have enough adrenaline...
  17. if (Instigator.Controller.Adrenaline < GetCost() )
  18. {
  19. Instigator.ReceiveLocalizedMessage(MessageClass, GetCost(), None, None, Class);
  20. return false;
  21. }
  22.  
  23. //Can't use this if we don't have scrap metal
  24. if (InvMetal.ScrapMetal[0] <= 0 && InvMetal.ScrapMetal[1] <= 0 && InvMetal.ScrapMetal[2] <= 0 && InvMetal.ScrapMetal[3] <= 0 && InvMetal.ScrapMetal[4] <= 0)
  25. {
  26. Instigator.ReceiveLocalizedMessage(MessageClass, 1000, None, None, Class);
  27. return false;
  28. }
  29.  
  30. return true;
  31. }
  32.  
  33. function AltActivate(optional string Param)
  34. {
  35. local float TimeDelta;
  36. local Vector StartTrace, EndTrace, SpawnLocation, HitNormal;
  37.  
  38.  
  39. if (Param != "")
  40. WeaponClass = class<Weapon>(DynamicLoadObject(Param, class'Class'));
  41.  
  42. if (Instigator == None)
  43. {
  44. Destroy();
  45. return;
  46. }
  47.  
  48. if (bIsFree != true)
  49. {
  50. if (GetUsability() != true)
  51. {
  52. bActive = false;
  53. GotoState('');
  54. return;
  55. }
  56. }
  57.  
  58.  
  59. //Check to see if we are allowed to use this again by time.
  60. TimeDelta = Level.TimeSeconds - LastUseTime;
  61. if (Level.TimeSeconds - LastUseTime < UseDelay)
  62. {
  63. Instigator.ReceiveLocalizedMessage(MessageClass, 5000 + UseDelay - TimeDelta, None, None, Class);
  64. bActive = false;
  65. GotoState('');
  66. return;
  67. }
  68.  
  69. LastUseTime = Level.TimeSeconds;
  70.  
  71. StartTrace = Instigator.Location;
  72. EndTrace = Instigator.Location + vector(Instigator.Rotation) * Instigator.GroundSpeed;
  73. if (Instigator.Trace(SpawnLocation, HitNormal, EndTrace, Instigator.Location) != None)
  74. {
  75. SpawnLocation -= vector(Instigator.Rotation) * 40;
  76.  
  77. A = spawn(Class'SillyRPG.xWeaponBaseSilly',,, SpawnLocation, Instigator.Rotation);
  78. }
  79. else
  80. A = spawn(Class'SillyRPG.xWeaponBaseSilly',,, EndTrace, Instigator.Rotation);
  81.  
  82.  
  83. if (A != None)
  84. {
  85. A.bHidden = true;
  86. Changeling = spawn(ChangelingClass,,, A.Location, A.Rotation);
  87.  
  88. if (WeaponClass == None)
  89. WeaponClass = Class'DWU2Weapons.WeaponRocketTurret';
  90. if (WeaponClass == class'LinkGun')
  91. WeaponClass = Class'MonsterAssaultRPG.RPGLinkGun';
  92.  
  93. A.bDelayedSpawn = true;
  94.  
  95. A.WeaponType=WeaponClass;
  96.  
  97. A.PostBeginPlay();
  98.  
  99. SetTimer(1,false);
  100.  
  101. }
  102. }
  103.  
  104. function Timer()
  105. {
  106. local int i;
  107. local PickUp WeaponPickUp;
  108.  
  109. if (A.myPickUp != None)
  110. WeaponPickUp = A.myPickUp;
  111.  
  112. if (Changeling != None)
  113. Changeling.Destroy();
  114. A.Destroy();
  115.  
  116. if (WeaponPickUp != None)
  117. {
  118. ModifyPickUp (WeaponPickUp);
  119.  
  120. //cost
  121. if (!bIsFree && bSuccess)
  122. PayUp ();
  123. }
  124. }
  125.  
  126. function ModifyPickup (PickUp TMWeaponPickUp)
  127. {
  128. TMWeaponPickUp.GotoState( 'Pickup' );
  129.  
  130. TMWeaponPickUp.RespawnTime = 0;
  131. TMWeaponPickUp.bDropped = bIsDropped;
  132. TMWeaponPickUp.RespawnEffect();
  133. ////TMWeaponPickUp.AmmoAmount = GetAmmo();
  134. if (!TMWeaponPickUp.bDropped)
  135. TMWeaponPickUp.Lifespan = 120;
  136. TMWeaponPickUp.SetTimer(120, false);
  137.  
  138. TMWeaponPickUp.NetUpdateTime = Level.TimeSeconds - 1;
  139. TMWeaponPickUp.bHidden = false;
  140. bSuccess = true;
  141. }
  142.  
  143. function PayUp ()
  144. {
  145. local int i;
  146.  
  147. Instigator.Controller.Adrenaline -= GetCost();
  148. if (Instigator.Controller.Adrenaline < 0)
  149. Instigator.Controller.Adrenaline = 0;
  150.  
  151. //Remove scrap metal
  152. i = 4;
  153. while (InvMetal.ScrapMetal[i] <= 0 && i >= 0)
  154. i--;
  155. InvMetal.RemoveMetal(i);
  156. }
  157.  
  158.  
  159. defaultproperties
  160. {
  161. ChangelingClass=Class'SillyRPG.XIsAChangeling'
  162. AbilityLevel=1
  163. UseDelay=2
  164. WeaponClass=Class'DWU2Weapons.AutoTurretDeploy'
  165. bIsFree=true
  166. bIsDropped=false
  167. MinActivationTime=0.000001
  168. ActivateSound=Sound'WeaponSounds.BaseGunTech.BReload2'
  169. IconMaterial=Texture'ME_RPGExpansion.Icons.CraftSpiderMines'
  170. ItemName="Craft Weapon"
  171. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement