aliens

Author Topic: [OLD] Old OXCE discussion thread  (Read 663225 times)

Offline Dioxine

  • Commander
  • *****
  • Posts: 5412
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: [EXE] OpenXcom Extended
« Reply #840 on: July 11, 2016, 07:01:50 pm »
Ack, damagetype overrides? So I need to make the custom shared setting with every possible property set in the damageAlter, including res type, damage roll, blast propagation etc? Since you can't have a weapon with an undefined damage type?

Offline Yankes

  • Moderator
  • Commander
  • ***
  • Posts: 3194
    • View Profile
Re: [EXE] OpenXcom Extended
« Reply #841 on: July 11, 2016, 07:38:33 pm »
`damageType` is only for backward compatibility, this is why he always override `damageAlter`.
Setting `damageType` set default `damageAlter` and `blastRadius`. If you set in one node `damageAlter` and `damageType` then `damageAlter` will override default values from `damageAlter`.

Some example:
Code: [Select]
customNodeA: &A
  damageType: 1
  damageAlter: ... #its override damage type 1
customNodeB: &B
  refNode: *A
  damageAlter: ... #its override damage type 1
customNodeC: &C
  refNode: *B
  damageType: 2 #overide all changes from B
customNodeD: &D
  refNode: *C
  damageAlter: ... #its override damage type 2 from node C
If this is too cumbersome to use, I can in next version add `refNode` directly to `damageAlter`. With that you will have something like that:
Code: [Select]
item:
  - type: STUN_ITEM_A
    damageType: 5 #I hope this is stun damage value :>
    damageAlter:
      refNode: *SomePredefinedValuesForStun
  - type: NOT_STUN_ITEM_B
    damageType: 3
    damageAlter: #behave similar to stun but properties not set in `SomePredefinedValuesForStun` will be inherited from `damageType: 5`
      refNode: *SomePredefinedValuesForStun

If you really want, you can drop `damageType` and use `ResistType` in `damageAlter`.

Offline Dioxine

  • Commander
  • *****
  • Posts: 5412
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: [EXE] OpenXcom Extended
« Reply #842 on: July 13, 2016, 03:38:41 pm »
Ack, unfucking everything line by line still looks less work-intensive than either of this: I'd need to add lines to every item PLUS make script declarations (which is sort of black magic - I have no idea about traps like damagetype overriding damagealter). What would really help is moddable default damage settings. Thanks anyway.

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
Re: [EXE] OpenXcom Extended
« Reply #843 on: July 17, 2016, 06:50:06 am »
Ok, I'm at the point of trying to test the Alt-Corpse script.   

I've created a script for both floorobs, and bigobs.  For this test, I've trimmed it down to just floorobs by commenting out the bigobs portion.
The script is included in the code section below.

Code: [Select]
extended:
  tags:
    RuleArmor:
      CORPSE_SWITCH_ENABLED: int
      CORPSE_SWITCH_RESOURCES_MOD: RuleList
      CORPSE_SWITCH_SPRITE_FLOOR_STUN: int
      CORPSE_SWITCH_SPRITE_FLOOR_WOUND: int
      CORPSE_SWITCH_SPRITE_FLOOR_DEAD: int
      CORPSE_SWITCH_SPRITE_BIG_STUN: int
      CORPSE_SWITCH_SPRITE_BIG_WOUND: int
      CORPSE_SWITCH_SPRITE_BIG_DEAD: int
     
  scripts:
    selectItemSprite:
      - offset: 1
        code: |
          var int curr_hp;
          var int curr_wounds;
          var int temp;
          var ptr BattleUnit unit;
          var ptr RuleArmor armor;
         
          item.getBattleUnit unit;
          unit.getRuleArmor armor;
          if neq armor null;
            # begin testing status of for floor ob graphics
            if eq blit_part blit_item_floor;
              unit.getHealth curr_hp;
              unit.getFatalwoundsTotal curr_wounds;w
              armor.getTag temp Tag.CORPSE_SWITCH_ENABLED;
              if eq temp 1;
                if le curr_hp 0;
                  armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_FLOOR_DEAD;
                else gt curr_wounds 0;
                  armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_FLOOR_WOUND;
                else;
                  armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_FLOOR_STUN;
                end;
                armor.getTag temp Tag.CORPSE_SWITCH_RESOURCES_MOD;
                rules.getSpriteOffsetFloorob sprite_index temp;
                return sprite_index;
              end;
            # begin testing status of for big ob graphics
            #if eq blit_part blit_item_floor;
            #  unit.getHealth curr_hp;
            #  unit.getFatalwoundsTotal curr_wounds;w
            #  armor.getTag temp Tag.CORPSE_SWITCH_ENABLED;
            #  if eq temp 1;
            #    if le curr_hp 0;
            #      armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_BIG_DEAD;
            #    else gt curr_wounds 0;
            #      armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_BIG_WOUND;
            #    else;
            #      armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_BIG_STUN;
            #    end;
            #    armor.getTag temp Tag.CORPSE_SWITCH_RESOURCES_MOD;
            #    rules.getSpriteOffsetBigobs sprite_index temp;
            #    return sprite_index;
            #  end;
            #end;
          end;
          add sprite_index sprite_offset;
          return sprite_index;
