ok, so reading through a few files after reading the docs, and most of it seems fairly straight forward (that said does anybody have a link to a lua editor that supports astyle or other lua code formatting to fix the formatting of a few files/sections).
i see this
-- LUA Script - precede every function and global member with lowercase name of script
at the top of every file, i assume this has something to do with conflicts, as well as knowing where globals are defined and initialised.
yet as soon as i start looking into how the AI works, this rule is violated left right and center
--ai_soldier.lua
-- globals for AI enemies
ai_newdest_time = {}
ai_cover_on = {}
-- init when level first runs
function ai_soldier_init(e)
ai_soldier_state[e] = "patrol";
ai_soldier_pathindex[e] = -1;
ai_start_x[e] = nil
ai_starting_heath[e] = nil
ai_ran_to_cover[e] = 0
ModulateSpeed(e,1.0)
ai_old_health[e] = 0
CharacterControlStand(e)
ai_returning_home[e] = 0
ai_newdest_time[e] = -1
ai_cover_on[e] = 0
ai_alerted_spoken[e] = 0
--SetCharacterSound(e,"soldier")
SetCharacterSoundSet(e)
end
-- ai_cover.lua
-- init when level first runs
function ai_cover_init(e)
ai_soldier_state[e] = "hiding";
ai_soldier_pathindex[e] = -1;
ai_start_x[e] = nil
ai_starting_heath[e] = nil
ModulateSpeed(e,1.0)
CharacterControlArmed(e)
CharacterControlDucked(e)
LockCharacterPosition(e)
Include("ai_soldier.lua")
end
Also most of these possibly all are created but not initialised (not sure how lua manages memory) in global.lua. I also notice that only 3 out of the more thna a dozen or so ai scripts are copies to my standalone sample (using mountain stroll as my test base for the time being btw) so not entirely sure whether this apparent violation of the rule is valid because of declaration in global.lua or because its a 'core' script and the rules are only for new/user scripts.
either way i'm a little confused so i defo could use some clarification if only for my own sanity