Surrender and Banzai!

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Surrender and Banzai!

Post 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) ;
			}			
		}
	}
}
junk2drive
BA Moderator
BA Moderator
Posts: 1478
Joined: Sun May 23, 2010 4:47 pm
Location: Arizona USA -7GMT

Post by junk2drive »

Sounds like that would work for human wave with the Soviets also.

I'll play around with it.
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post 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
junk2drive
BA Moderator
BA Moderator
Posts: 1478
Joined: Sun May 23, 2010 4:47 pm
Location: Arizona USA -7GMT

Post by junk2drive »

There is plenty that I don't know. And some of what you tell me takes a while to sink in.
junk2drive
BA Moderator
BA Moderator
Posts: 1478
Joined: Sun May 23, 2010 4:47 pm
Location: Arizona USA -7GMT

Post 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.
junk2drive
BA Moderator
BA Moderator
Posts: 1478
Joined: Sun May 23, 2010 4:47 pm
Location: Arizona USA -7GMT

Post 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.
junk2drive
BA Moderator
BA Moderator
Posts: 1478
Joined: Sun May 23, 2010 4:47 pm
Location: Arizona USA -7GMT

Post 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 ) ;
junk2drive
BA Moderator
BA Moderator
Posts: 1478
Joined: Sun May 23, 2010 4:47 pm
Location: Arizona USA -7GMT

Post 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?
Last edited by junk2drive on Sat Oct 23, 2010 6:27 pm, edited 1 time in total.
shawnt63
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 127
Joined: Thu May 27, 2010 11:55 pm

Post by shawnt63 »

J2D, I think this is an awesome addition to your Japanese Theatre of Ops! Will really enhance the play!
junk2drive
BA Moderator
BA Moderator
Posts: 1478
Joined: Sun May 23, 2010 4:47 pm
Location: Arizona USA -7GMT

Post 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.
junk2drive
BA Moderator
BA Moderator
Posts: 1478
Joined: Sun May 23, 2010 4:47 pm
Location: Arizona USA -7GMT

Post by junk2drive »

Got sound, BANZAI!
junk2drive
BA Moderator
BA Moderator
Posts: 1478
Joined: Sun May 23, 2010 4:47 pm
Location: Arizona USA -7GMT

Post 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.
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post 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!
junk2drive
BA Moderator
BA Moderator
Posts: 1478
Joined: Sun May 23, 2010 4:47 pm
Location: Arizona USA -7GMT

Post 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.
Post Reply

Return to “Battle Academy : Modders Corner ”