Why Is my structure not calling its OnCreate()?

Everything about mods can be found here.

Moderator: Morax

Why Is my structure not calling its OnCreate()?

Postby Redmoth » 14 Apr 2016, 03:07

REDAI.scd/units/AI/AI0000/AI0000_script.lua
Code: Select all
-----------------------------------------------------------------------------
--  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: Select all
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.
Redmoth
 
Posts: 8
Joined: 13 Apr 2016, 04:49
Has liked: 4 times
Been liked: 0 time
FAF User Name: Redmoth

Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest