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.

Topics - Yankes

Pages: [1] 2
OpenXcom Extended / [Suggestion] Regions providing "base functions"
« on: October 27, 2022, 11:30:08 pm »
This more a fluff, more interesting would be if base placement affect what is possible to buy/recruit

OpenXcom Extended / [Discussion] Falling damage and Goomba Stomp
« on: April 07, 2022, 03:09:07 pm »
As I toy with move types and flying I conclude that current handling of falling is not satisfactory.

I think of adding option for damaging unit when it fall from heights bigger than 1 level, question is how should it be calculated and what it should "damage"?
Another thing is that falling unit always can knock out lower unit, even when its lot bigger and stronger unit, at least 2x2 units should withstand 1x1 unit and small one should be knockout instead.

Any thoughts on this topic?

OpenXcom Extended / [Documentation][y-script] Ufopedia custom info
« on: January 04, 2021, 01:45:13 am »
In recent nightly I added option for scripts to add custom info to `INFO` button from ufopedia.
For now supported is:
Code: [Select]
      - offset: 1
        code: |
          # rule <- name of variable that have given rule object, every script hook use same names.
          # geoscape_game <- current game, you can check if you have research to show some info
      - offset: 1
        code: |
          #current available operations.
          stats_state.addIntRow "The Answer to the Ultimate Question of Life, The Universe, and Everything" 42;
          stats_state.addTextRow "Can run Crisis?" "STR_TRUE";
          stats_state.addTextRow "Can run CyberPunk 2077?" "STR_FALSE";
          stats_state.addTextFormatRow "Format" "test1 {0}%" 1;
          stats_state.addTextFormatRow "Format" "test2 {0}% - {1}%" 1 2;
      - offset: 1
        code: |
      - offset: 1
        code: |

OpenXcom Extended / [Documentation] Improved item stat bonuses
« on: March 21, 2020, 05:29:23 pm »
In new version of OXCE all stats bonuses in items can now access to weapons and ammo from calculated attack.
This right now only available on script level as items on its own do not have any stats to read.

Scripts now have new variables with new info:
Code: [Select]

This mean ammo can now affect accuracy of weapon and weapon can affect damage of ammo, not mentioning that each attack type can have different power.

OpenXcom Extended / [Documentation] Health loss for geoscape solders
« on: March 21, 2020, 05:22:56 pm »
New functionality based on logic used by,7241.0.html

This mean this is make health work more similar to mana. As bonus mana and health loss can be consider as "wound" and prevent unit from participating in training or fighting (forced base defense still allow unit to defend base if total health loss is less than limit)
Code: [Select]
  #rest stay configs same
  woundThreshold: 200 #how much % of base mana cause unit to be consider "wounded"
  replenishAfterMission: true

  woundThreshold: 100 #how much % of base health cause unit to be consider "wounded"
  replenishAfterMission: true

For base facilities:
Code: [Select]
  - type: STR_MAGE_GUILD
    heathRecoveryPerDay: 3
Similar to mana this not stack, only max is taken.

Scripts now have access to both this values (mana and health loos) in script:
You can access and modify it by:
Code: [Select]
      - offset: 1
        code: |
          set final_health_loss 13;
          set final_mana_loss 21;
          set recovery_time 0; #disable wound recovery time

Health "loss" is orthogonal to current wound status. You can mod game to simulate "wound" as heavy damage that make need hospitalization for some time, and health loss is small damage that soldier can heal by resting and still is battle ready. If you use `woundThreshold` then lot of health loss can still make unit have state "wounded", another important functionality is that mana and health regen only if unit is not really "wounded".

Fan-Stuff / Room of "Real" X-Com commander
« on: June 17, 2018, 11:51:24 pm »
Probably most accurate real life place to X-Com command room:

Programming / Some bugs find in code
« on: April 27, 2018, 06:02:36 pm »
Doing other work I find couple dodgy parts in this function implementation.

First it not support multi purpose buildings because of `else if` (it will ignore cleanup of other functions)

