lua question -1 reply

  • 1
  • 2

Please wait...

eluvatar

RIP Eluvatar The Second

50 XP

18th December 2006

0 Uploads

201 Posts

0 Threads

#1 10 years ago

ok for all you smart ones out their I guess I am just lame or something but how do I add this to the ACU for all races how do I do this I cant figure it out. OnStartBuild = function(self, unitBeingBuilt, order ) Unit.OnStartBuild(self,unitBeingBuilt, order) local unitid = self:GetBlueprint().General.UpgradesTo self.UnitBeingBuilt = unitBeingBuilt if unitBeingBuilt:GetUnitId() == unitid and order == 'Upgrade' then ChangeState(self, self.UpgradingState) end end,

UpgradingState = State { Main = function(self) self:StopRocking() local bp = self:GetBlueprint().Display self:PlayUnitSound('UpgradeStart') self:DisableDefaultToggleCaps() if bp.AnimationUpgrade then local unitBuilding = self.UnitBeingBuilt self.AnimatorUpgradeManip = CreateAnimator(self) self.Trash:Add(self.AnimatorUpgradeManip) local fractionOfComplete = 0 self:StartUpgradeEffects(unitBuilding) self.AnimatorUpgradeManip:PlayAnim(bp.AnimationUpgrade, false):SetRate(0)

while fractionOfComplete < 1 and not self:IsDead() do fractionOfComplete = unitBuilding:GetFractionComplete() self.AnimatorUpgradeManip:SetAnimationFraction(fractionOfComplete) WaitTicks(1) end if not self:IsDead() then self.AnimatorUpgradeManip:SetRate(1) end end end,

OnStopBuild = function(self, unitBuilding) Unit.OnStopBuild(self, unitBuilding) self:EnableDefaultToggleCaps() if unitBuilding:GetFractionComplete() == 1 then NotifyUpgrade(self, unitBuilding) self:StopUpgradeEffects(unitBuilding) self:PlayUnitSound('UpgradeEnd') self:Destroy() end end,

OnFailedToBuild = function(self) Unit.OnFailedToBuild(self) self:EnableDefaultToggleCaps() self.AnimatorUpgradeManip:Destroy() if self:GetCurrentLayer() == 'Water' then self:StartRocking() end self:PlayUnitSound('UpgradeFailed') self:PlayActiveAnimation() ChangeState(self, self.IdleState) end, },

StartUpgradeEffects = function(self, unitBeingBuilt) unitBeingBuilt:HideBone(0, true) end, StopUpgradeEffects = function(self, unitBeingBuilt) unitBeingBuilt:ShowBone(0, true) end,




Lt_hawkeye

Power! Unlimited Power!

50 XP

7th July 2006

0 Uploads

1,432 Posts

0 Threads

#2 10 years ago

i can help, but im not sure what your trying to do exactly.




eluvatar

RIP Eluvatar The Second

50 XP

18th December 2006

0 Uploads

201 Posts

0 Threads

#3 10 years ago

ok well I want to make it so the commander can transform into a different unit I went on GPG fourm and it said to use the code above. because I was having the problem that all the commander dose it make the unit I want him to transform into but the commander dose not go away lolz I just dont know what to do with this code the thread said to put it in the lua but it dose not do anything. and the people said that they got it to work fine.




Lt_hawkeye

Power! Unlimited Power!

50 XP

7th July 2006

0 Uploads

1,432 Posts

0 Threads

#4 10 years ago

so you put the code in, and it still dont work? are you sure the game is loading the files? are there any errors in the log?

to bring up the log, just do a cheat game and press F9




eluvatar

RIP Eluvatar The Second

50 XP

18th December 2006

0 Uploads

201 Posts

0 Threads

#5 10 years ago

yes I think so that is what I want help with. I dont know if I have put it in and where to put it here is the whole lua #**************************************************************************** #** #** File : /cdimage/units/UAL0001/UAL0001_script.lua #** Author(s): John Comes, David Tomandl, Jessica St. Croix, Gordon Duclos #** #** Summary : Aeon Commander Script #** #** Copyright © 2005 Gas Powered Games, Inc. All rights reserved. #****************************************************************************

