
I am new to Lua, but able to write a few scripts. One thing I dont understand, is how SupCom instances things.
For example: SupCom 2 has an aiBrain.lua class.
When you start a game, each player (humans and ais) each get their own instance of an aiBrain class, Which lets you control each player's aiBrain individually without affecting others. You can call GetBrain() on a player, and that will return the player's aiBrain instance.
What I dont get is: how is this class instanced for the player? How is it that a new aiBrain is created when you start a game?
Does local var = import('lua/sim/aiBrain.lua') make a new instance of aiBrain.lua?
I am trying to write a custom AI class instance that will coexist with the normal aiBrain.lua instance.
so when the aiBrain class is instanced, it calls its own OnCreate() function, which in turn instances a 'My custom ai.lua'.
Another blatant example is instances of a unit class on every unit in the game. unless I am mistaken.
Any answers? Any answer, from simple to complicated, I will apreciate
