AI TOOLS ... Is AI modding switch off in the engine?
Posted: Sat Aug 21, 2010 8:23 pm
Pip, (or adherbal)
I've been trying to troubleshoot this for awhile ...
I see that the AI.BSF files goes into the my_campaign/AI folder ... ok.
Now, the script I'm tweaking is in the AITools.bsf ... well, that folder is only in the main directory and it's a no-no to tweak that ... ok.
So, I copy the script over to the AI.bsf but I have to rename the Function for duplicate problems. That's not good because I need to "add" code to a function, not create a new function.
The comments at the top of the AITools reads ;
// works in conjunction with mission scripting, Mission scripting overrides this so static units will nto advance and fire.
// called for every unit, multiple times. It gets called every time the AI does something. E.g. If it spots a new unit, if it comes under attack. See AI.bsf for details.
Ok, I've tried this in mission scripting inside my units bsf .... no luck.
Basically, I've tried a bunch of stuff but here are the details on what I'm doing ....
In the AITools.bsf there is a function ... FUNCTION AI_DoAttack(side, team, me, target)
For my new Sharpshooter unit I want the AI German_Sniper to use SNIPERSHOT when attacking ... code added before other conditions to ensure priority ;
The code works fine (no errors). My unit has the SHARPSHOOTER ability (basically the SniperShot but can be used at experience level 0) ... so everything should work ... in theory, but doesn't. The AI Sniper will always use HE fire.
I feel like the AI modding switch is turned off not recognizing the AI folder or any AI changes.
Any ideas?
Rob
EDIT : I saw the comment //Log ("firing HE ", me, unit ) ;
.... so I'm thinking ... do I have to create a Log? ... somewhere? I'm thinking NOT at the same time since the fire=1 is also use for AP and all it's doing is returning a value of 1 to satsify the function.
I've been trying to troubleshoot this for awhile ...
I see that the AI.BSF files goes into the my_campaign/AI folder ... ok.
Now, the script I'm tweaking is in the AITools.bsf ... well, that folder is only in the main directory and it's a no-no to tweak that ... ok.
So, I copy the script over to the AI.bsf but I have to rename the Function for duplicate problems. That's not good because I need to "add" code to a function, not create a new function.
The comments at the top of the AITools reads ;
// works in conjunction with mission scripting, Mission scripting overrides this so static units will nto advance and fire.
// called for every unit, multiple times. It gets called every time the AI does something. E.g. If it spots a new unit, if it comes under attack. See AI.bsf for details.
Ok, I've tried this in mission scripting inside my units bsf .... no luck.
Basically, I've tried a bunch of stuff but here are the details on what I'm doing ....
In the AITools.bsf there is a function ... FUNCTION AI_DoAttack(side, team, me, target)
For my new Sharpshooter unit I want the AI German_Sniper to use SNIPERSHOT when attacking ... code added before other conditions to ensure priority ;
Code: Select all
if(canFire != 0)
{
if( GetAttrib(me, "Sharpshooter") == 1 )
{
canFire = CallUnitFunctionDirect(me, "CHECK_UNIT_SHARPSHOOTER", me, GetUnitX(target), GetUnitY(target), target) ;
//Log ("canFire", canFire) ;
if ( canFire == 0 )
{
ClearUnitDestination(me) ;
// fire HE...
CallUnitFunctionDirect(me, "UNIT_SHARPSHOOTER", me, GetUnitX(target), GetUnitY(target)) ;
//Log ("firing HE ", me, unit ) ;
fire = 1 ;
}
}
}
I feel like the AI modding switch is turned off not recognizing the AI folder or any AI changes.
Any ideas?
Rob
EDIT : I saw the comment //Log ("firing HE ", me, unit ) ;
.... so I'm thinking ... do I have to create a Log? ... somewhere? I'm thinking NOT at the same time since the fire=1 is also use for AP and all it's doing is returning a value of 1 to satsify the function.