How do you create a war declaration event?

Discuss and post your mods and scenarios here for others to download.

Moderator: Vic

Post Reply
GaryChildress
Posts: 6933
Joined: Sun Jul 17, 2005 3:41 pm
Location: The Divided Nations of Earth

How do you create a war declaration event?

Post by GaryChildress »

I have a random map scenario with 3 regimes. I'm creating it just for my own entertainment but will be happy to release it if anyone is interested. I'd like to set it up where all players are at peace for the first 10 or so turns (or alternatively until a specific date) and then after that point all AI players will declare war on each other and the human player. That would give me a specific number of turns to prepare before all hell breaks loose. I don't want the AI to be "sleeping" during that time but rather it would be building and preparing for attack.

Is there a way to set this up in the editor? I'm not very familiar with how the "Events" screen works but I could probably figure it out with a few pointers (if it's not too complicated that is).

Thanks for any help!
User avatar
ernieschwitz
Posts: 4654
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: How do you create a war declaration event?

Post by ernieschwitz »

Yes, I think this is doable.

If you want I could possibly code this for you. Just send me a pm, to get my email, and send me the scenario :)
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
GaryChildress
Posts: 6933
Joined: Sun Jul 17, 2005 3:41 pm
Location: The Divided Nations of Earth

RE: How do you create a war declaration event?

Post by GaryChildress »

ORIGINAL: ernieschwitz

Yes, I think this is doable.

If you want I could possibly code this for you. Just send me a pm, to get my email, and send me the scenario :)

Great! Much thanks. PM on the way.
User avatar
Tac2i
Posts: 2083
Joined: Tue Apr 12, 2005 5:57 pm
Location: WV USA

RE: How do you create a war declaration event?

Post by Tac2i »

If don't mind, explain how you did it.

thanks,
ORIGINAL: ernieschwitz

Yes, I think this is doable.

If you want I could possibly code this for you. Just send me a pm, to get my email, and send me the scenario :)
Tac2i (formerly webizen)
User avatar
ernieschwitz
Posts: 4654
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: How do you create a war declaration event?

Post by ernieschwitz »

I will, of course, I just work better with things in my hands :)
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
GaryChildress
Posts: 6933
Joined: Sun Jul 17, 2005 3:41 pm
Location: The Divided Nations of Earth

RE: How do you create a war declaration event?

Post by GaryChildress »

Yes! Feel free to post the code in this thread if you want. Or maybe someone could put together a special "Coding" thread that could be stickied?

Many thanks again! [:)]
User avatar
ernieschwitz
Posts: 4654
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: How do you create a war declaration event?

Post by ernieschwitz »

Ok, this is a three step process.

Step 1: Make all the regimes in the scenario (3 in this case) DipBlock True. This will prevent the declaration of war, alliances etc.

Here is a screenshot, taken in the Reg menu of the editor.

Image
Attachments
Step1Regimes.jpg
Step1Regimes.jpg (52.7 KiB) Viewed 227 times
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
User avatar
ernieschwitz
Posts: 4654
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: How do you create a war declaration event?

Post by ernieschwitz »

Step 2:

Remove the rulevar that makes the AI declare war when it feels like it.

This step may be not needed, but I like to dot all the I´s and cross all the T´s. Also, you here have a chance to see some of the mechanics of the AI. If you want a more aggressive (war declaring) AI for instance, you could set this rulevar to a higher value.

I set it to 0. So it is diabled.


Image
Attachments
Step2WarD..gRulevar.jpg
Step2WarD..gRulevar.jpg (174.48 KiB) Viewed 227 times
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
User avatar
ernieschwitz
Posts: 4654
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: How do you create a war declaration event?

Post by ernieschwitz »

Step 3:

Probably the most feared step. Actually making some code.

I have tried to explain what I do in the following with Green lines of explanatory text. If its complete gibberish to you, then ask me, and I will try to explain. But basically, this is what I do.

I set the event to be a Round Event, which means it will only be checked at the start of a round. (always remember, you take your turn in each round, if you remember that, then what is a round check and a turn check won´t confuse you.)

The first line of code I do checks which round it is. If it is the 10th round, then the code springs into action. If not, nothing happens. (Because everything is indented below it, it is all part of the check. You might read the line as IF round = 10, then do the indented stuff).

I then make a LOOPER, which is basically a way to do something over and over, just increasing the iteration of it once each time, until it reaches the end point (end point included). In this case it is a looper that starts at 0, and ends at CheckRegimeCount. That last piece of code is just saying to the computer, all the regimes are included.

So what do i do. I change the DipBlock status of the regimes in qusetion (all of them) to being not blocked any more. So now people can declare wars, enter alliances, go to peace, and what not.

Then i tell the computer (or event executioner if you will) that I wish to end the loop here. So it will only loop through those commands below the indention, until it reaches the End Looper.

Them comes the messy part of the code. And by that i mean i could have done it so that it could be replicated in a 4 player, 5 player or so on game. I did not.

Instead I wrote three lines of code, with all the possible combinations of wars that could be done. I changed the relationships of each regime to be at war with all other regimes. First regime 0 with 1, then regime 0 with 2 and then regime 1 with 2. All regimes are now at war.

If there had been more regimes, there would be more lines.

For instance, 5 regimes would be.

0 and 1
0 and 2
0 and 3
0 and 4
1 and 2
1 and 3
1 and 4
2 and 3
2 and 4
3 and 4

So you can see this method is quick to code for few regimes but obviously could be made better with some nifty coding (which I wasn´t in the mood for).

In any case, having done what is needed, in round 10, I now end the event code with a EndCheck, and the code is done.

Save the scenario, and test :)

Image
Attachments
Step3coding.jpg
Step3coding.jpg (102.61 KiB) Viewed 227 times
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
GaryChildress
Posts: 6933
Joined: Sun Jul 17, 2005 3:41 pm
Location: The Divided Nations of Earth

RE: How do you create a war declaration event?

Post by GaryChildress »

Remarkable! Sheer genius! [&o][&o]
 
Much thanks again!
E6Jarhead
Posts: 29
Joined: Sun May 31, 2015 10:26 pm
Location: Hendersonville, NC

RE: How do you create a war declaration event?

Post by E6Jarhead »

Gary, I too have wanted to be able to do this! Ernie, thanks for posting.

I think we should all start posting snippets of code on here so we can all copy and learn and incorporate.

Ive got quite a few simple ones that someone may be able to use. I'll start posting.
Th only reason some people are still alive is because it is illegal to kill them!
Post Reply

Return to “Mods and Scenarios”