Another is usage of `(*facility)->getCraft()` that look it should only be used for display purpose. What will happen when you use multiple crafts per hangar or craft is on mission when base was attacked?

`getUsedHangars()` is call for each `_productions` even if do not need this value because type `getCategory()` is not craft. This is very heavy function and in each iteration value is same (until you remove something but then `break;` is done and you do not call it any more).

Help / [Request] Map with maximum move graphic glitchs
« on: April 17, 2018, 02:42:14 am »
Right now I finishing code that improve draw order of unit when its is moving.
I would need some condensed map that have multiple places where current drawing routine bugs out.
Another thing is that I need test my code if I do not introduce new bugs.

Is anyone have or create maps that could fit this purpose? I would need work with basic OXC, OXCE+ will be done when basic game is fix.

OpenXcom Extended / [Documentation][y-script] OXCE Script examples
« on: January 29, 2017, 05:11:23 pm »
Parrot animation:
Code: [Select]
  - type: PARROT_ARMOR
    drawingRoutine: 4
      selectUnitSprite: |
        #this script will always run move animation of unit.
        var int temp;
        var int walking;
        unit.isWalking walking;
        if eq walking 0;
          unit.getId temp;
          offsetmod temp 11 0 8; #desync animation of different units
          add temp anim_frame;
          wavegen_saw temp 8 8 7;
          mul sprite_offset 8;
          add sprite_offset 8;
          add sprite_offset temp;
          set sprite_index sprite_offset;
          add sprite_index sprite_offset;
        return sprite_index;

2x2 unit animation:
Code: [Select]
  - type: TANK_ARMOR
    drawingRoutine: 20
    movementType: 1
    spriteSheet: FDEAMON.PCK
      selectUnitSprite: |
        var int temp;
        var int walking;
        var int floating;
        unit.isWalking walking;
        unit.isFloating floating;
        if and eq walking 0 eq floating 1;
          unit.getId temp;
          offsetmod temp 11 0 8; #desync animation of different units
          add temp anim_frame;
          wavegen_saw temp 4 4 4;
          add sprite_offset 1;
          add sprite_offset temp;
          add sprite_index sprite_offset;
          add sprite_index sprite_offset;
        return sprite_index;

Animation for Floater
Code: [Select]
  - type: FLOATER_ARMOR0
    drawingRoutine: 1
      selectUnitSprite: |
        var int temp;
        var int walking;
        unit.isWalking walking;
        if and eq walking 0 eq blit_part BODYPART_TORSO;
          unit.getId temp;
          offsetmod temp 11 0 8; #desync animation of different units
          add temp anim_frame;
          wavegen_saw temp 5 5 5;
          mul sprite_offset 5; # `drawingRoutine: 1` have blocks of 5 frames per direction, we convert `0,1,2,...` to `0,5,10,...` offsets
          add sprite_offset temp;
          add sprite_index 8; #moving animations frames starts after 8 standing one
          add sprite_index sprite_offset;
          add sprite_index sprite_offset;
        return sprite_index;

Hit confirm by red "flash":
Code: [Select]
      LAST_HIT_FRAME: int

      - offset: 10
        code: |
          var int temp;
          battle_game.getAnimFrame temp;
          unit.setTag Tag.LAST_HIT_FRAME temp;

      - offset: 10
        code: |
          var int temp;
          unit.getTag temp Tag.LAST_HIT_FRAME;
          if neq temp 0;
            sub temp anim_frame;
            if gt temp -3; #only 3 frames after hit have changed color
              set_color new_pixel 2; #red color
          return new_pixel;

OpenXcom Extended / OXCE Future plans
« on: January 29, 2017, 04:50:33 pm »
Current plans

For 5.0 version

setting ammo count in scripts.
script that disable weapons.
weapon/throw accuracy scripts.
hangar types
scripts events on item uses.
script events for moving items in inventory (this will allow e.g. ring with +10hp).

For some future version

