Quick question.
The goal is to make an enhancement that gives the Overcharge weapon stun, that it previously did not have without that enhancement.
Now, I know how to make enhancements, I know how to piggy-back an EMP weapon on another beam weapon (like the Manticore t3 Cybran turret from Blackops does)
The problem comes when I try to do the same, but on a projectile weapon, not beam weapon.
So, my projectile weapon (Overcharge) needs to start with no stun, but gain a stun with an enhancement, while still remaining an overcharge weapon.
From what i can tell, the problem lies here
- Code: Select all
OnWeaponFired = function(self) --the weapon is Overcharge, projectile
LOG("----- Overcharge fired...");
local wep = self.unit:GetWeaponByLabel('laser1emp') --this is my dummy weapon, taken from the Manticore Blackops Unleashed turret, it does the stunns
self.targetaquired = self:GetCurrentTargetPos()
LOG("----- Overcharge target defined...");
if self.targetaquired then -----------THIS!!! This is where it fails.
LOG("----- if Overcharge target defined then...");
if self:HasEnhancement('RailGun3') then
LOG("----- Overcharge we got enhancement...");
wep:SetTargetGround(self.targetaquired)
LOG("----- Overcharge settargetground done...");
self:SetWeaponEnabledByLabel('laser1emp', true)
LOG("----- Overcharge emp enabled...");
wep:SetTargetGround(self.targetaquired)
LOG("----- Overcharge emp target set...");
wep:OnFire()
LOG("----- Overcharge emp fired...");
self:OnDisableWeapon()
self:ForkThread(self.PauseOvercharge)
SDFHeavyQuarnonCannon.OnWeaponFired(self)
end,
in the "if self.targetaquired then" part, the thing stops. As if a projectile loses its target when it fires?
The same code works on beams (i have enhancements that give me beams, and further enhancements that piggyback an emp invisible projectile onto that beam to make it stun...I know how to do that).
Some of the steps I tried:
-make 2 overcharge-class weapons, the second one with a stun buff, have one enabled one disabled, switch between them with enhancements (does not work, the game only recognizes the first overcharge-class weapon)
-giving a stun order directly in the OnWeaponFired of the Overcharge weapon
local Stunns = self:GetCurrentTargetPos()
Stunns:SetStunned(7, self) --game did not know what SetStunned was
Steps to try - maybe a code that lets me have stun on overcharge right from the start, but DISABLES the buff of the weapon, till i enable it with an enhancement? What would that command be?
perhaps a function that triggers every time the OC weapon fires, borrows its current target and forces fire the emp weapon on the same target as the OC weapon fired upon, then shuts down?
Or is there an easier way to do this?