Read squad file data directly from script

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
rf900
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 339
Joined: Fri May 04, 2012 6:59 am

Read squad file data directly from script

Post by rf900 » Tue Jul 09, 2013 9:28 am

Was wondering if there are functions to access the squad file data directly without the need of an existing unit in the map. For example I want to get the cost of a unit which has the ID=x in the file (not ingame).

pipfromslitherine
Site Admin
Site Admin
Posts: 9033
Joined: Wed Mar 23, 2005 10:35 pm

Re: Read squad file data directly from script

Post by pipfromslitherine » Mon Jul 15, 2013 4:42 pm

There isn't really any way to do this currently.

Cheers

Pip
follow me on Twitter here

enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: Read squad file data directly from script

Post by enric » Tue Jul 16, 2013 3:03 pm

I dont't know what are you trying to do but, you can place a unit out of map, get the cost, and remove the unit.

int id;
int cost;

PlaceUnit (10,10, 0, 0, 0, "cromwell") // place it out of boundaries
id = GetUnitOnTile(10, 10);
cost = GetUnitCost(id);
Log ("cost", id, cost); // check it
RemoveUnit(id, 1);

rf900
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 339
Joined: Fri May 04, 2012 6:59 am

Re: Read squad file data directly from script

Post by rf900 » Wed Jul 17, 2013 6:30 am

Yes, that is what I am doing right now. I basically wanted to avoid having to write the name of the units, for me it makes more sense to have a unique id per unit and use that as reference. That way you have more options to do random force deployment using indexes instead of strings, moreover as in the script there is no easy way to have string variables.

Post Reply

Return to “Battle Academy : Modders Corner ”