Page 1 of 1

SERVICE.LUA --- Line-Of-Sight/Targetting Formulas?

Posted: Sat Jan 24, 2009 9:24 pm
by Mraah
I was poking around the lua's in the BASIS/SCRIPTS/AI folder and I came across the serviceLUA and this appears to contain formulas regarding line-of-sight and targeting. [&:]

One interesting line of code inside this file talks about the PSYCHO attribute (snipet below in quotes) ... Basically, from what I can tell, if your merc has the PSYCHO attribute and it meets one of those conditions (added up, all conditions =5/5 = 100%) then your merc will unleash a burst fire automatically (if you got the AP) [:D] .. note the last line that I hi-lighted in bold ...
selectFireMode = function(id, target, dist, strategy)
calls.enter("service.selectFireMode",id)
local aggro = 0
local phobia = string.upper(getPersonParameterStr(id, "PHOBIA"))
local hated_nation = string.upper(getPersonParameterStr(id, "HATED_NATIONALITY"))
local target_nation = string.upper(getPersonParameterStr(target, "NATIONALITY"))
local isRacist = string.upper(getPersonParameterStr(id, "RACIST"))
local race = string.upper(getPersonParameterStr(id, "RACE"))
local target_race = string.upper(getPersonParameterStr(target, "RACE"))
local isSexist = string.upper(getPersonParameterStr(id, "SEXIST"))
local sex = string.upper(getPersonParameterStr(id, "SEX"))
local target_sex = string.upper(getPersonParameterStr(target, "SEX"))

if(phobia == "PSYCHO") then
aggro = aggro + 2
log(id, "Äà ÿ ïðîñòî ïñèõ! Ìîå àãðî:", aggro)
end

if(hated_nation == target_nation) then
aggro = aggro + 1
log(id, "Äà ýòî æå äîëáàííûé", target_nation, "ß èõ íåíàâèæó! Ìîå àãðî:", aggro)
end

if((isRacist == "YES") and (race ~= target_race)) then
aggro = aggro + 1
log(id, "Äà îí æå äîëáàííûé", target_race, "ß èõ íåíàâèæó! Ìîå àãðî:", aggro)
end

if(((isSexist == "YES") or (isSexist == "VERY")) and (sex ~= target_sex)) then
aggro = aggro + 1
log(id, "ß æå ñåêñèñò! Ìîå àãðî:", aggro)
end

aggro = aggro / 5
local aggro_percent = math.floor(aggro * 100)
log(id, "Ïðîöåíò àãðî:", aggro_percent)
if(math.random() < aggro) then
setFiringType(id, "burst")

RE: SERVICE.LUA --- Line-Of-Sight/Targetting Formulas?

Posted: Tue Feb 17, 2009 11:28 pm
by SlickWilhelm
Nice find. Did you find any evidence of any of the other character traits affecting any behavior?