What is wrong modding convoys?

A forum to discuss custom scenarios, campaigns and modding in general.

Moderators: Slitherine Core, The Lordz

Post Reply
Kossatx
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 133
Joined: Wed Nov 27, 2013 3:27 pm

What is wrong modding convoys?

Post by Kossatx » Sat Aug 04, 2018 10:25 pm

Code: Select all

-- (faction, x, y, cargo, interval, spawnturn, blockadable)

DefineConvoy(2, 116, 0, 90, 6, 5) -- Germany - Sweden
DefineConvoy(2, 102, 1, 100, 10, 8, 1) -- Germany - Norway
Hi again, I have moded these two german convoys in but something strange happens. Sometimes the norwegian convoy spawns in consecutive turns, not after 8 turs as it is coded. The swedish convoy spawns the same way, without waiting 6 turns. Anyone knows why this happens?

Robotron
Lieutenant Colonel - Panther D
Lieutenant Colonel - Panther D
Posts: 1230
Joined: Tue Nov 23, 2010 3:35 pm

Re: What is wrong modding convoys?

Post by Robotron » Sat Aug 04, 2018 10:56 pm

The convoy spawn routine "SpawnConvoy" includes a slight random modifier so you cannot rely on exact convoy spawn dates.
Slitherine's Commander the Great War on steroids: POTZBLITZ mod!
http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610

Kossatx
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 133
Joined: Wed Nov 27, 2013 3:27 pm

Re: What is wrong modding convoys?

Post by Kossatx » Sun Aug 05, 2018 8:55 am

Wow! It is possible the real random routine is between 1 and the number specified in the formula? In the example of the norwegian convoy between 1 and 10?

Robotron
Lieutenant Colonel - Panther D
Lieutenant Colonel - Panther D
Posts: 1230
Joined: Tue Nov 23, 2010 3:35 pm

Re: What is wrong modding convoys?

Post by Robotron » Sun Aug 05, 2018 10:44 am

Whoops, forget SpawnConvoy, such a function does not exist. There is however a function ConvoySpawn.

The spawning interval randomization takes place in function ManageConvoys.
Or you could use a randomizer while defining the convoys with function DefineConvoy.

You have slightly misread how DefineConvoy works regarding interval and first spawnturn, so I'll re-explain.

function DefineConvoy uses six variables (or seven if the convoy is meant to be affected by the North Sea Blockade).

Let's have those variables represented by letters for explaining purposes:

DefineConvoy(a,b,c,d,e,f,g)

a is the ID of the nation that owns that convoy
b is the x coordination where the convoy will spawn
c is the y coordination where the convoy will spawn
d is the amount of strength points the convoy will have
e is the interval: the number of turns which must pass for this convoy to respawn after he has reached his destination
f is the turn the convoy will be spawned the first time in the game
g is either left out or has a value of 1, meaning the convoy will be prevented from spawning once the North Sea blockade is in effect.

So for the Norway convoy that means:

Code: Select all

DefineConvoy(2, 102, 1, 100, 10, 8, 1) -- Germany - Norway
This convoy belongs to Germany (Germany has faction ID 2)
It will spawn of x coordinate 102
It will spawn at y coordinate 1
It will have a unit strength of 100
It will reappear every 10 turns (you could use a randomizer here)
It will first appear on turn 8 (you could use a randomizer here)
It will be affected by the North Sea Blockade (because of 1)
Slitherine's Commander the Great War on steroids: POTZBLITZ mod!
http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610

Kossatx
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 133
Joined: Wed Nov 27, 2013 3:27 pm

Re: What is wrong modding convoys?

Post by Kossatx » Sun Aug 05, 2018 11:30 am

Thanks again Robotron :D How did you learn so much about modding this game?

Robotron
Lieutenant Colonel - Panther D
Lieutenant Colonel - Panther D
Posts: 1230
Joined: Tue Nov 23, 2010 3:35 pm

Re: What is wrong modding convoys?

Post by Robotron » Sun Aug 05, 2018 12:02 pm

First I browsed older posts from when the game was still "hot", there I found some ideas how to mod basic stuff.

Then I looked at mods from sabratha, kirk23 and DanielHerr and copied what I found was working good.

Then I learnt some lua. There are some good beginner's tutorials to be found in the net.

Rest was trial & error. A LOT of trial and error. ^^
Slitherine's Commander the Great War on steroids: POTZBLITZ mod!
http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610

Kossatx
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 133
Joined: Wed Nov 27, 2013 3:27 pm

Re: What is wrong modding convoys?

Post by Kossatx » Sun Aug 05, 2018 2:09 pm

Ok, many hours and a lot of talent. You have done a great work with your mod :idea:

Post Reply

Return to “Commander the Great War : Mods & Scenario Design”