Surrender and Banzai!
Posted: Fri Oct 22, 2010 9:31 pm
junk2drive,
I've looked at ways to do a banzai attack but it really depends on how you (designer) want to model it.
For example, using the StartTurn function, you can specify a turn that forces all the Japanese units to change teams and "seek and destroy" and head towards an AIpoint. I've been slowly working on a "Banzai-On-The-Fly" code that basically forces a Japanese unit to go "berserk" (as it were) when the units morale drops below zero, then, it will use the AI's targeting code to run towards the best target. It will still take quite some code changes for the AI to get it all to work. Then, once they go Banzai, I will have to write code to determine when they stop! I can't say I will every get it to work ... I play around with the code every now and then.
Anyway, I did write a little script that you can try out ... The script below is added to the FUNCTION Tick(side).
As you can see, when a unit for side(1) has it's morale drop below 50 it will reset it back to 50 (the unit will never be suppressed)
But, since it quickly dropped below 50 you will still see the text "suppressed" along with the voice, however, you'll note that the unit isn't really suppressed.
Now, you can change the code to read 0 instead ... this will prevent the unit from surrendering (ie, dropping below 0).
I've looked at ways to do a banzai attack but it really depends on how you (designer) want to model it.
For example, using the StartTurn function, you can specify a turn that forces all the Japanese units to change teams and "seek and destroy" and head towards an AIpoint. I've been slowly working on a "Banzai-On-The-Fly" code that basically forces a Japanese unit to go "berserk" (as it were) when the units morale drops below zero, then, it will use the AI's targeting code to run towards the best target. It will still take quite some code changes for the AI to get it all to work. Then, once they go Banzai, I will have to write code to determine when they stop! I can't say I will every get it to work ... I play around with the code every now and then.
Anyway, I did write a little script that you can try out ... The script below is added to the FUNCTION Tick(side).
As you can see, when a unit for side(1) has it's morale drop below 50 it will reset it back to 50 (the unit will never be suppressed)
But, since it quickly dropped below 50 you will still see the text "suppressed" along with the voice, however, you'll note that the unit isn't really suppressed.
Now, you can change the code to read 0 instead ... this will prevent the unit from surrendering (ie, dropping below 0).
Code: Select all
FUNCTION Tick(side)
{
int id ;
int i ;
if( GetTurn() >= -1 )
{
for(i=0; i<GetUnitCount(1); i++)
{
id = GetUnitID(1, i) ;
if ( GetAttrib (id, "morale") < 50 )
{
SetAttrib (id, "morale", 50) ;
}
}
}
}