#usage
#armors:
#  - type: STR_NONE_UC
#    tags:
#      CORPSE_SWITCH_ENABLED: 1 #1 enable this functionality for this unit, 0 disable
#      CORPSE_SWITCH_RESOURCES_MOD: current #to what mod sprites belongs to, `current` mean this mod.
##      CORPSE_SWITCH_RESOURCES_MOD: master #to what mod sprites belongs to, `current` mean this mod.
#      CORPSE_SWITCH_SPRITE_FLOOR_STUN: 1001
#      CORPSE_SWITCH_SPRITE_FLOOR_WOUND: 1002
#      CORPSE_SWITCH_SPRITE_FLOOR_DEAD: 1003
#      CORPSE_SWITCH_SPRITE_BIG_STUN: 2001
#      CORPSE_SWITCH_SPRITE_BIG_WOUND: 2002
#      CORPSE_SWITCH_SPRITE_BIG_DEAD: 2003

Beyond this, I've got two rulesets, one to define all the sprites, and one to set the tag on the armors, as well as pass the sprite numbers for each state.

For my test, I've trimmed down the corpses to only the "Bandit" faction in my rulesets by commenting out all the others.

I fire up the game. Ensure the mod is on. The game reloads.  So far, so good.  I decide to use "New Battle" to generate a battle with the Bandit faction, equipping the troops.  When I go to start the battle I get a CTD. 

Checking the openxcom.log I spot the following error:
Code: [Select]
[16-07-2016 20:11:24] [ERROR] Error in parsing script 'selectItemSprite' for 'Global Event Script': invalid operation in line: 'w
    armor.getTag temp Tag.CORPSE_SWITCH_ENABLED;'

Should the "temp" be in that line?  Or have I messed up something broader?

I'll attach the mod itself here for trouble shooting too.

Offline Yankes

  • Moderator
  • Commander
  • ***
  • Posts: 3194
    • View Profile
Re: [EXE] OpenXcom Extended
« Reply #844 on: July 17, 2016, 01:19:16 pm »
Code: [Select]
invalid operation in line: 'wDo you see this "w"?
Code: [Select]
unit.getFatalwoundsTotal curr_wounds;wI see you use first version of this script, I fix couple of bugs in it after posting it.
You probably did not see my edits.

This should be finial version:
Code: [Select]
  scripts:
    selectItemSprite:
      - offset: 1
        code: |
          var int curr_hp;
          var int curr_wounds;
          var int temp;
          var ptr BattleUnit unit;
          var ptr RuleArmor armor;
         
          item.getBattleUnit unit;
          unit.getRuleArmor armor;
          if neq armor null;
            unit.getHealth curr_hp;
            unit.getFatalwoundsTotal curr_wounds;
            armor.getTag temp Tag.CORPSE_SWITCH_ENABLED;
            if eq temp 1;
              armor.getTag temp Tag.CORPSE_SWITCH_RESOURCES_MOD;
              if eq blit_part blit_item_floor;
                if le curr_hp 0;
                  armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_FLOOR_DEAD;
                else gt curr_wounds 0;
                  armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_FLOOR_WOUND;
                else;
                  armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_FLOOR_STUN;
                end;
                rules.getSpriteOffsetFloorob sprite_index temp;
                return sprite_index;
              else eq blit_part blit_item_big;
                if le curr_hp 0;
                  armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_BIG_DEAD;
                else gt curr_wounds 0;
                  armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_BIG_WOUND;
                else;
                  armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_BIG_STUN;
                end;
                rules.getSpriteOffsetBigobs sprite_index temp;
                return sprite_index;
              end;
            end;
          end;
          return sprite_index;

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
Re: [EXE] OpenXcom Extended
« Reply #845 on: July 17, 2016, 05:09:41 pm »
Thanks a ton, I knew it was probably something simple. :)
I must have gotten my version messed up.

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
Re: [EXE] OpenXcom Extended
« Reply #846 on: July 17, 2016, 06:17:38 pm »
Ok, I tried out the new script (thank you).  New Battle Generation consistently crashed for me.  The final error in the log is:

