Me needing help again!
I have a unit with three unique weapons that I would like to activate/deactivate based on what fired last. Ideally so they fire consecutively after each other.
Ie Gun1 fires, deactivates, an animation occurs to 'set up' Gun2, then Gun2 fires, etc.
This is what I have currently, except the guns never swap:
- Code: Select all
OnCreate = function(self)
SecretUnit.OnCreate(self)
self:SetWeaponEnabledByLabel('Gun2', false)
self:SetWeaponEnabledByLabel('Gun3', false)
end,
Weapons = {
Gun1 = Class(Secret1) {
OnFire = function(self)
self:Fire()
Secret1.OnFire()
end,
Fire = function(self)
self:SetWeaponEnabledByLabel('Gun1', false)
self.Reload1 = CreateAnimator(self)
self.Reload1:PlayAnim(self:GetBlueprint().Display.AnimationReload1, true):SetRate(1)
self.Trash:Add(self.Reload1)
self:SetWeaponEnabledByLabel('Gun2', true)
self:GetWeaponManipulatorByLabel('Gun1'):SetHeadingPitch(self:GetWeaponManipulatorByLabel('Gun2'):GetHeadingPitch())
end,
},
Gun2 = Class(Secret2) {
OnFire = function(self)
self:Fire()
Secret2.OnFire()
end,
Fire = function(self)
self:SetWeaponEnabledByLabel('Gun2', false)
self.Reload2 = CreateAnimator(self)
self.Reload2:PlayAnim(self:GetBlueprint().Display.AnimationReload2, true):SetRate(1)
self.Trash:Add(self.Reload2)
self:SetWeaponEnabledByLabel('Gun3', true)
self:GetWeaponManipulatorByLabel('Gun2'):SetHeadingPitch(self:GetWeaponManipulatorByLabel('Gun3'):GetHeadingPitch())
end,
},
Gun3 = Class(Secret3) {
OnFire = function(self)
self:Fire()
Secret3.OnFire()
end,
Fire = function(self)
self:SetWeaponEnabledByLabel('Gun3', false)
self.Reload3 = CreateAnimator(self)
self.Reload3:PlayAnim(self:GetBlueprint().Display.AnimationReload3, true):SetRate(1)
self.Trash:Add(self.Reload2)
self:SetWeaponEnabledByLabel('Gun1', true)
self:GetWeaponManipulatorByLabel('Gun3'):SetHeadingPitch(self:GetWeaponManipulatorByLabel('Gun1'):GetHeadingPitch())
end,
},
},
I threw in some LOG('words') in there, and it seems like the OnFire function is never actually called, what function should I be using?
Thanks!!