I see. However, I think this is good pretty much only If I have one main loop, no?
Say I have 4 ais that benefit from the script. Say my script has a 'strategy' variable. With the unit or entity technique I know i can have access to the 'strategy' of that particulars player from itself without having, say, a main loop that does
- Code: Select all
Exampleloop = function(self)
CurPlayer = 0
NbPlayer = 4
For CurPlayer < NbPlayer do
army = GetArmyIndex(CurPlayer)
army:DoSomeFunction()
end
--OR
Players = GetAllPlayersInGame
For i, p in players do
brain = GetaiBrain(player)
brain:DoSomething()
end
end,
Edit: this has to do with my question of yesterday. Since I dont understand how a class is instanciated in supcom (like the aiBrain being one instance Per player) So I do not know how to instanciate my CleverAI class the same way as an aiBrain. I would need a function like CreateaiBrain() but CreateCleverAI()
Edit2: I DO know however that If I CreateUnitHPR(), this will make an Instance of that unit. I can sadly not find any logical function that does CreateInstanceOfClass or CreateInstanceOfScript etc