Code: [Select]
[17-07-2016 07:56:13] [ERROR] Map Script not found

So I gave up on trying to use New Battle to test this.

I found an old save with a Bandit Pogrom and loaded it.  None of the fallen enemy were showing any of the new sprites, so I stunned a few with the shield.  There is a slight, but noticeable  pause when the unit completes its death animation before it comes to rest as the final floor ob image.   However, I'm still not getting the "Stunned" version of the sprite to display. 

I'm attaching a verbose log file to see if this helps.   Thanks for helping me trouble shoot this!
Ack!  The log file is too large to go up as it is. Let me try to .zip it.

Edit: also including the save file.

« Last Edit: July 17, 2016, 06:19:26 pm by ivandogovich »

Offline Yankes

  • Moderator
  • Commander
  • ***
  • Posts: 3194
    • View Profile
Re: [EXE] OpenXcom Extended
« Reply #847 on: July 17, 2016, 06:34:10 pm »
This is not "my" bug, "[ERROR]   Map Script not found". Do you have up to date xpiratez version?

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
Re: [EXE] OpenXcom Extended
« Reply #848 on: July 17, 2016, 06:40:43 pm »
This is not "my" bug, "[ERROR]   Map Script not found". Do you have up to date xpiratez version?

Yes, I do.  I'm up to date with Piratez .99, as well as Meridian's latest 3.2 of 07-16-2106. 

Any ideas why the script isn't working to replace the images?

Offline Yankes

  • Moderator
  • Commander
  • ***
  • Posts: 3194
    • View Profile
Re: [EXE] OpenXcom Extended
« Reply #849 on: July 17, 2016, 08:24:30 pm »
Do your game work without this script?
Did this script compile correctly, no errors are reported in log?
Did script run at all, you can test it by adding line `debug_log 1 1;` on top of script after declaration of variables.
If it work then you will get new log info in game log with two "0x1" values.
If you see it do unit have correctly defined tags for it? You can move `debug_log` to other lines to see if this place is executed by script.
Something like that:
Code: [Select]
debug_log 0 test; #debug accept two ints as argument to pass it to log file.
if eq test 10;
  debug_log 1 test;
end;
This is bit rough tool but allow easy see that exactly happening inside script.
It's cap at 500 lines to show because otherwise it could slow game to crawl.

I suggest turn off verbose loging because it easy hide interesting information.

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
Re: [EXE] OpenXcom Extended
« Reply #850 on: July 18, 2016, 05:15:57 am »
Ok, I've been trying a few things. 

First I read back through all the posts we have exchanged about this script.  One of the things that you mentioned was that the

Code: [Select]
extended:
  tags:
    RuleArmor:

tag needed to be in each file mod rulesets.  I have added this section to the file where I define the armors:

Code: [Select]
extended:
  tags:
    RuleArmor:
      CORPSE_SWITCH_ENABLED: int
      CORPSE_SWITCH_RESOURCES_MOD: RuleList
      CORPSE_SWITCH_SPRITE_FLOOR_STUN: int
      CORPSE_SWITCH_SPRITE_FLOOR_WOUND: int
      CORPSE_SWITCH_SPRITE_FLOOR_DEAD: int

Despite this, I'm still not getting it to work.  Upon trying to load my Bandit Pogrom save, I get a CTD.  Nothing shows up in the .log file.

I suspected that maybe my images weren't formatted with the correct palette, so I ran them through Falko's sprite tool to "fix" the battlescape palette.  Still had the same issue, so I've been trying to use your debug_log tool, but I get failures everytime I try to use it.

Code: [Select]
[17-07-2016 18:46:44] [WARN] disabling mod with invalid ruleset: BanditFloor
[17-07-2016 18:46:44] [ERROR] failed to load 'BanditFloor'; mod disabled for next startup
C:\Users\FM\Downloads\XPirateZ_Working\OpenXcom_XPiratez\user\mods/BanditFloorMod/Ruleset/altFloorCorpsesScript.rul: yaml-cpp: error at line 17, column 9: end of map not found

With the corresponding section in the script as follows:
Code: [Select]
 
scripts:
    selectItemSprite:
      - offset: 1
        code: |
        debug_log 1 1;
