Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ArtifactCraftAutoTurret extends ArtifactCraftSpiderMines;
- var class<Weapon> WeaponClass;
- //// v Yeah, I don't know how to let timer() acces those without making some additional var-s.
- var xWeaponBaseSilly A;
- var string TempParam;
- function int GetCost()
- {
- return Max(0, 50 - (10 * AbilityLevel));
- }
- //// It's actually unused as it is :p
- function int GetAmmo()
- {
- return 1;
- }
- function Activate()
- {
- AltActivate();
- }
- function AltActivate(optional string Param)
- {
- local float TimeDelta;
- local Vector StartTrace, EndTrace, SpawnLocation, HitNormal;
- ////local xWeaponBaseSilly A;
- ////local int i;
- if (Instigator == None || InvMetal == None)
- {
- Destroy();
- return;
- }
- //Can't use this if you don't have enough adrenaline...
- if (Instigator.Controller.Adrenaline < GetCost())
- {
- Instigator.ReceiveLocalizedMessage(MessageClass, GetCost(), None, None, Class);
- bActive = false;
- GotoState('');
- return;
- }
- //Can't use this if we don't have scrap metal
- if (Param != "")
- {
- if (int(Param) > 5 || int(Param) <= 0)
- {
- Instigator.ReceiveLocalizedMessage(MessageClass, 4000, None, None, Class);
- bActive = false;
- GotoState('');
- return;
- }
- if (InvMetal.ScrapMetal[int(Param) - 1] <= 0)
- {
- Instigator.ReceiveLocalizedMessage(MessageClass, 1000 + int(Param), None, None, Class);
- bActive = false;
- GotoState('');
- return;
- }
- }
- else if (InvMetal.ScrapMetal[0] <= 0 && InvMetal.ScrapMetal[1] <= 0 && InvMetal.ScrapMetal[2] <= 0 && InvMetal.ScrapMetal[3] <= 0 && InvMetal.ScrapMetal[4] <= 0)
- {
- Instigator.ReceiveLocalizedMessage(MessageClass, 1000, None, None, Class);
- bActive = false;
- GotoState('');
- return;
- }
- //Check to see if we are allowed to use this again by time.
- TimeDelta = Level.TimeSeconds - LastUseTime;
- if (Level.TimeSeconds - LastUseTime < UseDelay)
- {
- Instigator.ReceiveLocalizedMessage(MessageClass, 5000 + UseDelay - TimeDelta, None, None, Class);
- bActive = false;
- GotoState('');
- return;
- }
- LastUseTime = Level.TimeSeconds;
- StartTrace = Instigator.Location;
- EndTrace = Instigator.Location + vector(Instigator.Rotation) * Instigator.GroundSpeed;
- if (Instigator.Trace(SpawnLocation, HitNormal, EndTrace, Instigator.Location) != None)
- {
- SpawnLocation -= vector(Instigator.Rotation) * 40;
- //// That's where 'warzone' begins XD . Basically RPG system was stealing mah turret without me knowing about it :/
- A = spawn(Class'SillyRPG.xWeaponBaseSilly',,, SpawnLocation, Instigator.Rotation);
- }
- else
- A = spawn(Class'SillyRPG.xWeaponBaseSilly',,, EndTrace, Instigator.Rotation);
- //// However our evil RPG system has no desire for WeaponBase but engine won't let me spawn it without edit (bNoDelete = false; bStatic = false;)
- if (A != None)
- {
- A.WeaponType=WeaponClass;
- A.PostBeginPlay();
- ////A.Destroy();
- //// 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.
- TempParam=Param;
- SetTimer(1,false);
- ////if (A.bSucces == true)
- /*if (A.myPickUp != None)
- {
- A.myPickUp.RespawnTime = 0;
- A.myPickUp.bDropped = true;
- A.myPickUp.RespawnEffect();
- ////A.AmmoAmount = GetAmmo();
- A.myPickUp.SetTimer(120, false);
- //cost
- Instigator.Controller.Adrenaline -= GetCost();
- if (Instigator.Controller.Adrenaline < 0)
- Instigator.Controller.Adrenaline = 0;
- //Remove scrap metal
- if (Param != "")
- InvMetal.RemoveMetal(int(Param) - 1);
- else
- {
- i = 4;
- while (InvMetal.ScrapMetal[i] <= 0 && i >= 0)
- i--;
- InvMetal.RemoveMetal(i);
- }
- }*/
- ////A.Destroy();
- }
- }
- function Timer()
- {
- local int i;
- if (A.myPickUp != None)
- {
- A.myPickUp.RespawnTime = 0;
- A.myPickUp.bDropped = true;
- A.myPickUp.RespawnEffect();
- ////A.AmmoAmount = GetAmmo();
- A.myPickUp.SetTimer(120, false);
- //cost
- Instigator.Controller.Adrenaline -= GetCost();
- if (Instigator.Controller.Adrenaline < 0)
- Instigator.Controller.Adrenaline = 0;
- //Remove scrap metal
- if (TempParam != "")
- InvMetal.RemoveMetal(int(TempParam) - 1);
- else
- {
- i = 4;
- while (InvMetal.ScrapMetal[i] <= 0 && i >= 0)
- i--;
- InvMetal.RemoveMetal(i);
- }
- }
- A.Destroy();
- //// 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();
- }
- defaultproperties
- {
- AbilityLevel=1
- UseDelay=2
- WeaponClass=Class'SillyRPG.AutoTurretDeployRb'
- MinActivationTime=0.000001
- ActivateSound=Sound'WeaponSounds.BaseGunTech.BReload2'
- IconMaterial=Texture'ME_RPGExpansion.Icons.CraftSpiderMines'
- ItemName="Craft Auto Turret"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement