Author Topic: Incorrect conditionals and labels from different retaliation causing crashes.  (Read 4690 times)

wcho035

  • Guest
Hi, I have 4 different sets of retaliation from my missionscript.

For example, I have for my human factions, this is the retaliation section from its mission script.

  - type: researchRetaliationFACTION
    missionWeights:
      0:
        STR_FACTION_RETALIATION: 100
    researchTriggers:
      STR_THE_MARTIAN_SOLUTION: true
    startDelay: 150
    firstMonth: 2
    targetBaseOdds: 100
    useTable: false
    label: 1
    executionOdds: 5   
  - type: beginnerRetaliationFACTION
    missionWeights:
      2:
        STR_FACTION_RETALIATION: 100
    firstMonth: 2
    targetBaseOdds: 100
    useTable: false
    conditionals: [-1]
    label: 2
    startDelay: 150
    executionOdds: 5      
  - type: experiencedRetaliationFACTION
    minDifficulty: 1
    missionWeights:
      2:
        STR_FACTION_RETALIATION: 100
    firstMonth: 2
    targetBaseOdds: 100
    useTable: false
    conditionals: [-1, -2]
    label: 3
    startDelay: 150
    executionOdds: 5      
  - type: veteranRetaliationFACTION
    minDifficulty: 2
    missionWeights:
      2:
        STR_FACTION_RETALIATION: 100
    firstMonth: 2
    targetBaseOdds: 100
    useTable: false
    conditionals: [-1, -2, -3]
    label: 4
    startDelay: 150
  - type: geniusRetaliationFACTION
    minDifficulty: 3
    missionWeights:
      2:
        STR_FACTION_RETALIATION: 100
    firstMonth: 2
    targetBaseOdds: 100
    useTable: false
    conditionals: [-1, -2, -3, -4]
    label: 5
    startDelay: 150
    executionOdds: 5      
  - type: superhumanRetaliationFACTION
    minDifficulty: 4
    missionWeights:
      2:
        STR_FACTION_RETALIATION: 100
    firstMonth: 2
    targetBaseOdds: 100
    useTable: false
    conditionals: [-1, -2, -3, -4, -5]
    startDelay: 150
    executionOdds: 5   

I am using the vanilla labels and conditionals for ref.

However, when I transfer the exact labels and conditionals to the other 3 sets of retaliations, almost a copy like the sample before. I am experiencing crashes.

Any reason why is this? And after I deleted the conditionals and labels for the other 3 sets. Game have no problem, but would the retaliation functions the same for those sets without the labels and conditionals?

 

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
what message do you get in the log?

wcho035

  • Guest
Oh I have to replicate the results again. I will get back to this.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Your labels and conditionals look correct to me, I'd guess your crash is somewhere else. For testing purposes, I find it useful to make executionOdds either 0 or 100 so I can test things with certainty.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Your labels and conditionals look correct to me, I'd guess your crash is somewhere else. For testing purposes, I find it useful to make executionOdds either 0 or 100 so I can test things with certainty.

The labels look wrong to me... they need to be unique for each command.
And OpenXcom should crash and let you know in the log file... thus waiting for log file.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
He did use unique labels, sequentially numbered 1-5, just like the vanilla retaliation scripts based on difficulty. That's what makes me think the error is elsewhere and the relating the error to the labels+conditionals was just a coincidence of the executionOdds.

If the labels are the exact same for the other 3 sets mentioned due to copy-paste, then that would be an issue. And I agree that a log file or at least the last few lines of it would be helpful. Knowing whether it's a segfault or a specific error message is useful when we can't reproduce from the mod ourselves.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
<snip> numbered 1-5, just like the vanilla retaliation scripts based on difficulty. <snip>

Exactly...

...I'm betting $10 the labels are not unique :) And conflict both with vanilla labels and with other sets' labels.

wcho035

  • Guest
Okay, I am able to replicate the conditions. Perhaps it is just like you suspect. The game does not like the labels shared between different sets of retaliation.

So, this is a little complicated for me.

[03-01-2020_11-38-14]   [FATAL]   0x95c190 console_main
[03-01-2020_11-38-14]   [FATAL]   0x95c2b0 WinMain
[03-01-2020_11-38-14]   [FATAL]   ??
[03-01-2020_11-38-14]   [FATAL]   ??
[03-01-2020_11-38-14]   [FATAL]   0x7ffa347c1fd0 BaseThreadInitThunk
[03-01-2020_11-38-14]   [FATAL]   0x7ffa3520ef90 RtlUserThreadStart
[03-01-2020_11-38-22]   [FATAL]   OpenXcom has crashed: Mission generator encountered an error: multiple commands: beginnerRetaliationFACTION and beginnerRetaliation, are sharing the same label: 2

I have also attached the four different set of retaliation Missionscript.rul

Either they all needed to merge together. OR use different labels.

The main reason of why I have four different set, is because the generation of these retaliation missions are solely dependable to their researchTriggers:

Some of these retaliation only trigger after certain research is done, AKA, the ultimate threat. So Merging them, is impossible, because you can't share different sets of research triggers. Like for example, TFTD retaliation starts after the UFO game is finished and the same goes for APOC after TFTD.

So I do need four different set of Retaliation missionscript.rul.