local AWalkingLandUnit = import('/lua/aeonunits.lua').AWalkingLandUnit

local AWeapons = import('/lua/aeonweapons.lua') local ADFDisruptorCannonWeapon = AWeapons.ADFDisruptorCannonWeapon local AIFCommanderDeathWeapon = AWeapons.AIFCommanderDeathWeapon local EffectTemplate = import('/lua/EffectTemplates.lua') local EffectUtil = import('/lua/EffectUtilities.lua') local ADFOverchargeWeapon = AWeapons.ADFOverchargeWeapon local ADFChronoDampener = AWeapons.ADFChronoDampener local Buff = import('/lua/sim/Buff.lua')

UAL0001 = Class(AWalkingLandUnit) {

DeathThreadDestructionWaitTime = 2,

Weapons = { DeathWeapon = Class(AIFCommanderDeathWeapon) {}, RightDisruptor = Class(ADFDisruptorCannonWeapon) {}, ChronoDampener = Class(ADFChronoDampener) {}, OverCharge = Class(ADFOverchargeWeapon) {

OnCreate = function(self) ADFOverchargeWeapon.OnCreate(self) self:SetWeaponEnabled(false) self.AimControl:SetEnabled(false) self.AimControl:SetPrecedence(0) self.unit:SetOverchargePaused(false) end,

OnEnableWeapon = function(self) if self:BeenDestroyed() then return end ADFOverchargeWeapon.OnEnableWeapon(self) self:SetWeaponEnabled(true) self.unit:SetWeaponEnabledByLabel('RightDisruptor', false) self.unit:BuildManipulatorSetEnabled(false) self.AimControl:SetEnabled(true) self.AimControl:SetPrecedence(20) self.unit.BuildArmManipulator:SetPrecedence(0) self.AimControl:SetHeadingPitch( self.unit:GetWeaponManipulatorByLabel('RightDisruptor'):GetHeadingPitch() ) end,

OnWeaponFired = function(self) ADFOverchargeWeapon.OnWeaponFired(self) self:OnDisableWeapon() self:ForkThread(self.PauseOvercharge) end, OnDisableWeapon = function(self) if self.unit:BeenDestroyed() then return end self:SetWeaponEnabled(false) self.unit:SetWeaponEnabledByLabel('RightDisruptor', true) self.unit:BuildManipulatorSetEnabled(false) self.AimControl:SetEnabled(false) self.AimControl:SetPrecedence(0) self.unit.BuildArmManipulator:SetPrecedence(0) self.unit:GetWeaponManipulatorByLabel('RightDisruptor'):SetHeadingPitch( self.AimControl:GetHeadingPitch() ) end, PauseOvercharge = function(self) if not self.unit:IsOverchargePaused() then self.unit:SetOverchargePaused(true) WaitSeconds(1/self:GetBlueprint().RateOfFire) self.unit:SetOverchargePaused(false) end end, OnFire = function(self) if not self.unit:IsOverchargePaused() then ADFOverchargeWeapon.OnFire(self) end end, IdleState = State(ADFOverchargeWeapon.IdleState) { OnGotTarget = function(self) if not self.unit:IsOverchargePaused() then ADFOverchargeWeapon.IdleState.OnGotTarget(self) end end, OnFire = function(self) if not self.unit:IsOverchargePaused() then ChangeState(self, self.RackSalvoFiringState) end end, }, RackSalvoFireReadyState = State(ADFOverchargeWeapon.RackSalvoFireReadyState) { OnFire = function(self) if not self.unit:IsOverchargePaused() then ADFOverchargeWeapon.RackSalvoFireReadyState.OnFire(self) end end, }, }, },

OnStartBuild = function(self, unitBeingBuilt, order ) Unit.OnStartBuild(self,unitBeingBuilt, order) local unitid = self:GetBlueprint().General.UpgradesTo self.UnitBeingBuilt = unitBeingBuilt if unitBeingBuilt:GetUnitId() == unitid and order == 'Upgrade' then ChangeState(self, self.UpgradingState) end end,

UpgradingState = State { Main = function(self) self:StopRocking() local bp = self:GetBlueprint().Display self:PlayUnitSound('UpgradeStart') self:DisableDefaultToggleCaps() if bp.AnimationUpgrade then local unitBuilding = self.UnitBeingBuilt self.AnimatorUpgradeManip = CreateAnimator(self) self.Trash:Add(self.AnimatorUpgradeManip) local fractionOfComplete = 0 self:StartUpgradeEffects(unitBuilding) self.AnimatorUpgradeManip:PlayAnim(bp.AnimationUpgrade, false):SetRate(0)

while fractionOfComplete < 1 and not self:IsDead() do fractionOfComplete = unitBuilding:GetFractionComplete() self.AnimatorUpgradeManip:SetAnimationFraction(fractionOfComplete) WaitTicks(1) end if not self:IsDead() then self.AnimatorUpgradeManip:SetRate(1) end end end,

OnStopBuild = function(self, unitBuilding) Unit.OnStopBuild(self, unitBuilding) self:EnableDefaultToggleCaps() if unitBuilding:GetFractionComplete() == 1 then NotifyUpgrade(self, unitBuilding) self:StopUpgradeEffects(unitBuilding) self:PlayUnitSound('UpgradeEnd') self:Destroy() end end,

OnFailedToBuild = function(self) Unit.OnFailedToBuild(self) self:EnableDefaultToggleCaps() self.AnimatorUpgradeManip:Destroy() if self:GetCurrentLayer() == 'Water' then self:StartRocking() end self:PlayUnitSound('UpgradeFailed') self:PlayActiveAnimation() ChangeState(self, self.IdleState) end, },

StartUpgradeEffects = function(self, unitBeingBuilt) unitBeingBuilt:HideBone(0, true) end, StopUpgradeEffects = function(self, unitBeingBuilt) unitBeingBuilt:ShowBone(0, true) end,

OnCreate = function(self) AWalkingLandUnit.OnCreate(self) self:SetCapturable(false) self:SetWeaponEnabledByLabel('ChronoDampener', false) self:SetupBuildBones() self:HideBone('Back_Upgrade', true) self:HideBone('Right_Upgrade', true) self:HideBone('Left_Upgrade', true) # Restrict what enhancements will enable later self:AddBuildRestriction( categories.AEON * (categories.BUILTBYTIER2COMMANDER + categories.BUILTBYTIER3COMMANDER) ) end,

OnPrepareArmToBuild = function(self) AWalkingLandUnit.OnPrepareArmToBuild(self) if self:BeenDestroyed() then return end self:BuildManipulatorSetEnabled(true) self.BuildArmManipulator:SetPrecedence(20) self:SetWeaponEnabledByLabel('RightDisruptor', false) self:SetWeaponEnabledByLabel('OverCharge', false) self.BuildArmManipulator:SetHeadingPitch( self:GetWeaponManipulatorByLabel('RightDisruptor'):GetHeadingPitch() ) end,

OnStopCapture = function(self, target) AWalkingLandUnit.OnStopCapture(self, target) if self:BeenDestroyed() then return end self:BuildManipulatorSetEnabled(false) self.BuildArmManipulator:SetPrecedence(0) self:SetWeaponEnabledByLabel('RightDisruptor', true) self:SetWeaponEnabledByLabel('OverCharge', false) self:GetWeaponManipulatorByLabel('RightDisruptor'):SetHeadingPitch( self.BuildArmManipulator:GetHeadingPitch() ) end,

OnFailedCapture = function(self, target) AWalkingLandUnit.OnFailedCapture(self, target) if self:BeenDestroyed() then return end self:BuildManipulatorSetEnabled(false) self.BuildArmManipulator:SetPrecedence(0) self:SetWeaponEnabledByLabel('RightDisruptor', true) self:SetWeaponEnabledByLabel('OverCharge', false) self:GetWeaponManipulatorByLabel('RightDisruptor'):SetHeadingPitch( self.BuildArmManipulator:GetHeadingPitch() ) end,

OnStopReclaim = function(self, target) AWalkingLandUnit.OnStopReclaim(self, target) if self:BeenDestroyed() then return end self:BuildManipulatorSetEnabled(false) self.BuildArmManipulator:SetPrecedence(0) self:SetWeaponEnabledByLabel('RightDisruptor', true) self:SetWeaponEnabledByLabel('OverCharge', false) self:GetWeaponManipulatorByLabel('RightDisruptor'):SetHeadingPitch( self.BuildArmManipulator:GetHeadingPitch() ) end,

OnStopBeingBuilt = function(self,builder,layer) AWalkingLandUnit.OnStopBeingBuilt(self,builder,layer) self:SetWeaponEnabledByLabel('RightDisruptor', true) self:ForkThread(self.GiveInitialResources) end,

OnFailedToBuild = function(self) AWalkingLandUnit.OnFailedToBuild(self) if self:BeenDestroyed() then return end self:BuildManipulatorSetEnabled(false) self.BuildArmManipulator:SetPrecedence(0) self:SetWeaponEnabledByLabel('RightDisruptor', true) self:SetWeaponEnabledByLabel('OverCharge', false) self:GetWeaponManipulatorByLabel('RightDisruptor'):SetHeadingPitch( self.BuildArmManipulator:GetHeadingPitch() ) end, OnStartBuild = function(self, unitBeingBuilt, order) AWalkingLandUnit.OnStartBuild(self, unitBeingBuilt, order) self.UnitBeingBuilt = unitBeingBuilt self.UnitBuildOrder = order self.BuildingUnit = true end,

OnStopBuild = function(self, unitBeingBuilt) AWalkingLandUnit.OnStopBuild(self, unitBeingBuilt) if self:BeenDestroyed() then return end self:BuildManipulatorSetEnabled(false) self.BuildArmManipulator:SetPrecedence(0) self:SetWeaponEnabledByLabel('RightDisruptor', true) self:SetWeaponEnabledByLabel('OverCharge', false) self:GetWeaponManipulatorByLabel('RightDisruptor'):SetHeadingPitch( self.BuildArmManipulator:GetHeadingPitch() ) self.UnitBeingBuilt = nil self.UnitBuildOrder = nil self.BuildingUnit = false end,

GiveInitialResources = function(self) WaitTicks(2) self:GetAIBrain():GiveResource('Energy', self:GetBlueprint().Economy.StorageEnergy) self:GetAIBrain():GiveResource('Mass', self:GetBlueprint().Economy.StorageMass) end, CreateBuildEffects = function( self, unitBeingBuilt, order ) EffectUtil.CreateAeonCommanderBuildingEffects( self, unitBeingBuilt, self:GetBlueprint().General.BuildBones.BuildEffectBones, self.BuildEffectsBag ) end,

PlayCommanderWarpInEffect = function(self) self:HideBone(0, true) self:SetUnSelectable(true) self:SetBusy(true) self:SetBlockCommandQueue(true) self:ForkThread(self.WarpInEffectThread) end,

WarpInEffectThread = function(self) self:PlayUnitSound('CommanderArrival') self:CreateProjectile( '/effects/entities/UnitTeleport01/UnitTeleport01_proj.bp', 0, 1.35, 0, nil, nil, nil):SetCollision(false) WaitSeconds(2.1) self:SetMesh('/units/ual0001/UAL0001_PhaseShield_mesh', true) self:ShowBone(0, true) self:SetUnSelectable(false) self:SetBusy(false) self:SetBlockCommandQueue(false) self:HideBone('Back_Upgrade', true) self:HideBone('Right_Upgrade', true) self:HideBone('Left_Upgrade', true) local totalBones = self:GetBoneCount() - 1 local army = self:GetArmy() for k, v in EffectTemplate.UnitTeleportSteam01 do for bone = 1, totalBones do CreateAttachedEmitter(self,bone,army, v) end end

WaitSeconds(6) self:SetMesh(self:GetBlueprint().Display.MeshBlueprint, true) end,

CreateEnhancement = function(self, enh) AWalkingLandUnit.CreateEnhancement(self, enh) local bp = self:GetBlueprint().Enhancements[enh] #Resource Allocation if enh == 'ResourceAllocation' then local bp = self:GetBlueprint().Enhancements[enh] local bpEcon = self:GetBlueprint().Economy if not bp then return end self:SetProductionPerSecondEnergy(bp.ProductionPerSecondEnergy + bpEcon.ProductionPerSecondEnergy or 0) self:SetProductionPerSecondMass(bp.ProductionPerSecondMass + bpEcon.ProductionPerSecondMass or 0) elseif enh == 'ResourceAllocationRemove' then local bpEcon = self:GetBlueprint().Economy self:SetProductionPerSecondEnergy(bpEcon.ProductionPerSecondEnergy or 0) self:SetProductionPerSecondMass(bpEcon.ProductionPerSecondMass or 0) elseif enh == 'ResourceAllocationAdvanced' then local bp = self:GetBlueprint().Enhancements[enh] local bpEcon = self:GetBlueprint().Economy if not bp then return end self:SetProductionPerSecondEnergy(bp.ProductionPerSecondEnergy + bpEcon.ProductionPerSecondEnergy or 0) self:SetProductionPerSecondMass(bp.ProductionPerSecondMass + bpEcon.ProductionPerSecondMass or 0) elseif enh == 'ResourceAllocationAdvancedRemove' then local bpEcon = self:GetBlueprint().Economy self:SetProductionPerSecondEnergy(bpEcon.ProductionPerSecondEnergy or 0) self:SetProductionPerSecondMass(bpEcon.ProductionPerSecondMass or 0) #Shields elseif enh == 'Shield' then self:AddToggleCap('RULEUTC_ShieldToggle') self:SetEnergyMaintenanceConsumptionOverride(bp.MaintenanceConsumptionPerSecondEnergy or 0) self:SetMaintenanceConsumptionActive() self:CreatePersonalShield(bp) elseif enh == 'ShieldRemove' then self:DestroyShield() self:SetMaintenanceConsumptionInactive() self:RemoveToggleCap('RULEUTC_ShieldToggle') elseif enh == 'ShieldHeavy' then self:AddToggleCap('RULEUTC_ShieldToggle') self:ForkThread(self.CreateHeavyShield, bp) elseif enh == 'ShieldHeavyRemove' then self:DestroyShield() self:SetMaintenanceConsumptionInactive() self:RemoveToggleCap('RULEUTC_ShieldToggle') #Teleporter elseif enh == 'Teleporter' then self:AddCommandCap('RULEUCC_Teleport') elseif enh == 'TeleporterRemove' then self:RemoveCommandCap('RULEUCC_Teleport') #Chrono Dampener elseif enh == 'ChronoDampener' then self:SetWeaponEnabledByLabel('ChronoDampener', true) elseif enh == 'ChronoDampenerRemove' then self:SetWeaponEnabledByLabel('ChronoDampener', false) #T2 Engineering elseif enh =='AdvancedEngineering' then local bp = self:GetBlueprint().Enhancements[enh] if not bp then return end local cat = ParseEntityCategory(bp.BuildableCategoryAdds) self:RemoveBuildRestriction(cat) if not Buffs['AeonACUT2BuildRate'] then BuffBlueprint { Name = 'AeonACUT2BuildRate', DisplayName = 'AeonACUT2BuildRate', BuffType = 'ACUBUILDRATE', Stacks = 'REPLACE', Duration = -1, Affects = { BuildRate = { Add = bp.NewBuildRate - self:GetBlueprint().Economy.BuildRate, Mult = 1, }, MaxHealth = { Add = bp.NewHealth, Mult = 1.0, }, Regen = { Add = bp.NewRegenRate, Mult = 1.0, }, }, } end Buff.ApplyBuff(self, 'AeonACUT2BuildRate') elseif enh =='AdvancedEngineeringRemove' then local bp = self:GetBlueprint().Economy.BuildRate if not bp then return end self:RestoreBuildRestrictions() self:AddBuildRestriction( categories.AEON * (categories.BUILTBYTIER2COMMANDER + categories.BUILTBYTIER3COMMANDER) ) if Buff.HasBuff( self, 'AeonACUT2BuildRate' ) then Buff.RemoveBuff( self, 'AeonACUT2BuildRate' ) end #T3 Engineering elseif enh =='T3Engineering' then local bp = self:GetBlueprint().Enhancements[enh] if not bp then return end local cat = ParseEntityCategory(bp.BuildableCategoryAdds) self:RemoveBuildRestriction(cat) if not Buffs['AeonACUT3BuildRate'] then BuffBlueprint { Name = 'AeonACUT3BuildRate', DisplayName = 'AeonCUT3BuildRate', BuffType = 'ACUBUILDRATE', Stacks = 'REPLACE', Duration = -1, Affects = { BuildRate = { Add = bp.NewBuildRate - self:GetBlueprint().Economy.BuildRate, Mult = 1, }, MaxHealth = { Add = bp.NewHealth, Mult = 1.0, }, Regen = { Add = bp.NewRegenRate, Mult = 1.0, }, }, } end Buff.ApplyBuff(self, 'AeonACUT3BuildRate') elseif enh =='T3EngineeringRemove' then local bp = self:GetBlueprint().Economy.BuildRate if not bp then return end self:RestoreBuildRestrictions() self:AddBuildRestriction( categories.AEON * ( categories.BUILTBYTIER2COMMANDER + categories.BUILTBYTIER3COMMANDER) ) if Buff.HasBuff( self, 'AeonACUT3BuildRate' ) then Buff.RemoveBuff( self, 'AeonACUT3BuildRate' ) end #Crysalis Beam elseif enh == 'CrysalisBeam' then local wep = self:GetWeaponByLabel('RightDisruptor') wep:ChangeMaxRadius(bp.NewMaxRadius or 44) local oc = self:GetWeaponByLabel('OverCharge') oc:ChangeMaxRadius(bp.NewMaxRadius or 44) elseif enh == 'CrysalisBeamRemove' then local wep = self:GetWeaponByLabel('RightDisruptor') local bpDisrupt = self:GetBlueprint().Weapon[1].MaxRadius wep:ChangeMaxRadius(bpDisrupt or 22) local oc = self:GetWeaponByLabel('OverCharge') oc:ChangeMaxRadius(bpDisrupt or 22) #Heat Sink Augmentation elseif enh == 'HeatSink' then local wep = self:GetWeaponByLabel('RightDisruptor') wep:ChangeRateOfFire(bp.NewRateOfFire or 2) elseif enh == 'HeatSinkRemove' then local wep = self:GetWeaponByLabel('RightDisruptor') local bpDisrupt = self:GetBlueprint().Weapon[1].RateOfFire wep:ChangeRateOfFire(bpDisrupt or 1) #Enhanced Sensor Systems elseif enh == 'EnhancedSensors' then self:SetIntelRadius('Vision', bp.NewVisionRadius or 104) self:SetIntelRadius('Omni', bp.NewOmniRadius or 104) elseif enh == 'EnhancedSensorsRemove' then local bpIntel = self:GetBlueprint().Intel self:SetIntelRadius('Vision', bpIntel.VisionRadius or 26) self:SetIntelRadius('Omni', bpIntel.OmniRadius or 26) end end,

CreateHeavyShield = function(self, bp) WaitTicks(1) self:CreatePersonalShield(bp) self:SetEnergyMaintenanceConsumptionOverride(bp.MaintenanceConsumptionPerSecondEnergy or 0) self:SetMaintenanceConsumptionActive() end, OnPaused = function(self) AWalkingLandUnit.OnPaused(self) if self.BuildingUnit then AWalkingLandUnit.StopBuildingEffects(self, self:GetUnitBeingBuilt()) end end, OnUnpaused = function(self) if self.BuildingUnit then AWalkingLandUnit.StartBuildingEffects(self, self:GetUnitBeingBuilt(), self.UnitBuildOrder) end AWalkingLandUnit.OnUnpaused(self) end,

}

