CT ?
Moderator: rbodleyscott
-
rbodleyscott
- Field of Glory 2

- Posts: 28429
- Joined: Sun Dec 04, 2005 6:25 pm
Re: CT ?
To make that happen immediately the event occurs, I can't think of a way to do it in a scenario script, so it would require some modding of other scripts.
Richard Bodley Scott


Re: CT ?
This is a script I constructed for a future scenario that imposes a Cohesion test on all AI units in turn 13 ((GetTurn() == 24) actually means AI turn 13):Athos1660 wrote: Thu Jan 13, 2022 3:25 pm In a Scenario, I'd like to have the AI army take a Cohesion Test (as in Ambush (own)) when the player's units (already on the battlefield) appear in line of sight. How can I do that ?
Code: Select all
if (GetTurn() == 24)
{
for (i = 0; i < GetUnitCount(1); i++) // for every unit in side
{
id = GetUnitID(1, i);
if (id != -1)
{
SetAttrib(id, "MoraleTestDue", 1);
}
}
DoProximityMoraleTests(side);
}This could be adapted to trigger the Cohesion tests when a player unit enters a defined area, but like Richard, I cannot see how it can be triggered by units entering LOS.
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.
Field of Glory II Medieval Scenario Designer.
FOGII TT Mod Creator
Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
-
rbodleyscott
- Field of Glory 2

- Posts: 28429
- Joined: Sun Dec 04, 2005 6:25 pm
Re: CT ?
And the other point is that it has to be in the StartTurnPost() function, and hence happens at the start of the turn after the event occurs, not immediately when the event occurs.Paul59 wrote: Fri Jan 14, 2022 10:06 amThis is a script I constructed for a future scenario that imposes a Cohesion test on all AI units in turn 13 ((GetTurn() == 24) actually means AI turn 13):Athos1660 wrote: Thu Jan 13, 2022 3:25 pm In a Scenario, I'd like to have the AI army take a Cohesion Test (as in Ambush (own)) when the player's units (already on the battlefield) appear in line of sight. How can I do that ?
It goes into the FUNCTION StartTurnPost(side) section.Code: Select all
if (GetTurn() == 24) { for (i = 0; i < GetUnitCount(1); i++) // for every unit in side { id = GetUnitID(1, i); if (id != -1) { SetAttrib(id, "MoraleTestDue", 1); } } DoProximityMoraleTests(side); }
This could be adapted to trigger the Cohesion tests when a player unit enters a defined area, but like Richard, I cannot see how it can be triggered by units entering LOS.
Richard Bodley Scott



