Making a scenario using "Regicide" type of victory

Modding, Map Editor, IES Scripting and Other Questions
User avatar
Bogdan
Posts: 149
Joined: 25 Feb 2017, 17:26
Location: Kyiv, Ukraine
Been thanked: 3 times

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

Post by Bogdan »

Heh, nevermind, it's not really important)

User avatar
Loewenherz
Posts: 244
Joined: 23 Sep 2017, 17:26
Has thanked: 7 times
Been thanked: 21 times

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

Post by Loewenherz »

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

Add Pics to Map: viewtopic.php?f=54&p=25184#p25184

Loews Work: viewtopic.php?f=54&t=5160
User avatar
Bogdan
Posts: 149
Joined: 25 Feb 2017, 17:26
Location: Kyiv, Ukraine
Been thanked: 3 times

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

Post by Bogdan »

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!
User avatar
Bogdan
Posts: 149
Joined: 25 Feb 2017, 17:26
Location: Kyiv, Ukraine
Been thanked: 3 times

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

Post by Bogdan »

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 1543 times
Снимок.PNG
Снимок.PNG (3.97 KiB) Viewed 1543 times
User avatar
Dr.MonaLisa
High Representative
Posts: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

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

Post by Dr.MonaLisa »

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
User avatar
Bogdan
Posts: 149
Joined: 25 Feb 2017, 17:26
Location: Kyiv, Ukraine
Been thanked: 3 times

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

Post by Bogdan »

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: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

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

Post by Dr.MonaLisa »

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
User avatar
Bogdan
Posts: 149
Joined: 25 Feb 2017, 17:26
Location: Kyiv, Ukraine
Been thanked: 3 times

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

Post by Bogdan »

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 1537 times
User avatar
Dr.MonaLisa
High Representative
Posts: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

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

Post by Dr.MonaLisa »

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
User avatar
Bogdan
Posts: 149
Joined: 25 Feb 2017, 17:26
Location: Kyiv, Ukraine
Been thanked: 3 times

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

Post by Bogdan »

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

Return to “Questions”