Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - zRrr

Pages: [1] 2 3
1
OpenXcom Extended (OXCE) / Re: OXCE (OpenXcom Extended) main thread
« on: April 17, 2025, 04:21:26 am »
Yankes, I think commit b752a37175724457721302bea1f03003d774f232 removed sniper/spotter feature that when multiple bullets/AoE vs large unit kill spotter in a single action, spotter does not spot shooter. Maybe it is now possible to implement it with scripts for shotguns and aoe vs large, but I don't see such possibility for autofire.

Also in the same commit, call to _unit->resetTurnsSince(); in src/Battlescape/UnitDieBState.cpp resets _turnsSinceStunned to 255, for newly stunned units.

2
Quote
so perhaps make an enemy unviable for XP gains only from the moment they get KO'd (and for the rest of the battle since KO).

While this attempt to force everyone to keep hands above the covers is silly, feature as quoted above can be done with scripts. I've also added similar treatment of mindcontrolled enemies and broke/fixed melee medikits, which won't give xp for friendly bonking with this script. Side effects include less XP for AoE vs large and shotguns than in unmodded game, when unit gains enough stun before all hits are resolved, but that fits request as written.

Code: [Select]
extended:
  tags:
    BattleUnit:
      IXP_HOSTILE_UNIT_XP_BLOCK_LEVEL: int
     
  scripts:
    newTurnUnit:
      - new: IXP_CHECK_IF_HOSTILE_IS_UNDER_MIND_CONTROL
        offset: -99
        code: |
          #
          # Hitting MC'd enemy unit does not give xp, and since they can't be uncontrolled until next faction half-turn,
          # change of half-turns is as good as anything to detect MC
          #
         
          var int currentFaction;
          var int originalFaction;
         
          unit.getFaction currentFaction;
          unit.getOriginalFaction originalFaction;
         
          if and eq originalFaction FACTION_HOSTILE
                 neq currentFaction FACTION_HOSTILE;
            unit.setTag Tag.IXP_HOSTILE_UNIT_XP_BLOCK_LEVEL 2;
          end;
         
          return;
         
    damageSpecialUnit:
      - new: IXP_CHECK_IF_HOSTILE_UNIT_WILL_BE_STUNNED
        offset: 99 # need this to run last
        code: |
          # call order:
          #   hitUnit
          #   damageUnit
          #   damageSpecialUnit
          #   awardExperience
          #
          # so first attack that does stun need to give xp, but nothing after that
          #
         
          var int unitOriginalFaction;
          var int xpBlockLevel;
         
          #check if this is inflicted by player and not enviro/traps?
          #debug_log "IXP:::  damageUnitSpecial, unit:" unit;
         
          unit.getOriginalFaction unitOriginalFaction;
          if neq unitOriginalFaction FACTION_HOSTILE;
            return;
          end;
         
          unit.getTag xpBlockLevel Tag.IXP_HOSTILE_UNIT_XP_BLOCK_LEVEL;
         
          if eq xpBlockLevel 1;
            #debug_log "IXP:::      unit was previously stunned, xp block <- 2";
            unit.setTag Tag.IXP_HOSTILE_UNIT_XP_BLOCK_LEVEL 2;
          else eq xpBlockLevel 0;
            var int unitHealth;
            var int unitStun;
           
            unit.getHealth unitHealth;
            unit.getStun unitStun;
           
            #debug_log "IXP:::      hp:" unitHealth ", stun:" unitStun;
         
            # from BattleUnit::isOutThresholdExceed
            #   return getHealth() <= 0 || getHealth() <= getStunlevel();
            if le unitHealth unitStun;
              unit.setTag Tag.IXP_HOSTILE_UNIT_XP_BLOCK_LEVEL 1;
            end;
          end;
         
          return;
     
    awardExperience:
      - new: IXP_NO_XP_FOR_YOU
        offset: 1
        code: |
          var int targetCurrentFaction;
          var int targetOriginalFaction;
          var int weaponIsMedikit 0;
          var int xpBlockLevel 0;
         
          #debug_log "IXP:::  awardExperience for unit:" unit;
           
          if eq experience_multipler 0;  # already no xp for this action, exit
            return 0;
          end;
         
          unit.getFaction targetCurrentFaction;
          unit.getOriginalFaction targetOriginalFaction;
         
          begin; # set weaponIsMedikit
            var ptr RuleItem weaponRule;
           
            weapon.getRuleItem weaponRule;
            weaponRule.getBattleType weaponIsMedikit;
            if eq weaponIsMedikit BT_MEDIKIT;
              set weaponIsMedikit 1;
            else;
              set weaponIsMedikit 0;
            end;
          end;
         
          # allow whatever xp medikit healing awards in oxce code,
          #   it's not like player would staple poor G.O.s for extra BRA when they have nice fat regenerating hyenas available
          # but bonkin frens with medikit is not allowed (then again, rod of bliss exists)
          if eq weaponIsMedikit 1;
            if eq battle_action BA_USE;
              return experience_multipler;
            else neq targetOriginalFaction FACTION_HOSTILE;
              #debug_log "IXP:::      no xp: friendly unit hit with melee medikit";
              return 0;
            end;
            # this is melee attack on hostile with medikit
          end;
         
          if neq targetOriginalFaction FACTION_HOSTILE; # if target is not alien, this script no longer cares
            return experience_multipler;
          end;
         
          # first attack that stuns this unit set xpBlockLevel to 1
          #   later attacks upgrade it to 2
          #   being mc'd makes it 2
          # attacks against this unit only give xp if level is 0 or 1
          unit.getTag xpBlockLevel Tag.IXP_HOSTILE_UNIT_XP_BLOCK_LEVEL;
          if gt xpBlockLevel 1;
            #debug_log "IXP:::      no xp: unit was stunned or mindcontrolled before";
            return 0;
          end;
         
          return experience_multipler;
       

