Fixing Units

Moderators: rbodleyscott, Slitherine Core, Gothic Labs

Post Reply
Paul59
General - King Tiger
General - King Tiger
Posts: 3803
Joined: Tue Jul 21, 2015 11:26 pm

Fixing Units

Post by Paul59 »

Hi guys,

I want to fix in place the AI team 2, until turn 6. What code do I put into the .bsf file?

Many thanks!


Paul
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28014
Joined: Sun Dec 04, 2005 6:25 pm

Re: Fixing Units

Post by rbodleyscott »

Paul59 wrote:Hi guys,

I want to fix in place the AI team 2, until turn 6. What code do I put into the .bsf file?

Many thanks!


Paul
Internally, AI turns are numbered 1,3,5,7,8,11, so their 6th turn is turn 11

Code: Select all

if (side == 1)
  {
    if (GetTurn() < 11)
    {
        MoveTeamCoord(1,2,-1,-1,64);
    }
}
in StartTurnPost().

64 will stop them doing any moves except turning to face nearby enemy.

Change the 64 to 8 if you want them to react normally to enemy who come close (including charging them if appropriate), 136 if you want them to react only to non-light enemy.
Richard Bodley Scott

Image
Paul59
General - King Tiger
General - King Tiger
Posts: 3803
Joined: Tue Jul 21, 2015 11:26 pm

Re: Fixing Units

Post by Paul59 »

Thanks Richard,

That worked a treat!

Cheers


Paul
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
Paul59
General - King Tiger
General - King Tiger
Posts: 3803
Joined: Tue Jul 21, 2015 11:26 pm

Re: Fixing Units

Post by Paul59 »

Hi Richard,

I also need to know how to fix Player Team 1 indefinitely. I tied to do it by adapting the code given above, but I cannot get it to work. It might be because I have switched sides for this scenario, and that always seems to cause problems.


Cheers
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28014
Joined: Sun Dec 04, 2005 6:25 pm

Re: Fixing Units

Post by rbodleyscott »

Paul59 wrote:Hi Richard,

I also need to know how to fix Player Team 1 indefinitely. I tied to do it by adapting the code given above, but I cannot get it to work. It might be because I have switched sides for this scenario, and that always seems to cause problems.


Cheers
You can't fix player teams like this. They don't use AI code to move, so giving them the 64 "aggression" order has no effect.

You can simply give them 0 AP each turn if you like, which would allow them to turn 45 degrees but do nothing else. Or you could allow the player no control of them whatsoever, as I did for the Saxons in the First Battle of Breitenfeld scenario.

If you tell me what exactly you are trying to achieve, I may be able to give you a snippet of code to do it.
Richard Bodley Scott

Image
Paul59
General - King Tiger
General - King Tiger
Posts: 3803
Joined: Tue Jul 21, 2015 11:26 pm

Re: Fixing Units

Post by Paul59 »

Thanks Richard,

The 0 AP option will work just fine I think.


regards

Paul
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28014
Joined: Sun Dec 04, 2005 6:25 pm

Re: Fixing Units

Post by rbodleyscott »

Paul59 wrote:Thanks Richard,

The 0 AP option will work just fine I think.


regards

Paul
Can you figure out how to do that yourself or need a snippet of code from me?
Richard Bodley Scott

Image
Paul59
General - King Tiger
General - King Tiger
Posts: 3803
Joined: Tue Jul 21, 2015 11:26 pm

Re: Fixing Units

Post by Paul59 »

You mean put a zero in column O of the Squads.csv file, right? I am very happy modifying that file, its this all coding in the .bsf files that I have no clue about!
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28014
Joined: Sun Dec 04, 2005 6:25 pm

Re: Fixing Units

Post by rbodleyscott »

Paul59 wrote:You mean put a zero in column O of the Squads.csv file, right? I am very happy modifying that file, its this all coding in the .bsf files that I have no clue about!
Well it is a bit of a hack, but if it does the job for you, fine.
Richard Bodley Scott

