Japan

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

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

Post by junk2drive » Sun Oct 17, 2010 11:56 pm

Actually I already have it working by just changing the csv to 0 for blocking. I'd rather change my units to match your bsf's so that everyone has the same one's. If I was as good as you I would make it restore shots instead of morale. Maybe I will make a Medic truck for morale or men.

I use ZipGenius because it works well, can make a 7zip, opens rar files. I don't see why a Mac wouldn't open it. But what do I know about post Apple IIe stuff?

ZipGenius is freeware that I have used for years. You might check his website (Italy) and see if he says something about Macs.

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

Post by Merr » Mon Oct 18, 2010 12:32 am

junk2drive wrote:If I was as good as you I would make it restore shots instead of morale. Maybe I will make a Medic truck for morale or men.
Cool idea ... a Medic truck ... you can paint a new DDS with a red cross(+) ... then modify the "revive" chance to read 100%.

Tell you what ... I've got a few hours to walk you through on how to make your own "action_button" using the Rally.BSF as a template .... basically it's just changing the function names and adding/removing code to whatever you want!

Lets start some new threads, called "Shot Restore" and "Medic Truck". These can be quick tutorials so anybody can follow along and make there own buttons.

BTW, in your new scenarios you mentioned that you turned "OFF" the GainExperience in the "MoraleTools" , however, there are other places (BSF) where units will GainExperience, including my RallyBSF which has a 20% chance the Leader will gainXP. The best way to cover all the bases is to use the FIND feature and go through every BSF and search for GainExperience, then comment it out.

Merr

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

Post by junk2drive » Mon Oct 18, 2010 1:34 am

As long as you are not upsetting your host.

Where I get confused (well the whole thing is a foreign language) is where to nest things.

{
}

{
}

and all that...

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

Post by Merr » Mon Oct 18, 2010 2:32 am

junk2drive wrote:As long as you are not upsetting your host.
Try this out ... Make a copy of the RALLY.BSF file, call it AMMO.BSF ...
Then, open the $DEFAULT.BSF and add the include statement ... include "ammo.bsf"
Open the new file, Ammo.BSF, and delete all the code ...
Then, copy/paste this code in below ...
Note, anywhere that it reads "IDS_" you need to make a new entry in your text1 file.
Also, I used the old action button "action_rally"... you need to make a new button DDS later.
And, finally, I used the condition "IsUnitType" with "ammo_truck" ... change this to read the name of your ammo truck if it's different. The entry is in the FUNCTION CHECK_UNIT_AMMO .

I can't test this so let me know if it works ... I might not be able to fix it now but it's a start ...

Code: Select all


FUNCTION AmmoAttack (me, unit, tilex, tiley)
{
int men ;
int i ;
int ammo ;

	// total men (inc dead)
	men = GetUnitMen(unit) ;	
		
	for(i=0;i<men;i++)
	{
		if(GetUnitManDead(unit, i) == 0)
		{
			AddVizUnitTurnToFace(me, tilex, tiley, 0) ;
			AddVizCamUnit(unit) ;
			AddVizUnitText(unit, "IDS_UNIT_AMMO", "ffffff", 1) ;

			ammo = GetAttrib(unit, "Shots") + 3 ;
			 
			if (ammo > GetBaseAttrib(unit, "Shots") )
			{
				ammo = GetBaseAttrib(unit, "Shots") ;
			}

			SetAttrib(unit, "Shots", ammo) ;
			
			// drop out of loop
			i = men ;
		}		
	}	
}

FUNCTION SetAmmoString(me, tilex, tiley)
{
int unit ;

	StartString() ;
	PrintString("IDS_TT_AMMO") ;
	
	unit = GetUnitOnTile(tilex, tiley) ;
	
		if(GetUnitLOSToUnit(me, unit)==0)
		{
			PrintStringLiteral("\n") ;
			PrintString("IDS_NOLOS") ;
		}
		if(GetDistanceBetween(me, unit) > 1 )
		{
			PrintStringLiteral("\n") ;
			PrintString("IDS_OUTOFRANGE") ;
		}
}

FUNCTION UISETUP_UNIT_AMMO(me, tilex, tiley)
{

	SetAmmoString(me, tilex, tiley); 
	
	SetUITooltip() ;
	
	SetUITexture("action_rally", "ffffffff") ;
	// note, to use a different button like "action_ammo", you need to make a new DDS.
}

FUNCTION UIBUTTON_UNIT_AMMO(me, x,y,width, height, tilex, tiley)
{

	//RenderVCenteredString(x,y,width,height,10,1,"ff000000") ;
}	