directional flashlight.
change border of hand items in inventory based on usability.
script that disable weapons.
new script arguments for recolor and select graphic script with information about unit selection or cursor hovering over it.
Ability to draw custom graphic over any unit/item by script.
script for calculation unit recovery time.
script handling of behavior of end of grenade countdown (explosion, removal, postponing, unpriming).
script recoloring for explosions and hit animations.
reaction multiplier accessible by script.
toggleable  fly popery for unit.
dynamic globe terrain.

Programming / Memory leak in resize map script
« on: December 24, 2016, 02:25:39 am »
In my branch I find bug that I think originate from master:,2915.msg76063.html#msg76063

In my version it crash game but in master it overwrite pointer without deleting it first.

Programming / OpenXcom 1.1
« on: December 20, 2014, 03:27:45 pm »
Isn't this time to warp thing up and create new milestone?
Most mods don't work with 1.0 if it work with Nightly and vice versa.
Lot of new stuff was added, and probably recent SupSuper patch (loading original saves) could be "selling point".

Another this is that Warboy is now focusing on TFTD it could introduce breaking changes that break mods (like recent map changes).
New milestone could create new environment for mods authors to work in without worrying about changes in nightly builds.

OpenXcom Extended / Old OXCE discussion thread
« on: September 07, 2014, 06:50:34 pm »
Extended version of OpenXcom
Mod version 4.0a
OpenXcom date:   Nightly 2018-08-17
OpenXcom commit: a6d2d32495d9a2efa5b3460a284b7be33629129d
Extended date:   2018-09-09
Extended commit: 5fb565cd9d7b31978b4a152a38b55cd389b1ffb0

Ubuntu required libs
sudo apt-get install libsdl1.2debian libsdl-mixer1.2 libsdl-gfx1.2-4 libsdl-image1.2 libyaml-cpp0.5

Behavior change

Hyper-Wave Decoder can have less than 100% chance to detect aliens.
Explosions don't remove unconscious unit if they can't kill them first.
Craft weapon equip screen is a bit rearranged.
Fixed "weapons" like the Medikit are now equipped by unit.
Psi-Amp use 3d range, not 2d.
Psi-Amp can use weapon power.
Fixed ammo are added after weapons in armor and unit (armor items are before unit items).
Corpses, items and Chryssalids are not spawned when unit is killed by weapons with overkill.
Stunned units can be hited by bullets and fire.
Big groups of aliens (20+) get less morale losses from casualties.
Terror units can now spawn with any built-in weapon, not only one defined by name.
While loading and unloading weapons you must pay the cost of moving the item to hand.
You can unprime granade for half of prime TUs cost.
Support for Ufo2000 armor damage type.
Psi-Amp can now obey maximum weapon range.
Psi-Amp can now deal direct damage using special attack type in popup menu.
Throwing now requires a healthy arm to do it (if the item is two-handed, then it requires both).
You can hit aliens in the head using any item you like, not only firearms stock.
Items can now be non-throwable.
Rewriten handling of alien psi attacks to handle new features of Psi-Amp.
Building, manufactures and research can now have special requirements for buildings available in base.
Throwing and hitting using two-handed weapons have the same penalty as with shooting.

You can train your solders basic skills.
Aliens weapon types/weapons can have different turn restriction.
You can rename weapon slot names in geoscape craft info.

Rewritten item use cost. Now is possible to spend HP, Morale or grain stun damage from using items.
You can't use old `energy*` properties in item, they are removed and replaced by new one in `cost*`.
Item have now range threshold unit they start calculating range power reduction.
Damage type can now change default power change per tile in explosion.

Option for custom weapon deploy for alien missions and ufos.

Options for customizing retaliation mission after shooting dow ufo.
Options for adding custom dodge chance or unit psi defence.

Breaking change: Psi-Amp use now weapon dropoff and aimRange for attack chance.
Breaking change: Drop support for Regeneration stat in armor. Use new regen stats now.
Inventory screens can now have up to 128 backgrounds.
Unit sprites recolors can now support up to 128 values.
Option for custom change of TU, HP, Energy, Morale or Stun after next turn based on unit stats.
New stat bonus based on stun level of unit.
Option for changing fuse type in granades and flare.
Option for pre-priming granades on map spawn.
Option for dodge chance based on direction of attack.
Oprion for bonus morale recovery when using medkit.
Option for self heal using medikit.

