Forged Alliance Forever Forged Alliance Forever Forums 2016-04-14T03:07:14+02:00 /feed.php?f=41&t=12255 2016-04-14T03:07:14+02:00 2016-04-14T03:07:14+02:00 /viewtopic.php?t=12255&p=125145#p125145 <![CDATA[Why Is my structure not calling its OnCreate()?]]>
Code:
-----------------------------------------------------------------------------
--  File     : /units/uef/ai0000/ai0000_script.lua
--  Author(s): Redmoth
--  Summary  : REDAI player Central Core Script instance
-----------------------------------------------------------------------------

local StructureUnit = import('/lua/sim/StructureUnit.lua').StructureUnit
AI0000 = Class(StructureUnit) {
    OnCreate = function(self, createArgs)
   StructureUnit.OnCreate(self, createArgs)
           if self:GetAIBrain().BrainType == 'AI' then
         local thrd = self:ForkThread(self.SwitchToEngiCom)
            end
   end
    end,

    SwitchToEngiCom = function(self)
   local nam = 'UUL0001'
   localpos = self:GetPosition()
   local unit = CreateUnitHPR(nam, self:GetArmy(), localpos[1], localpos[2], localpos[3],  0, 0, 0)
    end,
}
TypeClass = AI0000


REDAI.scd/units/AI/AI0000/AI0000_unit.bp
Code:
UnitBlueprint {
    Categories = {
        'AI'
    },
    Description = '<LOC UNIT_DESCRIPTION_0103> REDAI Core',
    Display = {
        DisplayName = '<LOC UNIT_NAME_0206>REDAI Core',
    },
    General = {
        UnitName = '<LOC UNIT_NAME_0207>REDAI Core',
    },
}


It also has a healthbar and can be attacked, but not killed. What gives?

edit: There are no model files because I just want a completely blank object with only the unit class.

Statistics: Posted by Redmoth — 14 Apr 2016, 03:07


]]>