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

Post your mods for Hired Guns here.
Post Reply
Mraah
Posts: 1085
Joined: Wed Feb 20, 2008 6:11 am

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

Post 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")
User avatar
SlickWilhelm
Posts: 1854
Joined: Sun Jul 22, 2007 1:52 pm
Location: Rochester, MN

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

Post by SlickWilhelm »

Nice find. Did you find any evidence of any of the other character traits affecting any behavior?
Beta Tester - Brother Against Brother
Beta Tester - Commander: The Great War
Beta Tester - Desert War 1940-42
Post Reply

Return to “Mods”