Craft can now have up to 4 different wepon type per slot.
Oprion for overriding shape of alien base.
Option for setting chance of special effect of item.
Moving can trigger all close proxy not only one.
Corpse explosion now can have bonus based on unit stats.
Grenades now can explode at once without destroying each others.

Option for custom sound and animation for miss attack and psi weapons.

Option for defining percent of all action cost stats. Old use of `flatPrime` and `flatThrow` is deprecated.
Facilities can now require items to build.
Medikit can now be used without UI and can use `hitSound`.

Option for defining bonus and damage type for melee in range weapons.
Option for big explosion sound for each items.
Option for showing fixed weapons on unit.

Update to nightly and bug fix.

Scripting support in unit graphic (more info in game log with debug on).
`bigSpriteAlt` and `floorSpriteAlt` is now obsolete, will be replaced by scripts in next version.
New property `refNode` used to shared values between items/solders/armors etc.
Option for setting numbers of melee hits done by AI.
Control space usage of soldiers with 2x2 armors in crafts.

Backported game machanic changes from Meridian OXCE+.
Fix stun damage calculation and add random for random option for final stats change by damage.
Refactored script handling.
Script support in reaction atack chance calculations.
Some light handling improvments.
New recolr and replace script graphic option for items.
Option for global events shared by scripts.
Custom tags that have user defined values.

Base building can now prevent building other buildings.
New tag type that store other mod id.
Option for changing defualt unit light radius.
New functions exposed to script.
Reaction scripts have now information about runing or strafing of target.

New functions exposed to script.

New light system.
Option for reserving more space for mod in common surface/sound sets.
Visibility scripts that determine visibility of targets.

Update to buildin script functions.
Update to recent nightly OpenXcom.

Config for new lighting system.
New map script options made by ohartenstein23.
New scripts for items and units.
Add option for grenades to explode in hand.
Changes in handlig items with prime.
Primed granades are not recoverable if consumable property is set.

Fix couple of bugs.
Add some missed scripts.
Add damage type param to unit damage script.

Fix critical bug in unit damage function.

New params with shooting weapon and shooter to damage and hit script.
Merge chagnes from master.
Random functions in script.
Vertical map generation support.

Add multi ammo weapons.
New param with battle action for unit hit and damage script.

Bug fix.

Bug fix.
Improvments in displaying multiple ammo items in inventory.
Script altering experience grain.

Bug fix.

Bug fix.

Bug fix.

Bug fix.
Update nightly.
New grenade fuse config.

Bug fix.
Update nightly.


Damage script can now alter zombie transformation chance.
Add access to current difficulty level in scripts.
Add base function requirmets to buy items, crafts and solders.
Add access to geoscape soldier in scripts.
Add script that is run at end of mission.
Add arcing shoots per attack type (by ohartenstein23).
Breaking change: Renamed `action` to `battle_action` in reaction scripts.
Add battle action to `awardExperience` script.
Breaking change: Renamed access function to statis in armor (added prefix `Stats.`).

Bug fix.


Current working branch:

Download available on mod site (require latest nightly):


Forum thread:


Meridian for OXCE+ :)
stiansel for FOV speedup.
redv & WarBoy1982 for a couple of commits.
SolarusScorch for fixing language in readme.
SupSuper & WarBoy1982 & Daiky for OpenXcom :)

Work In Progress / [CRAFT] 4 weapon aircraft
« on: June 24, 2014, 08:14:41 pm »
I made some mockup of possible placing 2 new weapons on intercept window:

What you think about this placement?

Code is available at:

Tools / Recoloring Script
« on: April 27, 2014, 06:23:46 pm »
This is mod tool (modified OpenXcom source) for recoloring unit sprites on runtime.
To use it you need compile exe using src from
Then you can alter ruleset to add scripts.