Image
Paul59
General - King Tiger
General - King Tiger
Posts: 3803
Joined: Tue Jul 21, 2015 11:26 pm

Re: Fixing Units

Post by Paul59 »

Paul59 wrote:Thanks Richard,

That worked a treat!

Cheers


Paul
Actually, it worked once, and then I made changes to the scenario and I have been unable to get it to work since!

I am working on another scenario now, and currently I can get the script to stop the team from advancing, but they never get released.

I have fiddled with the code endlessly, and this is what I have got at the moment;

FUNCTION StartTurnPost(side)
{
// Scenario-specific AI code goes here - you can look at some of the historical scenarios for examples.
if (side == 1)
{
if (GetTurn() < 3)
{
MoveTeamCoord(1,1,-1,-1,8);
}
// AI_Masterplan() can be used to provide automated AI for encounter battles where Side 0 is on the left side of the map and Side 1 is on the right side of the map.
// Be warned that it may not cope well with unusual AI deployments.
// If used, PreBattleSetup() must include AI_ReassignTeams(1);
// The parameter is the turn on which the AI side will start to advance its infantry if it has not done so already. (Turn 0 is side 0's first turn, Turn 1 is Side 1's first turn, and so on).
// If the value is set at -1 the infantry will only ever advance if the tactical situation merits it.

// AI_Masterplan(15);

// If you want to use AI_Masterplan() in a scenario where the AI foot is defending fortifications you need to use the following code here
// SetUniversalVar("SkirmishGame",1);
// SetUniversalVar("ScenarioType",0);
// AI_Masterplan(-1);
// SetUniversalVar("SkirmishGame",0);
// You would also need to set the position of the fortification line in PreBattleSetup(), using
// SetUniversalVar("FootMinX", 24); // X-coordinate of bottom end of fortifications line
// SetUniversalVar("FootMaxX", 28); // X-coordinate of upper end of fortifications line
// SetUniversalVar("FrontLine", 26); // Y-coordinate of fortifications line


// Otherwise insert any custom AI code here
}

// Set up MP scenario to use adjusted MP victory conditions:
// SetMPForceRatio();
}

Please can you tell me where I am going wrong with this?

I have set the release turn as 3 because I have been play testing to see if it works, and did not want to go through several turns to find out that it did not work. Ideally I would like AI Team 1 to be released on turn 17.


Cheers


Paul
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28014
Joined: Sun Dec 04, 2005 6:25 pm

Re: Fixing Units

Post by rbodleyscott »

They aren't automatically released, you have to code the change of orders.

Code: Select all

if (GetTurn() < 3)
  {
    MoveTeamCoord(1,1,-1,-1,8);
  }
else
  {
    MoveTeamCoord(1,1,-1,-1,16); 
  }
Unless you want them to go anywhere in particular in which case replace the -1, -1 in the second MoveTeamCoord() with a destination, although they will deviate from this if any enemy are near
Richard Bodley Scott

Image
Paul59
General - King Tiger
General - King Tiger
Posts: 3803
Joined: Tue Jul 21, 2015 11:26 pm

Re: Fixing Units

Post by Paul59 »

Thanks Richard, that has worked.
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
edward77
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 231
Joined: Wed Nov 10, 2010 9:11 pm

Re: Fixing Units

Post by edward77 »

Paul, Trying to design a scenario with the normal P&S unit set for Fontenoy 1745 is not very good so I had a go at using your squad.csv from Blenheim and its working ok so far. However before proceeding any further I need your permission to use the file. The only major problem I have encounted is finding and switching the sideicons which currently are the wrong way around (Henry leading the French!).
BTW is there any way of switching the editor to and from the background whilst editing the text1 or squad files?
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28014
Joined: Sun Dec 04, 2005 6:25 pm

Re: Fixing Units

Post by rbodleyscott »

edward77 wrote:BTW is there any way of switching the editor to and from the background whilst editing the text1 or squad files?
ALT_TAB should work.
Richard Bodley Scott

Image
Paul59
General - King Tiger
General - King Tiger
Posts: 3803
Joined: Tue Jul 21, 2015 11:26 pm