As immersive as repeatedly knocking terminator down gets, awarding xp based on how threatening target actually is, increases script size too much.

3
Since 8.0.4 y-script refuses to parse hexadecimal numbers with 'A'-'F' in them. Hex numbers with just decimal digits are fine.

Code: [Select]
extended:
  scripts:
    newTurnItem:
      - new: INT_0x111
        offset: 10
        code: |
          debug_log "test 0x111" 0x111;
          return;
         
      - new: INT_0x1A
        offset: 10
        code: |
          debug_log "test 0x1A" 0x1A;
          return;

      - new: INT_0xAA
        offset: 10
        code: |
          debug_log "test 0xAA" 0xAA;
          return;
         
      - new: INT_0xA000
        offset: 10
        code: |
          debug_log "test 0xA000" 0xA000;
          return;
         
      - new: INT__0x1a
        offset: 10
        code: |
          debug_log "test 0x1a" 0x1a;
          return;

logs:

Code: [Select]
[11-02-2025_17-08-14] [ERROR] Error in parsing script 'newTurnItem' for 'Global:INT_0x1A': invalid argument '0x1A' in line: 'debug_log "test 0x1A" 0x1A;' (at 1)
[11-02-2025_17-08-14] [ERROR]     for node with code at line 42 in D:/games/_openxcom-extended/user/mods/__int-literals-test/int-literals-test.rul
[11-02-2025_17-08-14] [ERROR]
[11-02-2025_17-08-14] [ERROR] Error in parsing script 'newTurnItem' for 'Global:INT_0xAA': invalid argument '0xA' in line: 'debug_log "test 0xAA" 0xAA;' (at 1)
[11-02-2025_17-08-14] [ERROR]     for node with code at line 48 in D:/games/_openxcom-extended/user/mods/__int-literals-test/int-literals-test.rul
[11-02-2025_17-08-14] [ERROR]
[11-02-2025_17-08-14] [ERROR] Error in parsing script 'newTurnItem' for 'Global:INT_0xA000': invalid argument '0xA' in line: 'debug_log "test 0xA000" 0xA000;' (at 1)
[11-02-2025_17-08-14] [ERROR]     for node with code at line 54 in D:/games/_openxcom-extended/user/mods/__int-literals-test/int-literals-test.rul
[11-02-2025_17-08-14] [ERROR]
[11-02-2025_17-08-14] [ERROR] Error in parsing script 'newTurnItem' for 'Global:INT__0x1a': invalid argument '0x1a' in line: 'debug_log "test 0x1a" 0x1a;' (at 1)
[11-02-2025_17-08-14] [ERROR]     for node with code at line 60 in D:/games/_openxcom-extended/user/mods/__int-literals-test/int-literals-test.rul

