Random map adding a new map type

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
Sabratha
SPM Contributor
SPM Contributor
Posts: 536
Joined: Thu Jan 05, 2012 2:39 am

Random map adding a new map type

Post by Sabratha »

I designed a pretty simple new map type - south russian steppe (much tall grass, no tres). I tested it by replacing the MapGenerateWild.BSF with my own steppe modified version and it works fine.

I just wonder is it possible to add it as a 4th new map type to be recognized by skirmish and editor? Which files should be modified?
pipfromslitherine
Site Admin
Site Admin
Posts: 9701
Joined: Wed Mar 23, 2005 10:35 pm

Re: Random map adding a new map type

Post by pipfromslitherine »

The next update moves some of the files around so it is possible to make custom campaigns which have custom map generation scripts (as can already be done with Pike&Shot). Adding a new type is then done by having appropriate IDS_SKIRMISH_MAP_TYPE_<number> entries in your strings file. The numbering starts at zero and the type value for the scripts matches the index of the selected type.

Hope that makes sense! The next update should be very soon.

Cheers

Pip
follow me on Twitter here
Sabratha
SPM Contributor
SPM Contributor
Posts: 536
Joined: Thu Jan 05, 2012 2:39 am

Re: Random map adding a new map type

Post by Sabratha »

pipfromslitherine wrote:The next update moves some of the files around so it is possible to make custom campaigns which have custom map generation scripts (as can already be done with Pike&Shot). Adding a new type is then done by having appropriate IDS_SKIRMISH_MAP_TYPE_<number> entries in your strings file. The numbering starts at zero and the type value for the scripts matches the index of the selected type.

Hope that makes sense! The next update should be very soon.

Cheers

Pip
Glad to hear it, looking forward to the patch.

That is a good side of BA and P&S using the same engine, modding experience of one game can be used for the other.
Sabratha
SPM Contributor
SPM Contributor
Posts: 536
Joined: Thu Jan 05, 2012 2:39 am

Re: Random map adding a new map type

Post by Sabratha »

Is this functional now?
pipfromslitherine
Site Admin
Site Admin
Posts: 9701
Joined: Wed Mar 23, 2005 10:35 pm

Re: Random map adding a new map type

Post by pipfromslitherine »

Should work in the latest version.

Cheers

Pip
follow me on Twitter here
Brummbar44
2nd Lieutenant - Panzer IVF/2
2nd Lieutenant - Panzer IVF/2
Posts: 689
Joined: Sun Oct 16, 2011 3:53 pm
Location: Canada
Contact:

Re: Random map adding a new map type

Post by Brummbar44 »

pipfromslitherine wrote:Adding a new type is then done by having appropriate IDS_SKIRMISH_MAP_TYPE_<number> entries in your strings file. The numbering starts at zero and the type value for the scripts matches the index of the selected type.
Can this be done for multiplayer? If so, how can we create new random map types?

Please advise, I think this would be a great addition to the League.

Thanks.
pipfromslitherine
Site Admin
Site Admin
Posts: 9701
Joined: Wed Mar 23, 2005 10:35 pm

Re: Random map adding a new map type

Post by pipfromslitherine »

The new map type needs to be handled in the custom random map generation script, the UI allows you to choose a new type if the string exists to describe it.

Cheers

Pip
follow me on Twitter here
Brummbar44
2nd Lieutenant - Panzer IVF/2
2nd Lieutenant - Panzer IVF/2
Posts: 689
Joined: Sun Oct 16, 2011 3:53 pm
Location: Canada
Contact:

Re: Random map adding a new map type

Post by Brummbar44 »

pipfromslitherine wrote:The new map type needs to be handled in the custom random map generation script, the UI allows you to choose a new type if the string exists to describe it.

Cheers

Pip
Thanks Pip,

Please hold my hand! Not sure what any of that means. Where do I find the "custom random map generation script"?
pipfromslitherine
Site Admin
Site Admin
Posts: 9701
Joined: Wed Mar 23, 2005 10:35 pm

Re: Random map adding a new map type

Post by pipfromslitherine »

I'll be honest, it is quite complex. Basically (and bear in mind I have never done this, RBS is the real expert) you need to:

1 - add the string (as above IDS_SKIRMISH_MAP_TYPE) this will cause the UI to show it as a type you can choose.
2 - copy DATA/BATTLE/SCRIPTS/MAPGENERATE2.BSF into the DATA/BATTLE/SCRIPTS folder in your custom campaign.
3 - add script to your new file which utilises your new type (in RandomMap_Build you will see the 3 main checks, one for each of the existing types, which calls out to the different map type scripts).

You can of course copy one of these type scripts and use it as a starting point for your own script. Note that (IIRC) you can see/test your new scripts in the editor if you select the appropriate campaign to edit.

Hope that helps at least let you have a look at the task!

Cheers

Pip
follow me on Twitter here
Brummbar44
2nd Lieutenant - Panzer IVF/2
2nd Lieutenant - Panzer IVF/2
Posts: 689
Joined: Sun Oct 16, 2011 3:53 pm
Location: Canada
Contact:

Re: Random map adding a new map type

Post by Brummbar44 »

Wow! Thanks Pip.

I'll have a look (and no doubt more questions)...but to be clear, this is theoretically doable for multiplayer Skirmishes correct?
pipfromslitherine
Site Admin
Site Admin
Posts: 9701
Joined: Wed Mar 23, 2005 10:35 pm

Re: Random map adding a new map type

Post by pipfromslitherine »

Yes - although the BA2 codebase is significantly behind the P&S etc one and so we could well run into a bug which stops us dead, but I guess try something simple first to just see if the framework works correctly.

Cheers

Pip
follow me on Twitter here
Post Reply

Return to “Battle Academy 2: Modders Corner”