Re: Fixing Units

Post by Paul59 »

edward77 wrote:Paul, Trying to design a scenario with the normal P&S unit set for Fontenoy 1745 is not very good so I had a go at using your squad.csv from Blenheim and its working ok so far. However before proceeding any further I need your permission to use the file. The only major problem I have encounted is finding and switching the sideicons which currently are the wrong way around (Henry leading the French!).
BTW is there any way of switching the editor to and from the background whilst editing the text1 or squad files?
Blenheim is not my scenario, it was designed by Odenathus.

The Sideicons (and Uniticons, Flags etc) are numbered to match the SIDENAME. The standard list of SIDENAMEs are as follows;

IDS_SIDENAME0,"Anti-Imperial", // Default
IDS_SIDENAME1,"Pro-Imperial", // Default
IDS_SIDENAME2,"Protestant", // TYW German
IDS_SIDENAME3,"Catholic", // TYW German
IDS_SIDENAME4,"French", // TYW
IDS_SIDENAME5,"Spanish", // TYW
IDS_SIDENAME6,"Swedish", // TYW
IDS_SIDENAME7,"Transylvanian", // TYW
IDS_SIDENAME8,"Polish", // TYW
IDS_SIDENAME9,"Ottoman", // TYW
IDS_SIDENAME10,"Danish", // TYW
IDS_SIDENAME11,"Weimarian", // TYW
IDS_SIDENAME12,"Royalist", // ECW
IDS_SIDENAME13,"Parliamentarian", // ECW
IDS_SIDENAME14,"Scots", // ECW
IDS_SIDENAME15,"Swiss", // Italian Wars
IDS_SIDENAME16,"Italian", // Italian Wars
IDS_SIDENAME17,"Spanish/Imperial", // Italian Wars
IDS_SIDENAME18,"French", // Italian Wars
IDS_SIDENAME19,"Bohemian", // TYW
IDS_SIDENAME20,"French Huguenot",
IDS_SIDENAME21,"Dutch",
IDS_SIDENAME22,"Russian",
IDS_SIDENAME23,"Hungarian-Bohemian",

You can create and use your own sideicons to replace the standard ones, they need to be put in the DATA/UI/TEXTURES folder of your scenario.

It sounds like you have copied Odenathus' Blenheim scenario and have tried to change the player side to the French. All you need to do is change the Side IDs in the editor to what you require (presumably French for Side 0 and British for Side 1? Creating your own appropriate 18th Century sideicons is a little more difficult, and requires some graphical skills, but maybe you could borrow some from existing scenarios, such as my own Nine Years War battles or Odenathus' Jacobite scenarios? They will not be ideal, but would be better than the standard pictures.
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
edward77
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 231
Joined: Wed Nov 10, 2010 9:11 pm

Re: Flags

Post by edward77 »

Paul, I think flag3 is Austrian but is not linked to a side icon. How do I get the AI to use that flag?
Paul59
General - King Tiger
General - King Tiger
Posts: 3803
Joined: Tue Jul 21, 2015 11:26 pm

Re: Flags

Post by Paul59 »

edward77 wrote:Paul, I think flag3 is Austrian but is not linked to a side icon. How do I get the AI to use that flag?
I'm a bit confused about what you mean. Are you talking about a particular mod or scenario? In the main game side 3 is Catholic (although the Austrian army lists do use it), and it certainly has a sideicon.
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
edward77
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 231
Joined: Wed Nov 10, 2010 9:11 pm

Re: Fixing Units

Post by edward77 »

Ah! You have answered the question! I did not twig the Catholic-Austrian connection. Thank you
ReinerAllen
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 84
Joined: Sun Aug 07, 2011 7:42 pm

Re: Fixing Units

Post by ReinerAllen »

Just downloaded "Labositz" . Nice mod.
edward77
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 231
Joined: Wed Nov 10, 2010 9:11 pm

Re: Fixing Units

Post by edward77 »

The credit for the mods goes to Odenathus who kindly allowed me to use them.
Post Reply

Return to “Scenario Design”