Some example in action:

  • Reuse same graphic for multiple armors with altered colors
  • Alter look of unit based on stats (e.g. different color based on rank)
  • Special effects (e.g. show blood or fatal wounds on unit arm or leg)
  • Direct control on light shading

Every armor ruleset have new field "recolorScript" in "armors".
Code: [Select]
    recolorScript: |
      #this script is used to recolor solders hair/face colors based on nationality
      get_color r0 in;
      get_shade r1 in;
      test r0 color_hair;
      skip_eq hair;
      test r0 color_face;
      skip_eq face;
      ret in;
      add r1 soldier_hair;
      ret r1;
      add r1 soldier_face;
      ret r1;
Syntax based on assembler, every line contains
Code: [Select]
label: op arg0 arg1 arg2 arg3;label is optional and number of args depends on op.
Code: [Select]
#"Reg" is one of: "r0", "r1", "r2", "r3", "in"
#"Data" can be Reg, const value (eg "-1", "0x1F"), data from unit
#"Label" is label defined somewhere in script
#"in" reg have value of current pixel

exit; #exit script, value retunded will be from reg "in"

ret Data; #exit with value
ret_gt Data; #exit with value if test is greater
ret_lt Data; #exit with value if test is less
ret_eq Data; #exit with value if test is equal
ret_neq Data; #exit with value if test is not equal

skip Label; #skip to label
skip_gt Label; #skip to label if test is greater
skip_lt Label; #skip to label if test is less
skip_eq Label; #skip to label if test is equal
skip_neq Label; #skip to label if test is not equal

set Reg Data; #set reg
set_gt Reg Data; #set reg if test is greater
set_lt Reg Data; #set reg if test is less
set_eq Reg Data; #set reg if test is equal
set_neq Reg Data; #set reg if test is not equal

Test Data Data; #test two values

swap Reg Reg;  #swap value of two regs
add Reg Data; #add value to reg
sub Reg Data; #subtract value from reg
mul Reg Data; #multiple value of reg

muladd Reg Data Data; #multiple and add in one opeartion
muladdmod Reg Data Data Data; # Reg = (Reg * D1 + D2) % D3

wavegen_rect Reg Data Data Data; #create repeating sequence, args: x, period, rect width, rect height
wavegen_saw Reg Data Data Data; #create repeating sequence, args: x, period, sawtooth width, sawtooth cut out height
wavegen_tri Reg Data Data Data; #create repeating sequence, args: x, period, triangle width, triangle cut out height

div Reg Data; #division reg by value
mod Reg Data; #modulo reg by value

shl Reg Data; #left shift reg by value
shr Reg Data; #right shift reg by value

get_color Reg Data; #extract pixel color form value to reg
set_color Reg Data; #set pixel color in reg to value
get_shade Reg Data; #extract pixel shade form value to reg
set_shade Reg Data; #set pixel shade in reg to value
add_shade Reg Data; #add value to pixel shade in reg

All available data for script:
Code: [Select]

blit_part #what sprite part is now edited

#posible values:
blit_collapse #dying animation and corpse on ground
blit_inventory #corpse in inventory screen

anim_frame #number of current frame
shade #0 - light, 16 - dark


fatalwounds #sum of fatalwounds


unit_float #is floating
unit_kneel #is kneeling

soldier_hair #solder hair color based on soldier_look
soldier_face #solder face color based on soldier_look

soldier_look #current solder look

#posible values:

soldier_grender #current solder grender

#posible values:

#const colors
color_hair #color group of hair color in solder sprite
color_face #color group of hair color in solder sprite

color_brown0 #equal color_face
color_brown1 #equal color_face

Possible future extensions:
Recolor scripts for weapons.
Recolor scripts for paperdoll in inventory.
Use script for selecting different sprite index e.g.:
Code: [Select]
    spriteScript: |
      test blit_part blit_torso;
      ret_neq in;
      test soldier_grender soldier_grender_female;
      ret_neq in;
      ret sprite_female_torso;

Pages: [1] 2