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 » Mon Oct 04, 2010 2:21 am

Here is the latest file. You should be able to play through all 3 battles. I still have one more for this series.

http://dl.dropbox.com/u/6754176/1003aJapan.zip

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

Post by Merr » Mon Oct 04, 2010 10:44 am

junk2drive wrote: I placed 3 flags on my map, 1 JA controlled, 2 US controlled, with your code. Every turn JA gets 2 points, maybe more. I changed the code by removing the + 3 - and every turn both sides get the same points no matter how many flags they control.
If both sides get the same points irregardless of flags owned, then why have points?

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

Post by Merr » Mon Oct 04, 2010 11:14 am

junk2drive wrote:I got it now. Each phase counts as a turn. That was posted around here somewhere. Each side starts with the points for each flag it holds. That goofed up my math too.
Indeed, it screwed up the math but it's all relative.

If you want the displayed points to read ... 1 point gain for each VP owned per turn ... then divide it by 2 ... example points_US /= 2 ;

Code: Select all

		points_US = GetGlobal("points0") ; 
		points_US /= 2 ;
		PrintStringLiteral("\n\n") ;
		PrintString("IDS_POINTS_US_COUNTER") ;
		PrintStringLiteral(": ") ;
		PrintInt(points_US) ;
		
		points_JA = GetGlobal("points1") ;
		points_JA /= 2 ;
		PrintStringLiteral("\n\n") ;
		PrintString("IDS_POINTS_JA_COUNTER") ;
		PrintStringLiteral(": ") ;
		PrintInt(points_JA) ;
However, turn 0 will start the US as 0, and JA will have 1 point.
To correct the math on turn0 ... add this to StartTurn(side) ...

Code: Select all

	if (GetTurn() == 0 ) 
	{
		SetGlobal("points1", - 1 )
	}
Now, it will start with both sides at 0, then add properly every turn afterwards ... now, this is all assuming at the start, that US has 1 flag and JA has 2
If the VictoryConditions are set to 50 ... then when the display reads 25 for either side, it will endbattle.

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

Post by junk2drive » Wed Oct 06, 2010 5:08 am

Close to complete. Latest file here

http://dl.dropbox.com/u/6754176/1005Japan.zip

Added
Sherman flame tank
JA assault squads
JA sniper
US sniper

4 battles total

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

Post by junk2drive » Tue Oct 12, 2010 2:42 pm

Added Kunai grass (elephant grass) cover 45%

Mod USart to 75mm lower ratings than 105mm.

Added
Jeep with MG
JA Ho Ni
SNLF units
JA SNLF light MG
SNLF light mortar mobile

Axis and Allies minefields, BN hq/XO, CO hq/XO, Plt hq

I think I will have ammo crates have rally ability for on map guns and mortars.

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

Post by junk2drive » Thu Oct 14, 2010 2:05 am

Pacific camp 2 is ready to playtest

http://dl.dropbox.com/u/6754176/Pacific_Campaign_2.zip

You command a company of US Army troops with Marine M3 light tanks in support. You will face Merr's minefields and snipers. Both will shoot you! You also get Merr's Commander units with Rally ability. They can rally themselves or suppressed units within range. See his thread for more details.

The original briefing from SPWAW
_____FLESH AND STEEL**
______July 16-18, 1943, 1943**
______Munda, New Georgia**
______For SPWAW Ver.7.1**
_______INTRODUCTION** If Guadalcanal on the southern end of the Solomons Island chain was a bad dream, New Georgia Island was a NIGHTMARE! US Army and Marine forces were dealing with a resolute Japanese enemy already shamed by their defeat on Guadalcanal.**Desperately trying to take Munda and its airfield, US Marine tanks combined efforts with GIs to penetrate tenacious Japanese defenses. It was the beginning of flesh and steel learning how to fight together effectively.**This series of battles portrays the actual historical events that took place during the hottest part of the summer in 1943.**
________YOUR ROLE**In this campaign you will take the role of a tank commander of the Marine 9th Defense Battalion, in support of US Army troops. It is recommended that use you use what few points you have to purchase as many M-3 Stuart tanks for that purpose.**The terrain is harsh, but you can get the job done. Breakdowns will happen occasionally. One important factor is that you must seek to avoid losses while attempting to take the objectives. Too many losses will cost you the campaign.**Remember, this is the Pacific, raw and harsh! Replacements will be rare. It will be one tough series of fights.**
__Campaign Design: Wild Bill Wilder and the Munda Test Team: Rick "Tankhead" Cloutier, Fabio "Tiger" Prado, Federico "Resisti" Doveri, Darwin "White Rook" Barnes, Bruce "Recon" Hodgman, Lars "DoomHippie" Beilecke, John "Primo" Graesser** _________bwilder@bellsouth.net*__________Wild Bill's Raiders

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

