OpenXcom Forum
OpenXcom => Suggestions => Topic started by: bladum on December 15, 2014, 04:21:03 pm
-
Hi,
Idea is simple
Change this
- name: JUNGLE
textures: [6]
script: JUNGLE
mapDataSets:
- BLANKS
- JUNGLE
Into this
- name: JUNGLE
textures: [6]
script:
- JUNGLE01
- JUNGLE02
- JUNGLE03
mapDataSets:
- BLANKS
- JUNGLE
Game would pick one of scripts from the list, instead of one. For more variety of randomly generated maps even for vanilla.
Tom
-
you can basically already do this using labels and conditionals
-
thanks, but could you show simple example how to do it ?
-
- type: addBlock
label: 2001
size: 1
rects:
- [0, 0, 1, 1]
executionChances: 33
- type: addBlock
label: 2002
size: 1
rects:
- [0, 0, 1, 1]
executionChances: 33
conditionals: [-2001]
- type: addBlock
label: 2003
size: 1
rects:
- [0, 0, 1, 1]
conditionals: [-2001, -2002]
- type: removeBlock
rects:
- [0, 0, 1, 1]
###2001=true => script1 2002=true=>script2 2003=true =>script3
#just put conditionals: [2001,..] to each script one block
-
Thanks Falko, but this is quite complex to implement for a modder.
Having set of few scripts for game to pick one randomly with default value of single script is much more generic one. This is already implemented in several other places like civilianUnits for example.
Tom
-
Okay I keep looking at how these scripts are being coded, and maybe I don't know enough about the underlying code, but I keep getting a nagging in the back of my brain that they're not being coded correctly. So someone check my math and explain to me the errors?
Trying to run 1 of 3 scripts.
The example above says:
33% chance of running script 1.
If that script is not run, 33% chance of running script 2.
If neither script runs, 100% chance of running script 3.
Now, if script 1 fails, script 2's probability of running is independent of script 1's chance, so it's only given a 33% TIMES 33% chance of running, or 1/6 chance, because the first test has no impact on the second.
The remainder of the time, of course, the final script runs.
Shouldn't it look more like this?
33% chance of running script 1
if script 1 fails, 50% of REMAINING probability of running script 2.
Otherwise, run script 3.
Or is my math and/or understanding of the code faulty?
-
33% chance of running script 1.
If that script is not run, 33% chance of running script 2.
If neither script runs, 100% chance of running script 3.
Now, if script 1 fails, script 2's probability of running is independent of script 1's chance, so it's only given a 33% TIMES 33% chance of running, or 1/6 chance, because the first test has no impact on the second.
The remainder of the time, of course, the final script runs.
Shouldn't it look more like this?
33% chance of running script 1
if script 1 fails, 50% of REMAINING probability of running script 2.
Otherwise, run script 3.
Or is my math and/or understanding of the code faulty?
Yes, the issue is that statistically the odds are not independent from one another. As it is, 1st script has 33% of being run, but 2nd strip has only 22% actual chance of being run (33% of 66%) and script 3 has 44%.
-
LOL Oh yeah. I guess my math is wrong even when it's right :-\
-
yeah that was sloppy copy pasting on my part :(
as i explained in my wall of text regareding map resize here
https://openxcom.org/forum/index.php/topic,3138.msg36694.html#msg36694
...
but why using executionChances: 50 insted of the 33% we declared above?
the commands are executed one after another so if you create 100 maps the first command will (on average) convert 33 of them into 7x7 maps
if i convert the remaining 67 maps with e 33% executionchance i get 33,22,45
with 50% chance i get 33,33,34 distribution...