What controls how the AI uses spells?

Mouthwash

Escaped Lunatic
Joined
Sep 26, 2011
Messages
9,368
Location
Hiding
I gave Stephanos an irresistible version of the Domination spell, but he refuses to use it (I confirmed that he has it by using the Stephanos unit in WB). I understand that the caster loses the ability to cast the original version if he is resisted, so maybe there's some reluctance coded in there? I assumed it was the <iAIWeight>, so I changed it to 500 (instead of 50). When that didn't work, I removed that line entirely, since other spells don't seem to have it. Nothing worked. Do I have to go in python or something?

EDIT: To be clear, I want him to use this ability every single turn it is available.
 
i know in coding you could use an if/then statement. so that when certain conditions (such as 2 or more enemies are near him) then he uses the spell. i dont know if that is true for civ 4. Though i do know that AI do have scripting
 
I don't know any of Civ4's/FFH2mods' various codes at all (only worked with Python a tiny bit), but in general the concepts of coding and coding/logic is this:

-----------------

@ The Crying Man

there's also giving a 'priority/weight rating' indicator/flag too, for an example:

do I save the hot girl or the ugly girl?

lower the value, the higher the priority
higher the value, the lower the priority

hot_girl.priority = 1
ugly_girl.priority = 2

if (hot_girl.priority <= ugly_girl.priority) {
-> hot_girl.save_her!
} else {
-> ugly_girl.save_her!
}
// you save the 'hot_girl'

VS

hot_girl.priority = 2
ugly_girl.priority = 1

if (hot_girl.priority <= ugly_girl.priority) {
-> hot_girl.save_her!
} else {
-> ugly_girl.save_her!
}
// you save the 'ugly_girl'

VS

hot_girl.priority = 1
ugly_girl.priority = 1

if (hot_girl.priority <= ugly_girl.priority) {
-> hot_girl.save_her!
} else {
-> ugly_girl.save_her!
}
// you save the 'hot_girl'

----------------------------------

or you could have the opposite too:

lower the value, lower the priority
higher the value, higher the priority

hot_girl.priority = 2
ugly_girl.priority = 1

if (hot_girl.priority >= ugly_girl.priority) {
-> hot_girl.save_her!
} else {
-> ugly_girl.save_her!
}
// you save the 'hot_girl'

VS

hot_girl.priority = 1
ugly_girl.priority = 2

if (hot_girl.priority >= ugly_girl.priority) {
-> hot_girl.save_her!
} else {
-> ugly_girl.save_her!
}
// you save the 'ugly_girl'

VS

hot_girl.priority = 1
ugly_girl.priority = 1

if (hot_girl.priority >= ugly_girl.priority) {
-> hot_girl.save_her!
} else {
-> ugly_girl.save_her!
}
// you save the 'hot_girl'

--------------------------------

@ Mouthwash:

maybe try changing the <iAIWeight> to 1 or 0 (or maybe even: -1), as maybe lower values have the greater priority, whereas your high value of 500 might have a lesser priority
 
Top Bottom