Post by junk2drive » Sat Oct 16, 2010 2:31 am

This includes Ammo Crates. There is no graphic as I used the object file. You can place the object over the unit to make it look better. They are immobile and unarmed. Use them to add to the unit killed count.
I found the graphic file.

My ammo crates are locking up the game. I think it is because I took an object and made it a unit. As long as you don't click on it, it works as a unit and can be destroyed. But if I click on it I can't click anything else and get a response. The unit icons don't reappear as if the game is trying to finish something. I can click the red x and I get the popup for do I want to surrender but after clicking the check mark the game just sits there.

I gave it rally and put it next to a gun. Let the gun take damage. Then rally the gun with the ammo crate. But then you can't click anything else. It also needs the s4f coded to explode and burn.

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

Post by Merr » Sat Oct 16, 2010 5:03 am

junk2drive,

Regarding the ammo crates ... I can't look so you'll have to tell me.

What type of unit are you calling the ammo crates? ie, tracked, wheel, artillery, infantry?
If it's infantry it won't "explode and burn". You don't need the s3f ... the unit type handles this in the code.
So, try a diifferent type, like artillery, then wheel then tracked.
Also, you will need a destroyed DDS so it will swap the texture when it's destroyed.
And, I assume you have the unit's TXT file? You may need to set the animation keyframes to start and end either at 0 or 1.

Just some hints to help you troubleshoot.

I was thinking of other concepts to model ammo crates ... such as ;
- When artillery unit adjacent to crate, it will boost the artillery Shots by 1 ... or
- If adjacent to crates, it will boost to normal Shots/turn, then, if ammo destroyed it will cause the
artillery unit to have a reduced Shot/turn simulating Low Ammo (conserving ammo).

Remember, there are a trillion ways to model something ... BA can do it, but just takes awhile to get the code right.

Merr

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

Post by junk2drive » Sat Oct 16, 2010 6:07 am

I took the crates.s4f from the objects folder and the 4 military_base dds's and put them in units and unit textures. I renamed crates to ammo_crates.s4f. I copied the US truck txt since it doesn't have any guns and renamed it. I added ammo_crates to my csv and text1. In the csv I made most everything 0 and it is artillery so that it can't move. At that point the ammo_crates could be put on the map and would sit there until something bumped into them and killed them. They turn black when destroyed. I tried clicking on one (not destroyed) to see what kind of orders popup it would have. It only shows a rotate symbol but does not rotate. At that point the game won't respond.

I then tried matching the csv numbers to your minefields. No change. I tried different units txt files to try to get the explosion and fire. At this point I thought that the problem must be related to the s4f needing animations or something.

I gave it rally because you made that, to simulate replenishing the gun. But I also though about the possibility of giving it another shot or two. I didn't think about it reducing an adjacent unit though.

These also got me thinking about splash damage, whereby when it blows up, it damages adjacent units, friendly or enemy.

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

Post by Merr » Sat Oct 16, 2010 7:17 am

junk2drive wrote:I tried clicking on one (not destroyed) to see what kind of orders popup it would have. It only shows a rotate symbol but does not rotate. At that point the game won't respond.
Ok ... it might lock because it's trying to run animation frames that don't exist ...
Try this ... open the ammo_crates.txt file ... make this change to read ;

[wait00]
FRM 0 0
//[wait00]
//FRM 35 105
//[wait01]
//FRM 110 145
//[wait02]
//FRM 150 170
//[wait03]
//FRM 175 255

