Solved Trapped Vehicles

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

Solved Trapped Vehicles

Post by Merr »

Pip,

I spent a week writing logic and testing and I finally got it!

How it works ....

First of all, I had to change the impassable terrain from 100 to 300 (I'll explain later).
Next, add more conditions for my modified PlaceUnit() function, as follows ;

(1) Search for a valid, unoccupied road tile, recorded as x2/y2.
- Since I have at least one road axis enabled in Amaris' map logic, it's bound to find one (roads are plentiful)
(2) Add the unit to the x2/y2 location... "AddUnit()".
(3) Run a "GetRouteCost()" from x2/y2 to the proposed x/y placement tile.
(4) If cost < 300, and cost != -1, then it's a good placement barring other conditions.
(5) If step #4 fails, search outwards to a predefined distance (which is half the mapheight value).
(6) If step #5 fails, then look for roadtiles using same procedure as step #4.

The reason why I had to do a "double-check" with (cost<300 @ cost!=-1) is because I felt that the "GetRouteCost" cheats and will find a route and not return a -1. Since the impassable terrain tile cost is 300, the "< 300" check ensures it doesn't pass through those tiles, and if it does, the cost will exceed 300 instantly. Using 300 also allows it to place it anywhere on the current map (generally the cost will be less than 200, but 300 ensured that) ... Using 100 wouldn't work, hence the reason why I boosted it to 300.

Overall, it works great! ... Game run after game run it's fool proof (or shall I say idiot proof). :P

Now I can wrap up the QuickBattles and release them soon.

Rob
Rosseau
Sergeant First Class - Panzer IIIL
Sergeant First Class - Panzer IIIL
Posts: 370
Joined: Sun Nov 15, 2009 5:27 am

Post by Rosseau »

We appreciate your work, Merr. BTW, what is the most recent Random Bonus scenario download? I think I have files dated 9/22 or something.

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

Post by Merr »

Rosseau wrote:We appreciate your work, Merr. BTW, what is the most recent Random Bonus scenario download? I think I have files dated 9/22 or something.
That's the latest from Merr_Skirmish_v1 ...

I started work on v1.1 and I'm up to v1.2 of that campaign but it's not finished yet ... I took some of that work and jumped to the QuickBattles campaign and polished it even more.

The QuickBattles for SOLO and MP are done.... thank goodness! They are indentical and I'm just running through some final checks and tweaks.

I almost released QuickBattles today ... but, I needed to tweak a few minor things and check for any rare issues.

I'm not going to add the Pz Grenadiers or the Hetzer in QuickBattles since they need more tweaks ... However, I activated the Sherman Rhino ... The Rhino isn't new and it's the same as the Sherman except for slight differences in AP/HE attacks (viewing the data in the CSV). The Rhino doesn't do anything in BA but it's possible to create some HedgeBusting action's for it but that's going to be a major challenge ... Since the hedge sits on the edge it's going to take a tweak to Amaris' map logic to ensure the hedge location concur's with the busting location ... There is also the possiblity of double hedges to deal with when two fields are adjacent ... argh .... etc, etc, etc.

Merr
Rosseau
Sergeant First Class - Panzer IIIL
Sergeant First Class - Panzer IIIL
Posts: 370
Joined: Sun Nov 15, 2009 5:27 am

Post by Rosseau »

Thanks for the update. I didn't want to miss anything. Looking forward to "Quick Battles." I had forgotten about that mod.

Lots of work, but when you finally find the solution, it's a great feeling.
Post Reply

Return to “Battle Academy : Modders Corner ”