FUNCTION Unit_AMMO(me, unit, tilex, tiley)
{
	AmmoAttack (me, unit, tilex, tiley) ;
	
	// use up all movement	
	SetAttrib (me, "AP", 0) ;	
}

FUNCTION CHECK_UNIT_AMMO(me, unit, tilex, tiley)
{
int ret ;
	
	ret = -2;

	if( (IsDeploying() != 1 ) && ( GetUnitDead(unit) == 0 ) && ( CheckArmourType (me, unit) == 0) )
	{
		// only allow on friendly units whose shots are < base & only allow if we are an Ammo Truck
		if ( ( GetUnitStatus ( me ) >= 0 ) && ( IsUnitType(me, "ammo_truck") == 1)  && ( GetUnitSide (me) == GetUnitSide(unit) ) && ( GetAttrib (unit, "shots") < GetBaseAttrib (unit, "shots") ) )
		{
			// only allow if it is infantry/mg/mortar
			if ( GetAttrib(me, "Blocking") == 0 )
			{
				// instead of hiding, only disable button if it is of the correct type and friend
				ret = -1 ;
				// only allow if we have not moved 
				if ( GetAttrib (me, "AP") >= GetBaseAttrib (me, "AP") )
				{
					if ( (GetUnitLOSToUnit(me, unit)==1) && (IsUnitSuppressed(me) == 0))
					{
						if(GetDistanceBetween(me, unit) <= 1 )
						{
							ret = 0 ;
						}
					}
				}
			}
		}
	}
	
	if(ret> -2)
	{
		SetAmmoString(me, tilex, tiley) ;
		AddTileTooltip() ;
	}
	
	return  ret ;
}
Merr

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

Post by junk2drive » Mon Oct 18, 2010 3:59 am

Try this out ... Make a copy of the RALLY.BSF file, call it AMMO.BSF ...

Opened Notepad++ and made AMMO.BSF

Then, open the $DEFAULT.BSF and add the include statement ... include "ammo.bsf"

Forgot this step

Open the new file, Ammo.BSF, and delete all the code ...
Then, copy/paste this code in below ...
Note, anywhere that it reads "IDS_" you need to make a new entry in your text1 file.

Did that

Also, I used the old action button "action_rally"... you need to make a new button DDS later.

Did that

And, finally, I used the condition "IsUnitType" with "ammo_truck" ... change this to read the name of your ammo truck if it's different. The entry is in the FUNCTION CHECK_UNIT_AMMO .

ammo_truck_al / I will need to add for ammo_truck_ax or will it look for ammo_truck ? wildcard * does that work?

I also added a column to my csv, Ammo and gave the trucks a 1

Finally got it working. Missing_IDS_unit_ammo

IDS_UNIT_AMMO, "More Ammo",
IDS_TT_AMMO, "More Ammo",
IDS_NOLOS
IDS_OUTOFRANGE

Need to remove turn toward unit, looks funny.

Thanks!!!!

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

Post by junk2drive » Mon Oct 18, 2010 5:11 am

Somehow the UNIT_AMMO started working.

Here is the latest with a test the icons battle.

http://dl.dropbox.com/u/6754176/1018Pac ... aign_2.zip

I made icons from shots of miniatures figures and setting view level to 10 and screenshoting.

The ammo trucks also can transport so that you can take a HQ with you for Rally.

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

Post by Merr » Mon Oct 18, 2010 7:31 pm

junk2drive wrote: I also added a column to my csv, Ammo and gave the trucks a 1
Ok ... since you did this then you can swap the IsUnitType code with the GetAttrib code, like this ;

Change this below ;

Code: Select all

( IsUnitType(me, "ammo_truck") == 1)
To read this ;

Code: Select all

( GetAttrib(me, "ammo") == 1)
So now, you don't need to specify a particular unit, you are now specifying any unit that has the "ammo" attribute set to a value of 1.
junk2drive wrote:IDS_NOLOS
IDS_OUTOFRANGE
Ok, you don't need these IDS_ above, these are already included by default, however, if you don't see anything unusual then leaving them in won't hurt.

Now, as you look at the whole code, you can see that tweaking this to fit your needs are simple ... tweaks can be like ;
- Costing a few AP to reload 1 Shot, so the truck can move and supply ammo on the run.

Also, this code can be quickly converted to a medic truck ... When I get back into town I'll have more time to explain how it all works in detail so you can eventually build your own stuff. I'll tell ya, once you start delv'ing into this you'll get bitten by the mod bug and you'll never get anything done in the real world :wink:

Merr

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

Post by junk2drive » Tue Oct 19, 2010 3:45 am

I've done a bit of modding.

I changed it to getattrib so that later if we get ammo crates and tents we don't have to make changes. I also thought that the ammo crates could be carried by any transport. Might be useful.