Basically, I added one wait state from frames 0 to 0 ... then commented out (//) the others to remind us what the original wait values were. You don't need the other waits. You'll note that I did this in my "minefield.txt" file.

Since I can't test this you'll have to see if it works. It's the only thing I can think of right now.

Merr

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

Post by junk2drive » Sat Oct 16, 2010 1:11 pm

I replaced my text with yours. No change.

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

Post by Merr » Sun Oct 17, 2010 7:35 pm

junk2drive wrote:I replaced my text with yours. No change.
Sounds like the ammo crates doesn't have any animation frames ... I had this problem a few months ago when testing my minefields.

You know, try this ... Go into the Editor and delete your crate units. Then, change the asset for the crates (in the squadCSV) to use the Truck ... or simply start over and make your crates a Truck that is immobile (give it 1 AP so it can still rally). Basically, instead of ammo crates, you have a ammo truck.

As far as having it damage adjacent unit/tiles, that part has to be coded so when it dies it will use an HEAttack with a radius of 1 tile in all directions ... almost like a mortar attack.

Merr

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 7:51 pm

I like the truck idea. The crates look ok, but if they don't work... maybe someday I or someone will make better ones.

Thanks for your help.

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

Post by Merr » Sun Oct 17, 2010 8:07 pm

junk2drive wrote:I like the truck idea. The crates look ok, but if they don't work... maybe someday I or someone will make better ones.

Thanks for your help.
Yeah, I think having an ammo_truck will be best. This can lead to other concepts using the ammo_truck in future designs.

Such ideas that are similar to SPWAW, you know how their ammo supply vehicles work ... if adjacent it will refill the ammo for the unit ... In BA terms, this could add a +1 Shot/Turn or perhaps "refill" APCharges for infantry units that exhausted all their AntiArmor "bombs".

There are a million ways to model ammo_trucks, you'd have to find a concept that works best for your scenario.

Besides, I think the best way to use "ammo_dumps" is to code the data into the scenario where a building or "tent" at location (x,y) provides the bonus instead of having a static "unit" ... When the TileDamage reaches the max (255?) then it will cease to exist.

If you want, maybe PM Tim1966 and ask for a new basic box model with a few frames of animation using the correct DDS mapped to the right texture. From there you can fiddle around and cause your normal "mischief" like you always seem to get into to :wink:

Merr

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 9:09 pm

I deleted my ammo crates and pasted the trucks, then changed the name to ammo truck al and ax.

I gave them 1 shot, 20 AP, and Rally 1 Range 2

They have the rally icon but don't work.

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

Post by Merr » Sun Oct 17, 2010 9:17 pm

junk2drive wrote:I deleted my ammo crates and pasted the trucks, then changed the name to ammo truck al and ax.

I gave them 1 shot, 20 AP, and Rally 1 Range 2

They have the rally icon but don't work.
You can only "rally" another unit if the unit's morale is lower than it's base morale.

Is that what you mean by "don't work" ?

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 9:26 pm

I had a BN HQ retreat right next to it with 60 morale. The BN had the rally symbol but couldn't rally himself and the truck would not show the rally symbol nor does it state rally in the popup like it does on the BN.

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 10:15 pm

Found it.

Rally.bsf has blocking = 0

Now I just need to wait for you to write more nifty stuff.

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

Post by Merr » Sun Oct 17, 2010 11:32 pm

junk2drive wrote:Found it.

Rally.bsf has blocking = 0

Now I just need to wait for you to write more nifty stuff.
Ok, I see what you mean ... the truck won't rally ... so, lets add a condition to allow the new ammo truck to rally. Follow along with me to add the new code ...

Since we are in the RALLY.BSF, you already found the code about "blocking" in the FUNCTION CHECK_UNIT_RALLY.
Looks like this ... right?

Code: Select all

if ( GetAttrib(me, "Blocking") == 0 )
So, we'll add the OR condition, specifying the ammo_truck can also rally (assuming this is the unit type name) ....

Code: Select all

if ( (GetAttrib(me, "Blocking") == 0 ) || (IsUnitType(me,"ammo_truck") == 1 ) )
Let me know if this works ... Remember, I'm out of town so I'm unable to verify on my end.
Fill the "ammo_truck" entry with the name of your unit, ie ... "us_ammo_truck", or whatever.

Also, I have a question about your ZIP files ... I'm using my friends iMAC, that can read ZIP files but it's having trouble decompressing your ZIP files ... When I use ZIP on my WIN7, I use the default ZIP ... Are you using another ZIP program to zip your stuff up? No big deal ... I just can't view your Japan stuff on this iMAC.

Merr

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

Post by Merr » Sun Oct 17, 2010 11:42 pm

Also, for future use, if you want EVERY UNIT with the RallySkill to be able to rally, then change the original code to read ;

Code: Select all

if ( GetAttrib(me, "Blocking") >= 0 )
So, in this case, it doesn't matter if it has a blocking attribute or not, ie a value of 0 or 1.

Anyway, those are two ways to set conditions for the rally.
You see how easy it is to code stuff? Just read the function logic and add/remove conditions that suit your fancy :wink:

EDIT ... The third way to do it is to comment out (//) that entire IF condition, but you'll need to keep the other code within that IF condition active ... I won't explain that because I assume you know what I mean, but in any case it's "how-it-all-works".

Post Reply

Return to “Battle Academy : Modders Corner ”