Making a scenario using "Regicide" type of victory

ImageImageTalking about Modding for EE2 and EE2 AOS. New maps, patches, programs and Multiplayer scenarios.
User avatar
Loewenherz
Posts: 56
Joined: 23 Sep 2017, 17:26
Location: Germany

Re: Making a scenario using "Regicide" type of victory

Post by Loewenherz » 14 Jul 2018, 13:53

The EE2 "ies" scripting language usually has all command from that what you has seen in the Campaign. So you should not make the AI to a "human" player to stop the AI. Read the doc more or use the search function from you word program, to find the right function.

Code: Select all

  // Pause Players for a while
  PausePlayerAI(2, true);
  PausePlayerAI(3, true);
  PausePlayerAI(4, true);
  PausePlayerAI(5, true);
A AI player can not lose a scenario. Only he can have a stopped AI. :geek:
My EE2 Work:
EE2 Scripts - Notepad ++ User Defined Language make the scripting clearly and easy.
Grid Utility for EE2 and EE2X to create accurate maps.
IES Script Collection with all scenario scripts from EE2 1.5


Bogdan
Posts: 49
Joined: 25 Feb 2017, 17:26

Re: Making a scenario using "Regicide" type of victory

Post by Bogdan » 14 Jul 2018, 14:36

Everything is working! Thank you.
Also, I've found these miraculous strings in BFME scenario script:

Code: Select all

GiveAttackBasePreference(5, "areaSarumanAttack", 3.0);
GiveAttackBasePreference(4, "areaGondor", 3.0);
GiveAttackBasePreference(8, "areaGondor", 3.0);
GiveAttackBasePreference(2, "areaBlackGate", 3.0);
As far as I know, these values from 1.0 to 10.0 can be used to prioritize AI actions. I'd like to use them too, but my code:

Code: Select all

GiveAttackBasePreference(4, "tx_terr_korean_11", 7.0);
GiveAttackBasePreference(5, "tx_terr_korean_13", 7.0);
GiveAttackBasePreference(8, "tx_terr_korean_15", 10.0);
GiveDefendBasePreference(7, "tx_terr_korean_11", 8.0);
just doesn't work, despite the fact, that I gave tx names to the required territories :( What could possibly went wrong?
Attachments
Screenshot 2.PNG
Screenshot 2.PNG (3.91 KiB) Viewed 77 times
EE2_ScreenShot3.jpg
EE2_ScreenShot3.jpg (508 KiB) Viewed 77 times

User avatar
Loewenherz
Posts: 56
Joined: 23 Sep 2017, 17:26
Location: Germany

Re: Making a scenario using "Regicide" type of victory

Post by Loewenherz » 14 Jul 2018, 15:20

That are a command for areas, not for territories. Areas are blue "areas" that you place on map, to use them in effects or rules. By the way, the string with tx at beginning like tx_bar_foo_orblblbla are names for strings the are connected with a text in EE2. Use better for scripts name a simple name like "areaWisky" or "UnitDrMonaLisa" or "TerritoryfromLoewenherz" or what ever....
Last edited by Loewenherz on 14 Jul 2018, 15:29, edited 2 times in total.
My EE2 Work:
EE2 Scripts - Notepad ++ User Defined Language make the scripting clearly and easy.
Grid Utility for EE2 and EE2X to create accurate maps.
IES Script Collection with all scenario scripts from EE2 1.5

User avatar
Leader
Dr.MonaLisa
Posts: 7073
Joined: 17 Jun 2010, 11:21
Location: Poland

Re: Making a scenario using "Regicide" type of victory

Post by Leader » 14 Jul 2018, 15:28

Areas are not territory Script Names.
Create new areas by the Map Editor (you will find the option for it).

About removing human players from game... Did you check if there's no other option that would cause resign-alike behavior?

I would simply kill all units and buildings of the selected player.
Something like this (replace iPLAYER1 with player numbers):

Code: Select all