I like the idea of medic trucks and ammo trucks better than a bonus button because you have to think about how to use them and protect them. A good arty strike could wipe them out too.

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

What's This?

Post by junk2drive » Wed Oct 20, 2010 3:29 am

Image

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

Post by junk2drive » Mon Oct 25, 2010 3:34 am

I finished battle 3 of a 5 battle campaign.

Minefields and snipers make it risky. Mortars make it deadly.

Spent a lot of time today preventing units without Banzai from using it.

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

Post by junk2drive » Tue Oct 26, 2010 4:43 am

USMC units and icons (lower screen)

Image

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

Zero

Post by junk2drive » Wed Oct 27, 2010 4:41 am

tora tora tora

Image

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

Post by junk2drive » Sun Oct 31, 2010 10:39 pm

Before

Image

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

Post by junk2drive » Sun Oct 31, 2010 10:41 pm

After thanks to tim

Image

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

Post by junk2drive » Mon Nov 01, 2010 9:50 pm

Added G4M "Betty" off map bonus using B26.

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

Post by junk2drive » Sat Nov 06, 2010 12:54 am

I received another "gift" from tim1966, a well done early war Chi Ha

I can't wait to see what else he gives to the community. Thanks tim

Image

TankerOne
Sergeant - Panzer IIC
Sergeant - Panzer IIC
Posts: 183
Joined: Sat Apr 15, 2017 3:30 pm

Re: Japan

Post by TankerOne » Wed Jan 08, 2020 8:30 am

I am on a roll digging up old stuff. Any ZIP? If I get one, I think the Soviets and Japanese might have a small battle

Paul59
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2223
Joined: Tue Jul 21, 2015 11:26 pm

Re: Japan

Post by Paul59 » Sat Jan 11, 2020 9:10 am

TankerOne wrote:
Wed Jan 08, 2020 8:30 am
I am on a roll digging up old stuff. Any ZIP? If I get one, I think the Soviets and Japanese might have a small battle
Hold fire on that TankerOne.

I will be releasing a new Skirmish Mod soon for Japan v Soviets using all these old modded Japanese units. They needed quite a lot modding to get them working properly in BA2, as these old BA Pacific war mods were quite different to a normal BA2 game.
Field of Glory 2 Scenario Designer - Age of Belisarius, Rise of Persia, and Wolves at the Gate.

TT Mod Creator

DatMoff
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 91
Joined: Mon Jun 25, 2018 4:29 am

Re: Japan

Post by DatMoff » Tue Jan 28, 2020 2:13 am

Paul59 wrote:
Sat Jan 11, 2020 9:10 am
TankerOne wrote:
Wed Jan 08, 2020 8:30 am
I am on a roll digging up old stuff. Any ZIP? If I get one, I think the Soviets and Japanese might have a small battle
Hold fire on that TankerOne.

I will be releasing a new Skirmish Mod soon for Japan v Soviets using all these old modded Japanese units. They needed quite a lot modding to get them working properly in BA2, as these old BA Pacific war mods were quite different to a normal BA2 game.
Will you be doing Khalkin Gol or the Soviet Invasion of Manchuria? Either way I'd find it interesting to see a campaign based on Japan vs Soviets. You rarely get to hear about the combat between the Russians and Japanese during the war.

Paul59
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2223
Joined: Tue Jul 21, 2015 11:26 pm

Re: Japan

Post by Paul59 » Tue Jan 28, 2020 8:11 am

DatMoff wrote:
Tue Jan 28, 2020 2:13 am
Paul59 wrote:
Sat Jan 11, 2020 9:10 am
TankerOne wrote:
Wed Jan 08, 2020 8:30 am
I am on a roll digging up old stuff. Any ZIP? If I get one, I think the Soviets and Japanese might have a small battle
Hold fire on that TankerOne.

I will be releasing a new Skirmish Mod soon for Japan v Soviets using all these old modded Japanese units. They needed quite a lot modding to get them working properly in BA2, as these old BA Pacific war mods were quite different to a normal BA2 game.
Will you be doing Khalkin Gol or the Soviet Invasion of Manchuria? Either way I'd find it interesting to see a campaign based on Japan vs Soviets. You rarely get to hear about the combat between the Russians and Japanese during the war.
The Skirmish mod allows you to generate random battles from both 1939 and 1945, although the Japanese army of 1945 is seriously outclassed by the Soviets. It should be ready to be released very soon.
Field of Glory 2 Scenario Designer - Age of Belisarius, Rise of Persia, and Wolves at the Gate.

TT Mod Creator

Post Reply

Return to “Battle Academy : Modders Corner ”