Page 1 of 1

Surrender and Banzai!

Posted: Fri Oct 22, 2010 9:31 pm
by Merr
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).

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) ;
			}			
		}
	}
}

Posted: Fri Oct 22, 2010 9:47 pm
by junk2drive
Sounds like that would work for human wave with the Soviets also.

I'll play around with it.

Posted: Fri Oct 22, 2010 10:34 pm
by Merr
j2j,

Also, note that the code is in the TICK, meaning it happens right now, not at the start of the next turn.

If you want to tweak more, add this code only to the StartTurn ... Then, at the beginning of every sides turn, it will reset the morale to 50. This might be more "Marine Friendly" because it will give the US a chance to suppress a unit during the players turn before it jumps back to 50 on the AI's next turn.

And, finally, you can tweak the values for "GetAttrib" and SetAtrrib" .... examples ;

GetAttrib < 100, SetAttrib 100 ... will never drop below 100
GetAttrib < GetBaseAttrib, SetAttrib to GetBaseAttrib ... will never drop below the units base morale (ie, it will never drop at all!)
GetAttrib < 0, SetAttrib 200 ... when it drops below 0 it will boost it to 200 !!! ouch.

Just some hints, ideas. I know you know but I'd thought I'd let you know :wink:

Merr

Posted: Fri Oct 22, 2010 10:46 pm
by junk2drive
There is plenty that I don't know. And some of what you tell me takes a while to sink in.

Posted: Sat Oct 23, 2010 3:22 am
by junk2drive
I found a banzai voice sound in JTCS Rising Sun but audacity isn't playing nice to convert the ogg to wav with 16khz.

Posted: Sat Oct 23, 2010 2:44 pm
by junk2drive
I think I have the banzai wav fixed.

What I think we want is an action like assault that gives a bonus. Maybe increase HE_Assaultskill and AP_Assaultskill. When you assault the enemy, the banzai wav plays.

The first part of your first post is more in line with a charge command or human wave.

Japanese units should not surrender so we need something for that.

Edit: I made an action icon, the assault icon with a sword.

Posted: Sat Oct 23, 2010 3:40 pm
by junk2drive
Instead of never suppressed >50 I'd rather have a never surrender >0

So the tick would be

if ( GetAttrib (id, "morale") < 0 )
{
SetAttrib (id, "morale", 0) ;

Or a number higher than 0 but lower than 50.

I found this in Assault script

// prevent a unit who wins an assault from getting suppressed
if ( GetAttrib(me, "Morale") < 51 )
{
SetAttrib (me, "Morale", 51 ) ;

Posted: Sat Oct 23, 2010 5:07 pm
by junk2drive
Spent the last couple of hours staring at the Assault.bsf and finally figured out the chance of success comes from the CombatTools.bsf AssaultSuccessChance.

I'm thinking that

chance of success = AssaultSuccessChance *= number

would be the best way to increase the chance with banzai.

Can I use a decimal number like .25? Or do I have to do 100/400?

Edit: I figured out it to be *100/75 for a 25% increase. Now, where to plug it in?

Posted: Sat Oct 23, 2010 6:08 pm
by shawnt63
J2D, I think this is an awesome addition to your Japanese Theatre of Ops! Will really enhance the play!

Posted: Sat Oct 23, 2010 6:26 pm
by junk2drive
Thanks

I got Banzai to work in game. You get both the assault action and the banzai action icons.

Now I have to figure out how to multiply the percent chance for banzai to make it more than assault.

Posted: Sat Oct 23, 2010 7:25 pm
by junk2drive
Got sound, BANZAI!

Posted: Sat Oct 23, 2010 7:56 pm
by junk2drive
TADAAAA!

*125 is same as 100/75 for math whiz like me. Had to add the function from CombatTools to the Banzai script, change AssaultSuccessChance to BanzaiSuccessChance and chance of success *=100 to *=125

Done!

Japanese Infantry and HQs have 100 assault. For open ground it shows 86% for assault and 107% for Banzai. Click the banzai icon and the sound of banzai and charging troops plays along with combat sounds.

Posted: Sun Oct 24, 2010 7:23 am
by Merr
Ok ... cool ... you made an ICON, and changed the code. 8)
Now ... that's all fine and dandy for the HUMAN player ... now you'll have to get the AI to use BANZAI instead of the regular assault.

For that to work .... you'll need to add code to the AITools :shock:
OR ... depending on "how" you made your banzai changes, you can do it another way.

I'll stay tuned in ... I'm gald to see you figuring this stuff out on your own!

Posted: Sun Oct 24, 2010 11:52 am
by junk2drive
In hindsight a bonus might have been better than an attack type so that the player can't use it every time. Bonus looks harder to make. Either way the AI has to be helped to use it. Maybe replacing assault with banzai is the way to go.

I was pretty excited to get a new sound to work.

The "no surrender" for the Japanese needs to be global. I'll have to think about that more.