Page 1 of 1

The Chimera horse

Posted: Sun Nov 24, 2024 12:57 pm
by Athos1660
This a modded version of the Greek armoured Cavalry (but could also apply to the Young Cavalry and the Veteran one btw), an hybrid of non-light Cavalry and light Horse. Thus, chimeric in FoG2 world :-)

It is a non-light cav that can throw javelins and move backwards a bit.
Not as agile as the Light Javelin Horse but stronger.
Meant to be used in lieu of both the Greek armoured Cavalry and the Light Javelin Horse of the Greek lists.
It remains to fix the price.
Interesting and fun ! Test it.

Image

Required Modifications :

(1) in the Squad.cvs
(in ...Program Files (x86)\Steam\steamapps\common\Field of Glory II\Data)

Grk_arm_cav,104,Allies,2,Cavalry,Jinetes,4,60,25,200,20,40,0,2,16,900,1,0,Grk_arm_cav,100,0,0,0,1,0,-1,1,0,200,240,400,100,100,100,0,0,0,0,0,0,0,0,0,100,0,0,0,0,0,0,0,0,100,100,0,0,100,,,-1,0,1,-100,21,800,,Vet_Arm_Cavalry,,,0,0,0,0,,,,,,,,,,,,,,,,,,,,,,,,

(2) in the Tools script
(in ....Program Files (x86)\Steam\steamapps\common\Field of Glory II\Data\scripts)

The FUNCTION TurnCost becomes :

Code: Select all

FUNCTION TurnCost(me, tilex, tiley, test)
{
    int angle;
    int cost;
    int already_had_free_turn;
    int x;
    int y;
    x = GetUnitX(me);
    y = GetUnitY(me);

    // Has unit already used its free turn this move?

    already_had_free_turn = GetAttrib(me, "MadeFreeTurn") ;

    // Get angle of turn, and cost move accordingly. Note that 45 degree move will be free if the unit has not used its free move yet.
    angle = GetAngleFromTile(tilex, tiley, me) ; //get the angle the unit is presenting to the denoted tile, 0=looking straight at it, 180= it is directly behind them.

    if (already_had_free_turn == 1)
        {
            angle += 45;
        }
        
    if (angle < 42) // Slightly under 45 degrees.
        {
            cost = 0 ;
        }
    else
        {
            if (test == 0)
                {
                    SetAttrib(me, "MadeFreeTurn", 1);
                }

            if ((angle >= 42) && (angle <= 50)) // This is meant to be circa 45 degrees.
                {
                    // New Drilled/Undrilled code - Undrilled and large units of non-lights cost 4 AP to turn 45 degrees. Also units out of command range.
                    if (((IsUnwieldy(me) == 1) || (GetAttrib(me, "GeneralInCommandRange") == -1)) && (already_had_free_turn == 0)) // If really is turn and not just set at 45 because of previous free turn
                        {
                            if ((IsLightTroops(me) == 1) && (GetAttrib(me, "MadeLargeTurn") == 0))
                                {
                                    cost = 0;

                                    if (test == 0)
                                        {
                                            SetAttrib(me, "MadeLargeTurn", 1);
                                        }
                                }
                            else
                                {
                                    cost = Min(4, GetBaseAttrib(me, "AP")); // Allows heavy artillery to turn 45 degrees.
                                }
                        }
                    else
                        {
                            cost = 0;
                        }
                }

            if ((angle > 50) && (angle < 100))  // Just over 45 degrees to 90 degrees + margin for error
                {
                    if ((IsLightTroops(me) == 1) && (GetAttrib(me, "MadeLargeTurn") == 0))
                        {
                            cost = 0;
                        }
                    else
                        {
                            if (IsUnitSquadType(me, "Light_Artillery") == 1)
                                {
                                    cost = GetBaseAttrib(me, "AP");  // Allow light artillery to turn
                                }
                            else
                                {
                                    if (GetAttrib(me, "InSquare") == 1)
                                        {
                                            cost = 6;
                                        }
                                    else
                                        {
                                            cost = 8; // See comments below.
                                        }
                                }
                        }

                    // This currently means non-light infantry cannot turn and move but cavalry can because they will have some movement points left after turning.
                    // Light troops can make one large turn free, but a second one will cost 8 movement points.
                    if (test == 0)
                        {
                            SetAttrib(me, "MadeLargeTurn", 1);
                        }
                }

            if (angle >= 100) // More than 90 degrees + margin for error
                {
                    if (IsLightTroops(me) == 1)
                        {
                            if (GetAttrib(me, "MadeLargeTurn") == 0)
                                {
                                    cost = 0;
                                }
                            else
                                {
                                    cost = 8;
                                }
                        }
                    else
                        {
                            if (IsUnitSquadType(me, "Artillery") == 1)
                                {
                                    cost = 8; // Arbitrary cost to stop Medium and Heavy Artillery turning more than 45 degrees
                                }
                            else
                                {
                                    if ((IsUnitSquadType(me, "Cavalry") == 1)  && (SquareZOCd(x,y,me,1,0,0) == -1))
                                        {
                                            cost = 6
                                        }
                                    else
                                    // Otherwise takes full movement allowance
                                        {    
                                            if (GetAttrib(me, "InSquare") == 1)
                                                {
                                                    cost = 6;
                                                }
                                            else
                                                {
                                                    cost = GetBaseAttrib(me, "AP");
                                                }
                                        }
                                }

                            if (test == 0)
                                {
                                    SetAttrib(me, "MadeLargeTurn", 1);
                                }
                        }
                }

    // If unit fragmented, and has had its AP halved, so halve cost of turn so units can still turn
//    if (GetAttrib(me,"MoraleState") == 2)
  if (GetAttrib(me, "PreviousMoraleState") == 2)
  // v1.0.1 bug fix - to stop a unit that becomes fragged in its own turn from being allowed to move in all directions.
  // This means that the reduction is only applied if the AP has been reduced, which currently only happens in the StartTurnMoraleUpdate() after the unit becomes fragmented,
  // just before the AP is reduced. So it should always be 2 if the AP has been reduced for being fragged.
  // Ideally the AP should drop immediately after the unit frags, but there are various complicated issues with this that would need more testing than the above fix.
            {
//                cost /= 2;
            
            // v1.5.14 change
                cost *= GetFragmentedBaseAP(me);
          cost /= GetBaseAttrib(me, "AP");
          // v1.5.14 change
            }

    return cost;
        }
}
Thanks, Cronos, for your help !

Re: The Chimera horse

Posted: Sun Dec 01, 2024 9:52 pm
by Athos1660
The more I play it, the more I like the freedom of movement but the less I use the javelin capability (not suited to the use of the unit imho).

Re: The Chimera horse

Posted: Sat Dec 28, 2024 5:55 am
by CPI986
Good evening! May I ask for a copy of the resulting Units.csv & Tools BSF file to test this? I'm quite afraid I'm not altogether a most technically proficient person with code of any sort.

If it is too much a hindrance, I do still thank you for the idea and concept herein presented <3