Location of the camera at the start of a scenario

Moderator: rbodleyscott

Post Reply
Athos1660
Major-General - Elite Tiger I
Major-General - Elite Tiger I
Posts: 2561
Joined: Wed May 29, 2019 3:23 pm

Location of the camera at the start of a scenario

Post by Athos1660 »

If I am not mistaken, it seems that :
- at the start of each scenario, the camera focus on the Unit(0)
- when making a scenario, the Unit (0) is always the unit that is the nearest to square (0,0) (or the line of squares that is the farthest from the enemy).

Is there a way to focus the camera on another square or unit, say in the middle of the map, at the start of the battle :
- either by making another unit be the number 0
- or by locating the camera over say square (32,11) or unit (12) ?
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28014
Joined: Sun Dec 04, 2005 6:25 pm

Re: Location of the camera at the start of a scenario

Post by rbodleyscott »

There is a script command that you could include in your scenario script:

SetCameraPosition(x, y)

Sets the camera to point at tile x,y.

Try putting it in the

FUNCTION PreBattleSetup()
Richard Bodley Scott

Image
Athos1660
Major-General - Elite Tiger I
Major-General - Elite Tiger I
Posts: 2561
Joined: Wed May 29, 2019 3:23 pm

Re: Location of the camera at the start of a scenario

Post by Athos1660 »

Thank you very much, Richard !

Unfortunately, I can't make it work. Tant pis :-)

Code: Select all

FUNCTION PreBattleSetup()
{
    // Set multiplier for unit strength reporting. 100 is 100% - i.e. units are vanilla strength.
    // If you set this at 50, units will be around half the size specified in the TotalMen column in the Squads file.
    SetUniversalVar("StrengthMultiplier", 100);

// Needs to be set if scenario uses deadline (turn limit) - note that side 0's first turn is turn 0, side 1's first turn is turn 1, side 0's second turn is turn 2 and so on.
// If it is set at 0, or not set at all, the scenario will have no turn limit.
// SetUniversalVar("ScenarioDeadline", 32);

    // Customise units for scenarios
    CustomiseUnits();

// Reassign teams - Only use if using AI_Masterplan() for AI orders - see above.
//  AI_ReassignTeams(1);

    SetCameraPosition(29,41);
}
Luc
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28014
Joined: Sun Dec 04, 2005 6:25 pm

Re: Location of the camera at the start of a scenario

Post by rbodleyscott »

Athos1660 wrote: Sat Jan 22, 2022 12:53 pm Thank you very much, Richard !

Unfortunately, I can't make it work. Tant pis :-)

Code: Select all

FUNCTION PreBattleSetup()
{
    // Set multiplier for unit strength reporting. 100 is 100% - i.e. units are vanilla strength.
    // If you set this at 50, units will be around half the size specified in the TotalMen column in the Squads file.
    SetUniversalVar("StrengthMultiplier", 100);

// Needs to be set if scenario uses deadline (turn limit) - note that side 0's first turn is turn 0, side 1's first turn is turn 1, side 0's second turn is turn 2 and so on.
// If it is set at 0, or not set at all, the scenario will have no turn limit.
// SetUniversalVar("ScenarioDeadline", 32);

    // Customise units for scenarios
    CustomiseUnits();

// Reassign teams - Only use if using AI_Masterplan() for AI orders - see above.
//  AI_ReassignTeams(1);

    SetCameraPosition(29,41);
}
Luc
Maybe setting it in PreBattleSetup() is too soon in the program flow, and the default camera move is processed after it.

Try adding the following near the end of the StartTurnPost(side) function:

Code: Select all

if (GetTurn() == 0)
  {
     SetCameraPosition(29,41);
  }
Richard Bodley Scott

Image
Athos1660
Major-General - Elite Tiger I
Major-General - Elite Tiger I
Posts: 2561
Joined: Wed May 29, 2019 3:23 pm

Re: Location of the camera at the start of a scenario

Post by Athos1660 »

Thank you, Richard, for your help !!!

Unfortunately it seems not to work with my files. I don't know whether or not it matters : in the current version of the scenario, there's no deployment. The battle starts at turn 1. I tried with a deployment. No improvement.

(Still working on the scenario. Did quite a few changes)
Paul59
General - King Tiger
General - King Tiger
Posts: 3803
Joined: Tue Jul 21, 2015 11:26 pm

Re: Location of the camera at the start of a scenario

Post by Paul59 »

Athos1660 wrote: Sun Jan 23, 2022 10:21 am Thank you, Richard, for your help !!!

Unfortunately it seems not to work with my files. I don't know whether or not it matters : in the current version of the scenario, there's no deployment. The battle starts at turn 1. I tried with a deployment. No improvement.

(Still working on the scenario. Did quite a few changes)
It doesn't work for me either, however, I have been able to move the camera position using this script in the FUNCTION StartTurn(side):

Code: Select all

	if (GetTurn() == 0)
		{
			AddVizCam(29, 41, 0)
		}


The actual coordinates might need a bit of adjusting to get it exactly where you want, and the camera initially goes to the default unit and then moves to the specified coordinates half a second later, but it's better than nothing.


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.
Athos1660
Major-General - Elite Tiger I
Major-General - Elite Tiger I
Posts: 2561
Joined: Wed May 29, 2019 3:23 pm

Re: Location of the camera at the start of a scenario

Post by Athos1660 »

Paul59 wrote: Sun Jan 23, 2022 12:08 pm (...)
Indeed. Nice ! Thank you very much, Paul. :-)
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28014
Joined: Sun Dec 04, 2005 6:25 pm

Re: Location of the camera at the start of a scenario

Post by rbodleyscott »

Thanks Paul.
Richard Bodley Scott

Image
Post Reply

Return to “Field of Glory II: Medieval - Scenario Design”