4
Thanks

No more starting missions unprepared because I accidentally clicked Ok. Now only starting missions unprepared because I deliberately clicked Ok :)

5
The X-Com Files / Re: Accuracy Bug?
« on: December 23, 2024, 03:36:00 pm »
I guess it's because first guy has Carapace Plate equipped. XCFAA has script that reduces accuracy if soldier has some vests or gas masks on. Script seems to have logic issue, because when soldier has any kind of type 1 or 2 protective gear, it replaces weapon accuracy formula with just soldier firing stat.

To test, unequip everything except rifle and pass a turn (protective gear stuff updates on turn start)

6
The X-Com Files / Re: Bugs, crashes, typos & bad taste
« on: December 08, 2024, 06:38:41 pm »
Some songs are still placeholders, and in one case there's no title because I have no idea where it came from, but since you guys insisted - there you go. Please confirm if it works.

Nice, thank you.

Looks like PREDATOR has slipped through (from The Root of All Evil, STR_BLACK_LOTUS_SHRINE)

7
The X-Com Files / Re: Bugs, crashes, typos & bad taste
« on: December 07, 2024, 11:14:19 pm »
Nonfunctional jukebox bothers me also. Sometimes I want to hear Frontier Psychiatrist in the middle of Dimension X, sometimes I don't, and sometimes hour into mission I just need to switch things. Fortunately there is a relatively noninvasive solution.

Jukebox on battlescape only shows current track and tracks that have 'GMTAC' in their names. Similarly, when picking music for battlescape, game randomly selects track containing one of strings from music: section in deployment. By changing track definition from

Code: [Select]
musics:
...snip...
  - type: FRO_PSY
    normalization: 1.0
...snip...

to

Code: [Select]
musics:
...snip...
- type: FRO_PSY_GMTAC # internal id used to reference track in ruleset
  name: FRO_PSY  # file name
  normalization: 1.0
...snip...

it will satisfy both deployment and jukebox, without any other edits.

Here is the mod that does this to all battlescape tracks. A list of song names would be nice to have to make it look better.

8
OXCE Suggestions DONE / Re: Converting OXCE to rapidyaml
« on: December 01, 2024, 07:12:05 pm »
Typo in BattleUnit.cpp:633 ("turrentType") makes HWPs lose turrets when reloading saved game.

Also, https://github.com/Yankes/OpenXcom/tree/stash/rapidyaml-rc0 is the only version that works for me, when I build with VS 2019. Others crash when attempting to read any metadata.yml with stack trace similar to one in psavola post about linux appimage earlier.

Code: [Select]
[01-12-2024_19-50-36] [FATAL] A fatal error has occurred: Memory access violation.
[01-12-2024_19-50-36] [FATAL] 0x4b04f0 c4::yml::NodeType::is_map (node_type.hpp:166)
[01-12-2024_19-50-36] [FATAL] 0x4b0550 c4::yml::Tree::is_map (tree.hpp:407)
[01-12-2024_19-50-36] [FATAL] 0x6dd4c0 c4::yml::detail::RoNodeMethods<c4::yml::ConstNodeRef,c4::yml::ConstNodeRef>::is_map (node.hpp:239)
[01-12-2024_19-50-36] [FATAL] 0xa54b00 OpenXcom::YAML::YamlNodeReader::isSeq (Yaml.cpp:164)
[01-12-2024_19-50-36] [FATAL] 0x89dda0 OpenXcom::FileMap::scanModDir (FileMap.cpp:1144)
[01-12-2024_19-50-36] [FATAL] 0x913200 OpenXcom::Options::refreshMods (Options.cpp:863)
[01-12-2024_19-50-36] [FATAL] 0x914330 OpenXcom::Options::updateMods (Options.cpp:1024)
[01-12-2024_19-50-36] [FATAL] 0xbf5670 OpenXcom::StartState::load (StartState.cpp:310)
[01-12-2024_19-50-36] [FATAL] 0xf80c710 SDL_KillThread
[01-12-2024_19-50-36] [FATAL] 0xf80ca40 SDL_SemWaitTimeout
[01-12-2024_19-50-36] [FATAL] 0xf80ca40 SDL_SemWaitTimeout
[01-12-2024_19-50-36] [FATAL] 0x722f690 crt_at_quick_exit
[01-12-2024_19-50-36] [FATAL] 0x75e9342b BaseThreadInitThunk
[01-12-2024_19-50-36] [FATAL] 0x770e979f RtlInitializeExceptionChain
[01-12-2024_19-50-36] [FATAL] 0x770e979f RtlInitializeExceptionChain

