Page 5 of 10

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

Posted: 15 Jul 2018, 16:48
by Dr.MonaLisa
So enable it in script, and then disable.

SetAIDiplomacyEnabled(2,true);
ForceSurrenderOffer(2, 1);
SetAIDiplomacyEnabled(2,false);

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

Posted: 15 Jul 2018, 16:53
by Bogdan
Like this?

Code: Select all

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


ACTION KingDeadAction2
SCRIPT WORLD
SetAIDiplomacyEnabled(2,true);
if(!IsPlayerHumanControlled(2)){
  ForceSurrenderOffer(2, 1);
SetAIDiplomacyEnabled(2,false);
}
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

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

Posted: 15 Jul 2018, 16:54
by Dr.MonaLisa

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)){
  SetAIDiplomacyEnabled(2,true);
  ForceSurrenderOffer(2, 1);
  SetAIDiplomacyEnabled(2,false);
}
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

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

Posted: 15 Jul 2018, 19:02
by Bogdan


Added after 1 hour 39 minutes 27 seconds:
Haha

Added after 21 minutes 11 seconds:
Also, one of the players is now surrendering before its King is actually eliminated.

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

Posted: 15 Jul 2018, 20:02
by Dr.MonaLisa
Seems like you really don't read the documentation.

Code: Select all

if (PlayerInGame(7)){
//Do stuff
}
In my opinion it would be simpler to create city centers for all players and delete them with a script on game start. So the normal kings would be present in game.

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

Posted: 15 Jul 2018, 20:17
by Bogdan
Yeah, but in that case I will need to fixate them with something different than barbed wire. And also I will need a new map, cause everything here is really compact.
Still, any ideas what can cause the issue with AI players recognition?

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

Posted: 15 Jul 2018, 20:21
by Dr.MonaLisa
Maybe the player is not in game already? Surrendered?

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

Posted: 15 Jul 2018, 20:27
by Bogdan
What do you mean "not in the game"?

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

Posted: 15 Jul 2018, 20:27
by Dr.MonaLisa
Got killed / resigned / no units left.

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

Posted: 15 Jul 2018, 20:58
by Bogdan
I'll check it again now

Added after 27 minutes 59 seconds:
May be no units left. Anyway, it's not a problem; the real problem is quitting "not AI player" error.
As far as I will hardly continue testing in the near future (unfortunately), I'll just leave scenario here, in case you'll have some spare time to see it and may be rate my scripting fail)

https://drive.google.com/open?id=1lPXzz ... v5fbFgDseN

P.S. Can't attach .scn file here, so share it via cloud

Added after 1 minute 28 seconds:
I don't know, may be today I was close to get everything work:(