TypeClass = UAL0001




Lt_hawkeye

Power! Unlimited Power!

50 XP

7th July 2006

0 Uploads

1,432 Posts

0 Threads

#6 10 years ago

honestly i dont think you can have an ACU change into another unit without messing up the upgrades or the game. maybe you could make a dummy ACU that can change into a different unit?




eluvatar

RIP Eluvatar The Second

50 XP

18th December 2006

0 Uploads

201 Posts

0 Threads

#7 10 years ago

well thats it I am not using the normal acu any more you start the game and change him into another unit that is what I want to do. but what do you mean by a dummy acu?




Lt_hawkeye

Power! Unlimited Power!

50 XP

7th July 2006

0 Uploads

1,432 Posts

0 Threads

#8 10 years ago

i mean make another unit that is the ACU except without the upgrades, just make it really cheap or just spawn it, to test out your code.




eluvatar

RIP Eluvatar The Second

50 XP

18th December 2006

0 Uploads

201 Posts

0 Threads

#9 10 years ago

ok I tested it out and I cant get it to work but I got it from GPGnet and they said they got it to work GPGnet :: View topic - [Guide]: Creating deployable/upgradable units here is the thread. below I have uploaded my test if you can get it to work I would appreciate it tnx




Lt_hawkeye

Power! Unlimited Power!

