Heads up - weighted stringlists

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

Moderator: Vic

Post Reply
User avatar
ernieschwitz
Posts: 4654
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

Heads up - weighted stringlists

Post by ernieschwitz »

Hi Everyone,

This is a short heads up, from me, regarding if you want to have the ATG engine select a random stringlist, from among those you used a column to determine the weight of them. Does that make sense? If not what I am trying to say is this. If you choose to have the ATG engine select a weighted stringlist (a stringlist where you used a specific column as the value of the weight of the stringlist row), then if you select a number below 1 it will automatically be assumed that this number is 1.

Say you want to have a different way of using the randomization engine. You make a stringlist of 4 rows, but you want some of them to be selected more often than others. You could do it like this.

Code: Select all

Value  Weight
   1       1
   2       1
   3       1
   4       2
 

This will work out like this. The stringlist weights will be added together and the value 4 would come out twice as many times as 1, 2 or 3.

If however you wanted to have a value like 2 not come out at all... it might seem intuitive to set the weight to 0.

Code: Select all

Value  Weight
   1       1
   2       0
   3       1
   4       2
 

Now because the engine for ATG wants the values to be minimum 1, it will interpret the 0 to be a 1. So the actual results will be exactly like the first table i showed.... Which may cause errors in your programming. Like it did to me...

Instead what you do is make a NEW stringlist (with code) and then simply omit the lines that had 0 in them.

Just FYI, since there is no documentation, this might be the first place you read this info.
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: Heads up - weighted stringlists

Post by GaryChildress »

Thanks for the info, Claus! Always good to have threads that reveal more about the workings of the game. I would love to see a thread (stickied) with the basics of event coding in the game. [:)]
Post Reply

Return to “Mods and Scenarios”