Page 1 of 1
Random location of troops
Posted: Sun Jan 30, 2022 5:38 am
by Sergobor
Hi. I have a question about the scenario editor. Is there any way to make enemy (AI) troops appear in random hexes?
RE: Random location of troops
Posted: Sun Jan 30, 2022 5:49 am
by Crossroads
Hello @Sergopor! You need CSEE in Lua file to do that, too. First, set any units you want placed randomly as replacements, arriving perhaps in a turn number that is higher than what there are turn in the scenario. That way they will stand out from perhaps those replacements that are due to arrive during the game play, per how they are set in the editor itself.
Once those are in place, use CSEE functions set_reinforcement_hex (id, hc) and set_reinforcement_turn (id, hc) to dynamically set on which turn and on what hex they will make their entrance.
Please see LUA_FUNCTIONS_REFERENCE document in the Manual folder for details.
RE: Random location of troops
Posted: Sun Jan 30, 2022 7:31 am
by Sergobor
Thank you! Did I understand correctly that this will allow you to place the enemy in random hexes rather than predetermined hexes?
RE: Random location of troops
Posted: Sun Jan 30, 2022 7:58 am
by Crossroads
ORIGINAL: Sergobor
Thank you! Did I understand correctly that this will allow you to place the enemy in random hexes rather than predetermined hexes?
Yes. Each reinforcement has a unique ID moniker, and using that, you can set turn and hex, respecitively, by those two commands in the scenario specific Lua file.
RE: Random location of troops
Posted: Sun Jan 30, 2022 8:02 am
by Crossroads
^To be more specific, put those functions into on_next_phase() event function, then It will affect both H2H play and also vs-SAI play. There's also a side specific battle_plan function, but that is only called if said side is under computer opponent control.
RE: Random location of troops
Posted: Sun Jan 30, 2022 12:18 pm
by Sergobor
Thank you! I'm going to try it. For me, experimenting with the editor in this awesome game is just as much fun as playing it!
RE: Random location of troops
Posted: Sun Jan 30, 2022 12:30 pm
by Crossroads
Good luck, any questions just give us a shout!