50 XP

7th July 2006

0 Uploads

1,432 Posts

0 Threads

#10 10 years ago

ok this is your original script #**************************************************************************** #** #** File : /cdimage/units/UAL0105/UAL0105_script.lua #** Author(s): John Comes, David Tomandl, Jessica St. Croix #** #** Summary : Aeon T1 Engineer Script #** #** Copyright © 2005 Gas Powered Games, Inc. All rights reserved. #****************************************************************************

local AConstructionUnit = import('/lua/aeonunits.lua').AConstructionUnit

T1TAE = Class(AConstructionUnit) { }#me? i dont go here, (down to bottom)

OnStartBuild = function(self, unitBeingBuilt, order ) Unit.OnStartBuild(self,unitBeingBuilt, order)# "Unit" needs to be AConstructionUnit local unitid = self:GetBlueprint().General.UpgradesTo self.UnitBeingBuilt = unitBeingBuilt if unitBeingBuilt:GetUnitId() == unitid and order == 'Upgrade' then ChangeState(self, self.UpgradingState) end end,

UpgradingState = State { Main = function(self) self:StopRocking() local bp = self:GetBlueprint().Display self:PlayUnitSound('UpgradeStart') self:DisableDefaultToggleCaps() if bp.AnimationUpgrade then local unitBuilding = self.UnitBeingBuilt self.AnimatorUpgradeManip = CreateAnimator(self) self.Trash:Add(self.AnimatorUpgradeManip) local fractionOfComplete = 0 self:StartUpgradeEffects(unitBuilding) self.AnimatorUpgradeManip:PlayAnim(bp.AnimationUpgrade, false):SetRate(0)

while fractionOfComplete < 1 and not self:IsDead() do fractionOfComplete = unitBuilding:GetFractionComplete() self.AnimatorUpgradeManip:SetAnimationFraction(fractionOfComplete) WaitTicks(1) end if not self:IsDead() then self.AnimatorUpgradeManip:SetRate(1) end end end,

OnStopBuild = function(self, unitBuilding) Unit.OnStopBuild(self, unitBuilding)# "Unit" needs to be AConstructionUnit self:EnableDefaultToggleCaps() if unitBuilding:GetFractionComplete() == 1 then NotifyUpgrade(self, unitBuilding) self:StopUpgradeEffects(unitBuilding) self:PlayUnitSound('UpgradeEnd') self:Destroy() end end,

OnFailedToBuild = function(self) Unit.OnFailedToBuild(self)# "Unit" needs to be AConstructionUnit self:EnableDefaultToggleCaps() self.AnimatorUpgradeManip:Destroy() if self:GetCurrentLayer() == 'Water' then self:StartRocking() end self:PlayUnitSound('UpgradeFailed') self:PlayActiveAnimation() ChangeState(self, self.IdleState) end, ##we go here },

StartUpgradeEffects = function(self, unitBeingBuilt)##why am i here? unitBeingBuilt:HideBone(0, true) end, StopUpgradeEffects = function(self, unitBeingBuilt)##why am i here unitBeingBuilt:ShowBone(0, true) end, }#im supposed to go here TypeClass = T1TAE

fix everything that i've shown you and it will work fine.

i've already fixed it and tested it an it does work, now all you need to do is make the correct changes. if you still have problem let me know. also its easy to figure out your mistakes if you open up the log

run the game in "windowed" mods(go to video options and select windowed under resolution) and with cheats enabled press F9. any errors in the code or script will appear in yellow letters




  • 1
  • 2