Making a scenario using "Regicide" type of victory

ImageImageTalking about Modding for EE2 and EE2 AOS. New maps, patches, programs and Multiplayer scenarios.
Bogdan
Posts: 51
Joined: 25 Feb 2017, 17:26

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

Post by Bogdan » 14 Jul 2018, 19:02

Heh, nevermind, it's not really important)


User avatar
Loewenherz
Posts: 70
Joined: 23 Sep 2017, 17:26

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

Post by Loewenherz » 14 Jul 2018, 21:13

Can you share the scenario with us? :-D
List of tutorials, useful threads and utilities (look here before posting): Here

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

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

Post by Bogdan » 14 Jul 2018, 21:20

It's not yet ready :) I need to test it from A to Z first and also add some story, tips.

Here you can find all scenarios that I've already made (the latest 3 are mine):
http://ee.heavengames.com/downloads/lis ... =0&s=d&o=d

Also, I didn't make such awesome scripts before, so those scenarios are simple. The new one will be the best!

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

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

Post by Bogdan » 15 Jul 2018, 12:16

So, as expected, the bug was found :?
Despite the fact that all of the players (except human player, of course) are now AI players, the error message is still here. How it could be that player 7 is not an AI player when all 2-8 players are AI players in Map Editor?
Attachments
EE2_ScreenShot4.jpg
EE2_ScreenShot4.jpg (206.39 KiB) Viewed 130 times
Снимок.PNG
Снимок.PNG (3.97 KiB) Viewed 130 times

User avatar
Dr.MonaLisa
High Representative
Posts: 7120
Joined: 17 Jun 2010, 11:21
Location: Poland

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

Post by Dr.MonaLisa » 15 Jul 2018, 12:23

What is in KingDeadAction7? Could you paste it?

Did you Save the scenario before clicking on Test Mission?

Have you tried the solution from my previous post?: viewtopic.php?p=23981#p23981
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: 51
Joined: 25 Feb 2017, 17:26

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

Post by Bogdan » 15 Jul 2018, 12:45

I don't understand how to apply this solution. For example, I have this:

Code: Select all

RULE ruleObj_Korean_Peninsula2 ONESHOT
 if (!DoesUnitExist( "tx_King_Korean_1" )
   )
  then KingDeadAction2
END_RULE

ACTION KingDeadAction2
SCRIPT WORLD
  ForceSurrenderOffer(2, 1);
END_SCRIPT
END_ACTION
How should I change it to check human player?

User avatar
Dr.MonaLisa
High Representative
Posts: 7120
Joined: 17 Jun 2010, 11:21
Location: Poland

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

Post by Dr.MonaLisa » 15 Jul 2018, 13:28

As in the example:

Code: Select all

RULE ruleObj_Korean_Peninsula2 ONESHOT
 if (!DoesUnitExist( "tx_King_Korean_1" )
   )
  then KingDeadAction2
END_RULE

ACTION KingDeadAction2
SCRIPT WORLD
if(!IsPlayerHumanControlled(2)){
  ForceSurrenderOffer(2, 1);
}
else {
//Other stuff to kill this player. CreateGroup, etc.
}
END_SCRIPT
END_ACTION
Not sure if it should be 2 or 1 (I don't remember all functions syntax).
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains

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

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

Post by Bogdan » 15 Jul 2018, 16:18

Hm, problem is still here. It's also strange that it appears not every time.

Here's my script:

Code: Select all

RULE ruleObj_Korean_Peninsula2 ONESHOT
 if (!DoesUnitExist( "tx_King_Korean_1" )
   )
  then KingDeadAction2
END_RULE


ACTION KingDeadAction2
SCRIPT WORLD
if(!IsPlayerHumanControlled(2)){
  ForceSurrenderOffer(2, 1);
}
else {
CreateNamedGroup("Group_Korea_1");
AddUnitsByTypeToGroup("Group_Korea_1", "Everything", 2, kPlayerMode_Self, NULL);
AddUnitsByAttributeToGroup("Group_Korea_1", "Everything", 2, kPlayerMode_Self, NULL);
if(NumUnitsInGroup("Group_Korea_1") > 0){
SelectGroupForPlayer("Group_Korea_1", 2);
KillSelection();
ClearSelection();
}
}
END_SCRIPT
END_ACTION
Where Group_Korea_1 is the group created in Map Editor that includes all buildings and units of AI player North Korea 1;
and 2 is the number of North Korea 1 in script
Attachments
Снимок.PNG
Снимок.PNG (4 KiB) Viewed 124 times

User avatar
Dr.MonaLisa
High Representative
Posts: 7120
Joined: 17 Jun 2010, 11:21
Location: Poland

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

Post by Dr.MonaLisa » 15 Jul 2018, 16:29

And did you follow the SCRIPTING.doc?
// void ForceSurrenderOffer(int in_iPlayerAI, int in_iPlayerHuman)
// force the AI in_iPlayerAI to surrender to in_iPlayerHuman
// YOU HAVE TO ENABLE STRATEGIC LEVEL DIPLOMACY FOR THIS PLAYER, OR YOU
// WILL GET A WEIRD CRASH WITH A NON OBVIOUS ERROR MESSAGE:
// DO THIS FIRST: SetAIDiplomacyEnabled()


ForceSurrenderOffer(2, 1);
Was AI Diplomacy Enabled in Initialization?
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains

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

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

Post by Bogdan » 15 Jul 2018, 16:44

Nope, I thought
SetAIDiplomacyEnabled(true);
would change Diplomacy conditions

Post Reply