upd: changing FileRecord::getYAML() from
Code: [Select]
YAML::YamlRootNodeReader reader(data, fullpath);
return reader;
to
Code: [Select]
return YAML::YamlRootNodeReader(data, fullpath);fixed it. Witchcraft!

9
I'd like to report a bug I can't solve myself and I hope for some assistance.

When starting the Citizens vs. Monsters mission (STR_MONSTER_VS_MOB_JUNGLE), my briefing screen is broken - see attached. Everything else works just fine.

You have XComFilesMusic active, and it overrides bunch of mission briefings to replace music, like so:

Code: [Select]
  - type: STR_MONSTER_VS_MOB_JUNGLE
    briefing:
      music: DW_SHOCK
    music:
      - AS_2_AMBIENT_03

This probably replaces entire briefing data, not just music field, so oxce fills in what it can from deployment name and leaves everything else.

Look at dagon manors for same issue.




10
I was trying out OXCE 7.14 and looking inside \user\options.cfg
and I could not find "extendedExperienceAwardSystem:" listed anywhere.  Is this variable listed somewhere else that can be changed?

 I would like to train exp by mind controlling the aliens as this was a core playstyle I've always enjoyed.  The new experience window in the latest build is beautiful with ctrl + shift + E.  Thank you for adding the window!

Attached extendedExperienceAwardSystem: false in mod form as disable-extended-experience-award-system.zip.
If you just want to use mind controlled aliens as punching bags and keep rest of extended experience award system, hitting-mced-aliens-gives-xp.zip should do that.

11
In Battlescape/InventoryState.cpp _btnArmor uses same element id as _btnOk, so when I move Ok button with ruleset like

Code: [Select]
interfaces:
  - type: inventory
    elements:
      - id: buttonOK
        pos: [213, 1]

armor selection also moves.


12
The X-Com Files / Re: [submod] X-Com Files: Random Enemy Stats (1.0.0)
« on: August 27, 2024, 06:33:23 pm »
You may want to add call to unit.setHealth unitStat;. BattleUnit.Stats.* sets maximum stat value, current health value needs to be set separately to avoid stat penalties for missing health. Also setTimeUnits, setEnergy and setMana.

Code: [Select]
          #health:
          unit.Stats.getHealth unitStat;
          if gt unitStat 0;
            set minValue unitStat;
            set maxValue unitStat;
            muldiv minValue minPercent 100;
            muldiv maxValue maxPercent 100;
            battle_game.randomRange unitStat minValue maxValue;
            unit.Stats.setHealth unitStat;
            unit.setHealth unitStat; ### <--- here
            #debug_log "Unit" unitID "Health (" minValue "-" maxValue "):" unitStat;
          end;

13
Thanks

Resulting mod:
  • alt - to highlight all units
  • ctrl - highlights player-controlled units with grenades/proxies in hands (can't access all inventory), changes floor sprite for active grenades and proxies last carried by xcom or mc'd aliens to flag (but game draws heaviest item on tile, so map is stil better)
  • shift - highlights units without xp (similar to ctrl+e)

14
Can be useful, but will also need access to NV color from options, or some function that converts color to NV mode.

Currently recolors override NV completely, which is good for my use case, I like things to stand out.


15
Add ability check if ctrl, alt or shift are pressed to recolorUnitSprite, recolorItemSprite, selectUnitSprite and selectItemSprite scripts.

This can be useful to highlight units, items on the ground, units with primed timed explosives, units without xp, remaining shield capacity, active proxies and other stuff.

Pages: [1] 2 3