Please note for testing purposes, I have removed all the research triggers for all the four retaliation sets and also reset their starting months via missionweight to 0.

So my question is, how would be the best strategy to implement this, can my examples be modified into samples of how it can be done?

Or another option would be remove all the label and conditional entirely. However, if this is the case, would the retaliation perform the same way it was originally without the labels and conditionals removed?
« Last Edit: January 03, 2020, 06:58:04 am by Precentor Apollyon »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
So my question is, how would be the best strategy to implement this, can my examples be modified into samples of how it can be done?

Very simple.

Use a unique label for each command.

wcho035

  • Guest
What would the outcome be, if I get rid of the labels and conditions completely? How would the retaliation behavior become for all the ufos? Would it ignore the difficult settings set in the missionscript.rul

Just like to know all options.
« Last Edit: January 03, 2020, 11:41:48 am by Precentor Apollyon »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
What would the outcome be, if I get rid of the labels and conditions completely? How would the retaliation behavior become for all the ufos?

Do you understand what are the labels and conditions used for in vanilla?

If not, I recommend understanding those first... otherwise any answer to your questions above will not make much sense to you.

wcho035

  • Guest
As far as I understand and work with them.

Labels and conditionals act like cumulative weights, more complex version of them.

The usage of Labels and conditionals in the retaliation feature from the missionscript is to have varying retaliation difficulty from the difficulty options chosen.

At least that is my understanding. 

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
No, labels and conditionals have nothing to do with weights.

They are used as "conditional statements" (https://en.wikipedia.org/wiki/Conditional_(computer_programming)), otherwise known as "if-then-else" statements.

Code: [Select]
  - type: researchRetaliation
    label: 1
  - type: beginnerRetaliation
    conditionals: [-1]
    label: 2
  - type: experiencedRetaliation
    conditionals: [-1, -2]
    label: 3
  - type: veteranRetaliation
    conditionals: [-1, -2, -3]
    label: 4
  - type: geniusRetaliation
    conditionals: [-1, -2, -3, -4]
    label: 5
  - type: superhumanRetaliation
    conditionals: [-1, -2, -3, -4, -5]

These vanilla labels and conditionals mean:
- try generating "1. researchRetaliation"
- if 1. failed, then try generating "2. beginnerRetaliation"
- if 1. and 2. both failed, then try generating "3. experiencedRetaliation"
- if 1. 2. and 3. all failed, then try generating "4. veteranRetaliation"
- if 1. 2. 3. and 4. all failed, then try generating "5. geniusRetaliation"
- if 1. 2. 3. 4. and 5. all failed, then try generating "superhumanRetaliation"


To answer your questions:

a/ if you remove labels and conditionals... this (if-then-else) logic will be removed... and all mission script commands will be executed like this:

- try generating "researchRetaliation"
- try generating "beginnerRetaliation"
- try generating "experiencedRetaliation"
- try generating "veteranRetaliation"
- try generating "geniusRetaliation"
- try generating "superhumanRetaliation"

b/ if you don't use a different unique label for each mission script command, OpenXcom will not be able to make sense of it... and will intentionally crash
« Last Edit: January 03, 2020, 03:43:09 pm by Meridian »

wcho035

  • Guest
Thank you for the detail answers as always Meridian.

Using the if statement and else from programing as an analogy. This conditional and label make much more perfect sense. I am using those already in my mapscript, like certain building will appear or not appear in a given battlescape mission. That is a different topic all together.

Now, I have a headache in planning out how to use all these labels and conditionals with 4 different set of retaliation. I have to find the ORDER, of which come first and last from the 4 sets. If each set has 6 varying level of difficulty. Then I have 24 to worry about.

I will only proceed with the DESIGN of using 4 different retaliation set as a final measure, unless if I can find a simpler design solution.

So, for a simpler solution.

1) First of all, I wish to understand the root of this. Why do you have 6 different kind of retaliation in the vanilla script?

This is to do with the difficulty level I assume, with minDifficulty. Unfortunately, the detail for this function in the OXCE ruleset is sparse. I can only assume minDifficulty is increase the intensity of a retaliation mission or something.

So, here are my choices.

Remove all 6 different level of retaliation and use 1 retaliation difficulty level instead. This will make the implementation of 4 different retaliation set easier.

So, the source of retaliation from my mod would come from.

1) So if a ufo get shot down, it will generate a retaliation mission

I am already having alienrace.rul using

    retaliationMission:
    retaliationAggression:

to generate retaliation mission racial to the ufo shot down.

2) Alienbase also spawn retaliation mission.

3) Retaliation missions will randomly and monthly spawn from that one universal retaliation level in missionscript instead of 6.

The 3 options above will work in harmony together?, yes or no? For generation retaliation missions in game?

I already have option 1 and 2 implemented and working. I assume option 3 would just work as well, only have one universal difficulty. I am not fuss about it.

So, any feed back welcome. No need for sample coding at this stage. Like will option 3 work just like a normal missionscript? If I only use one retaliation difficulty instead of 6.

What will the consequences be, if I use only 1 retaliation difficulty? 

 





« Last Edit: January 03, 2020, 06:07:58 pm by Precentor Apollyon »

wcho035

  • Guest
Logs