I tried putting it on the line directly above "scripts:" too, with the same error.

 I guess I'm not using it correctly because I don't understand it.  Also, with verbose off, I can't see if the script is loading or not. :(

Offline Yankes

  • Moderator
  • Commander
  • ***
  • Posts: 3194
    • View Profile
Re: [EXE] OpenXcom Extended
« Reply #851 on: July 18, 2016, 08:19:01 pm »
Code: [Select]
extended:
  scripts:
    selectItemSprite:
      - offset: 1
        code: |
          debug_log 1 1; #you need 2 space indent there!
Otherwise it will be threaded as next yaml element.

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
Re: [EXE] OpenXcom Extended
« Reply #852 on: July 18, 2016, 11:06:50 pm »
Ok, I did a run, with debuglogs salted in the script.

Code: [Select]
extended:
  tags:
    RuleArmor:
      CORPSE_SWITCH_ENABLED: int
      CORPSE_SWITCH_RESOURCES_MOD: RuleList
      CORPSE_SWITCH_SPRITE_FLOOR_STUN: int
      CORPSE_SWITCH_SPRITE_FLOOR_WOUND: int
      CORPSE_SWITCH_SPRITE_FLOOR_DEAD: int

  scripts:
    selectItemSprite:
      - offset: 1
        code: |
          debug_log 1 1;
          var int curr_hp;
          var int curr_wounds;
          var int temp;
          var ptr BattleUnit unit;
          var ptr RuleArmor armor;
          # var ptr RuleMod rules;
            debug_log 2 1;
          item.getBattleUnit unit;
          unit.getRuleArmor armor;
          if neq armor null;
            unit.getHealth curr_hp;
            unit.getFatalwoundsTotal curr_wounds;
            armor.getTag temp Tag.CORPSE_SWITCH_ENABLED;
              debug_log 9 1;
            if eq temp 1;
              armor.getTag temp Tag.CORPSE_SWITCH_RESOURCES_MOD;
                debug_log 3 1;
              if eq blit_part blit_item_floor;
                if le curr_hp 0;
                  armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_FLOOR_DEAD;
                    debug_log 4 1;
                else gt curr_wounds 0;
                  armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_FLOOR_WOUND;
                    debug_log 5 1;
                else;
                  armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_FLOOR_STUN;
                    debug_log 6 1;
                end;
                rules.getSpriteOffsetFloorob sprite_index temp;
                  debug_log 7 1;
                return sprite_index;
              end;
            end;
          end;
            debug_log 8 1;
          return sprite_index;

I got this result when I stabbed then stunned a unit (which then crashed the game as has been happening).  This unit should return the "stunned" corpse.
From the Log:
Code: [Select]
[18-07-2016 12:58:52] [DEBUG] Script debug log at      0x9 values:      0x1     0x1
[18-07-2016 12:58:52] [DEBUG] Script debug log at     0x12 values:      0x2     0x1
[18-07-2016 12:58:52] [DEBUG] Script debug log at     0x5d values:      0x9     0x1
[18-07-2016 12:58:52] [DEBUG] Script debug log at     0x7d values:      0x3     0x1
[18-07-2016 12:58:52] [DEBUG] Script debug log at     0xd0 values:      0x5     0x1
[18-07-2016 12:58:52] [DEBUG] Script debug log at     0xfd values:      0x7     0x1

the 0x5 line is the one indicating that it should be the stunnned corpse if I follow the logic in the script. 

Could there be a problem with the two "return sprite_index;" lines near the end of the script?  is it possible that they aren't getting the value? (and is it stored in "temp" which is used many places in the script for different values?  Is there a way I can use debug_log to tell me what value "temp" is at any, or all places in the script?

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
Re: [EXE] OpenXcom Extended
« Reply #853 on: July 19, 2016, 12:31:06 am »
I've refined it a bit more.

The script crashes before  debug has a chance to log at the last return sprite_index

Code: [Select]
         
     rules.getSpriteOffsetFloorob sprite_index temp; #logs here
   return sprite_index; #crashes before it writes here.

Offline Yankes

  • Moderator
  • Commander
  • ***
  • Posts: 3194
    • View Profile
Re: [EXE] OpenXcom Extended
« Reply #854 on: July 19, 2016, 01:13:37 am »
Could you upload whole mod, or at least test part that I could examine exactly what go wrong?
It bit strange that this two lines could crash.

BTW debug_log can output some values like: `debug_log test sprite_index`. Useful is script do something complex and you want know partial results.
Another thing is if you have some suggestions about improvements or additions to scripts?