CreateNamedGroup("KillUnitsOfPlayer1");
AddUnitsByTypeToGroup("KillUnitsOfPlayer1", "Everything", iPLAYER1, kPlayerMode_Self, NULL);
or:
AddUnitsByAttributeToGroup("KillUnitsOfPlayer1", "Everything", iPLAYER1, kPlayerMode_Self, NULL);
if(NumUnitsInGroup("KillUnitsOfPlayer1") > 0){
SelectGroupForPlayer("KillUnitsOfPlayer1", iPLAYER1);
KillSelection();
ClearSelection();
}
I'm not sure if Type or Attribute "Everything" is correct.
You can check in file: zips\dbunittypeattributes.ddf
UnitTypeAttribute "MobileUnits" seems to contain everything except Projectiles.
Same for buildings, I think "BareBoneBuilding" would select them all.
So finally it could look like this:

Code: Select all

AddUnitsByAttributeToGroup("KillUnitsOfPlayer1", "MobileUnits", iPLAYER1, kPlayerMode_Self, NULL);
AddUnitsByTypeToGroup("KillUnitsOfPlayer1", "BareBoneBuilding", iPLAYER1, kPlayerMode_Self, NULL);
Remember that AddUnitsByAttributeToGroup and AddUnitsByTypeToGroup can be used as many times as you like, to make sure everything is added to that group.
Also don't forget to use:

Code: Select all

PrintMessage("Player 1 has been eliminated - removing all units!");
to know if script works correctly. PrintMessage is very useful when scripting, and at the end, when your script is ready you could remove all those messages.

To prevent your previous error, there is a function called: IsPlayerHumanControlled().
So it could look like this to prevent debug message displaying:

Code: Select all

if(!IsPlayerHumanControlled(US_ARMY)){
ForceSurrenderOffer(..., ...);
}
The " ! " before function name, means to execute it when it's FALSE.
So same effect as:

Code: Select all

if(IsPlayerHumanControlled(US_ARMY)){
//do nothing
}
else {
ForceSurrenderOffer(..., ...);
}
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains

Bogdan
Posts: 49
Joined: 25 Feb 2017, 17:26

Re: Making a scenario using "Regicide" type of victory

Post by Bogdan » 14 Jul 2018, 16:33

My script is ready) Thank you all guys! :D

User avatar
Leader
Dr.MonaLisa
Posts: 7073
Joined: 17 Jun 2010, 11:21
Location: Poland

Re: Making a scenario using "Regicide" type of victory

Post by Leader » 14 Jul 2018, 16:44

Just one more tip.
You could place city centers to generate Kings, and then Kill those city centere with SelectUnit(); KillSeletion(). Then Regicide mode would work normally, without any workarounds.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains

Bogdan
Posts: 49
Joined: 25 Feb 2017, 17:26

Re: Making a scenario using "Regicide" type of victory

Post by Bogdan » 14 Jul 2018, 18:37

One more problem :(
KingDeadAction command doesn't work as expected.

After AI players lost their Kings and surrender (all units and buildings perish properly), AI players stays at the Diplomacy list and scenario can't be finished! Is there any command to end the game?

User avatar
Leader
Dr.MonaLisa
Posts: 7073
Joined: 17 Jun 2010, 11:21
Location: Poland

Re: Making a scenario using "Regicide" type of victory

Post by Leader » 14 Jul 2018, 18:42

Maybe change "Edit" -> "Victory Conditions..." from "Script Says So" to "Conquest"?
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains

Bogdan
Posts: 49
Joined: 25 Feb 2017, 17:26

Re: Making a scenario using "Regicide" type of victory

Post by Bogdan » 14 Jul 2018, 18:50

Hm, seems to work now

Added after 2 minutes 20 seconds:
Funny is, SetAITauntsEnabled(false); command doesn't work either. No errors appeared, AI just continue to taunt :lol:
Is it known issue?

User avatar
Loewenherz
Posts: 56
Joined: 23 Sep 2017, 17:26
Location: Germany

Re: Making a scenario using "Regicide" type of victory

Post by Loewenherz » 14 Jul 2018, 18:59

Unfortunately some commands in the script language doesn't work. Seems that SetAITauntsEnabled belongs to it.
My EE2 Work:
EE2 Scripts - Notepad ++ User Defined Language make the scripting clearly and easy.
Grid Utility for EE2 and EE2X to create accurate maps.
IES Script Collection with all scenario scripts from EE2 1.5

Post Reply