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 - The Martian

Pages: 1 2 [3] 4 5 ... 9
31
OXCE Support / [SOLVED] Weapon vapor trails are not working?
« on: December 14, 2021, 06:37:53 pm »
I just noticed that weapons that had previously been leaving vapor trails are no longer doing so in TFTD.



I'm sure this was working earlier, but I think I've updated OXCE since then. Unfortunately I only just noticed the lack of vapor trails so I can't pin down when exactly it stopped working.

I'm running the linux version of OXCE V7.1.4 (v2021-10-24)


Here is some example code that isn't producing vapor:
Code: [Select]
items:
# [=] Debug Weapon for testing vapor trails [=]
  - type: STR_DEBUG_TEST_WEAPON
    size: 0.1
    costSell: 20000
    weight: 7
    bigSprite: 1
    floorSprite: 1
    handSprite: 0
    bulletSprite: 5
    fireSound: 1
    hitSound: 31
    hitAnimation: 46
    power: 1
    damageType: 4
    accuracyAuto: 28
    accuracyAimed: 68
    tuAuto: 1
    tuAimed: 1
    clipSize: -1
    battleType: 1
    invWidth: 1
    invHeight: 3
    vaporColor: 0
    vaporDensity: 50 # At density 50 'something' should be visible
    vaporProbability: 100 # 100% of the time a trail should be created.


Is this happening to anyone else or is it just on my end?

For convenience I've attached an example mod to this post:
Test Vapor Mod.zip

32
Help / How does the totalKillsByRace: commendation setting work?
« on: November 24, 2021, 08:17:33 am »
I'm assuming that you can record commendation sets using totalKillsByRace: for each of the [units:] [race:] that exist.

For example it sounds like an Aquatoid Soldier & Aquatoid Medic both with their [units:] [race:] variable set to race: STR_AQUATOID would both yield +1 towards this commendation's STR_AQUATOID set when killed.

UFOpaedia Site: Ruleset Reference Nightly


I was also looking through the code for Solarius Scorch's 'The X-Com Files' mod and saw this:

Spoiler:
Code: [Select]
  - type: STR_MEDAL_RACE_KILLS_NAME #KOs by faction
    description: STR_MEDAL_RACE_KILLS_UFOPEDIA
    soldierBonusTypes: [STR_MEDAL_RACE_KILLS_1, STR_MEDAL_RACE_KILLS_2, STR_MEDAL_RACE_KILLS_3, STR_MEDAL_RACE_KILLS_4, STR_MEDAL_RACE_KILLS_5, STR_MEDAL_RACE_KILLS_6, STR_MEDAL_RACE_KILLS_7, STR_MEDAL_RACE_KILLS_8, STR_MEDAL_RACE_KILLS_9, STR_MEDAL_RACE_KILLS_10]
    sprite: 3
    criteria:
      totalKillsByRace: [15, 25, 40, 60, 80, 100, 150, 200, 350, 500]

But I didn't see how you define soldierBonusTypes: for each individual type of race in the game using totalKillsByRace: as the criteria.


Is it that you need to define each as their own separate commendation?

For example something like this:

Code: [Select]
  - type: STR_COMMENDATION_AQUATOID_RACE_KILLS
    description: STR_COMMENDATION_AQUATOID_RACE_KILLS_UFOPEDIA
    soldierBonusTypes: [STR_AQUATOID_RACE_KILLS_1, STR_AQUATOID_RACE_KILLS_2, STR_AQUATOID_RACE_KILLS_3, STR_AQUATOID_RACE_KILLS_4, STR_AQUATOID_RACE_KILLS_5, STR_AQUATOID_RACE_KILLS_6, STR_AQUATOID_RACE_KILLS_7, STR_AQUATOID_RACE_KILLS_8, STR_AQUATOID_RACE_KILLS_9, STR_AQUATOID_RACE_KILLS_10]
    sprite: 3
    criteria:
       -
           1: ["STR_AQUATOID_SOLDIER", "STATUS_DEAD"]
       -
           1: ["STR_AQUATOID_SQUAD_LEADER", "STATUS_DEAD"]
       -
           1: ["STR_AQUATOID_TECHNICIAN", "STATUS_DEAD"]
       -
           1: ["STR_AQUATOID_MEDIC", "STATUS_DEAD"]
       -
           1: ["STR_AQUATOID_NAVIGATOR", "STATUS_DEAD"]
       -
           1: ["STR_AQUATOID_COMMANDER", "STATUS_DEAD"]
Code: [Select]
  - type: STR_COMMENDATION_TASOTH_RACE_KILLS
    description: STR_COMMENDATION_TASOTH_RACE_KILLS_UFOPEDIA
    soldierBonusTypes: [STR_TASOTH_RACE_KILLS_1, STR_TASOTH_RACE_KILLS_2, STR_TASOTH_RACE_KILLS_3, STR_TASOTH_RACE_KILLS_4, STR_TASOTH_RACE_KILLS_5, STR_TASOTH_RACE_KILLS_6, STR_TASOTH_RACE_KILLS_7, STR_TASOTH_RACE_KILLS_8, STR_TASOTH_RACE_KILLS_9, STR_TASOTH_RACE_KILLS_10]
    sprite: 3
    criteria:
       -
           1: ["STR_TASOTH_SOLDIER", "STATUS_DEAD"]
       -
           1: ["STR_TASOTH_SQUAD_LEADER", "STATUS_DEAD"]



33
OXCE Support / This 'Guaranteed Damage Script' isn't working (OXCE)
« on: November 20, 2021, 06:02:06 am »
(Problem)
Nothing happens when the weapon with the script's tags strikes a unit.

(Example Mod Download)
TestMod (Guaranteed Damage) V0-2.zip

(Details)
I'm trying to make a small script that will cause a weapon to deal X guaranteed damage to the struck targets HP on top of any damage caused by the weapon's normal power.

But it isn't currently yielding results.

The battle_game.flashMessage is not appearing and the health is not changing on the struck unit.


Code: [Select]
extended:
  tags:
    RuleItem:
      GUARANTEED_DAMAGE_AMOUNT_ITEM: int
      GUARANTEED_DAMAGE_ALLOWED_ITEM: int

    RuleArmor:
      GUARANTEED_DAMAGE_ALLOWED_ARMOR: int

  scripts:
    damageUnit:
      - offset: 1
        code: |
          var int DMG 0;
          var int ArmorAllowed 0;
          var int ItemAllowed 0;
          var int invert 0;
          var int WeaponCurrentPower 0;

          var ptr RuleArmor armor_rule;
          var ptr RuleItem item_rule;

          unit.getRuleArmor armor_rule;
          damaging_item.getRuleItem item_rule;


          # Load TAG values from involved item & armor
          item_rule.getTag ItemAllowed Tag.GUARANTEED_DAMAGE_ALLOWED_ARMOR;
          armor_rule.getTag ArmorAllowed Tag.GUARANTEED_DAMAGE_ALLOWED_ARMOR;
          item_rule.getTag DMG Tag.GUARANTEED_DAMAGE_AMOUNT;

          # If Armor & Weapon allow it deal the extra damage
          if eq ItemAllowed ArmorAllowed;

            # Apply Extra Damage Directly To Health
            sub invert DMG;
            unit.addHealth invert;

          end;

          # Get the current power of the attacking weapon's random roll
          set WeaponCurrentPower currPower;

          # Display a "Message" followed by "Extra Damage" then the "current power" of the attacking weapon
          battle_game.flashMessage "STR_TEST_MSG_DAMAGE_STRENGTH" DMG WeaponCurrentPower;


          return;


I've been over the code several times and can't spot why there isn't any interaction when the weapon strikes.

The variable 'currPower' was mentioned in the verbose version of the openxcom.log's 'damageUnit' section and I'm making the possibly incorrect assumption that 'currPower' stores the weapon's current power after it goes through the chosen RandomType: randomization roll.

For convenience I've attached a mod to this post with a test weapon already configured to use the script and also set the "NONE" X-Com armor to be able to be effected by the weapon's script tags.

What am I missing?

34
Help / How to stop aliens from carrying extra equipment?
« on: October 24, 2021, 09:14:09 pm »
(Problem)
The Deep One is carrying extra weapons.

Spoiler:




(Mod Download)
I've attached a version of this mod with the alienRaces: all set to be the Deep One to make testing vs that unit easier:
Deep One Weapon V0-2(Error).zip


(Details)
I've been working on a small mod to give the Deep One a weapon to match its Ufopaedia description.

I think it is almost ready for use however I've run into a snag.

The Deep One is carrying extra weapons and should only be carrying its own special weapon and two ammo items for it.

The Deep One's armor now has [armors:]allowInv: set to true as it wasn't accepting the list of [armors:]builtInWeapons: being assigned to it.

However now it appears to be also carrying the weapons from the [alienDeployments:]itemSets: section.

I thought that [armors:]builtInWeapons: or [units:]builtInWeaponSets: would cancel out the equipment from [alienDeployments:]itemSets: but it appears that is not the case.

How do you make a unit only carry the equipment you assign directly to it?

35
Work In Progress / [TFTD][WIP][OXCE] Visual Enhancement Pack for TFTD
« on: October 24, 2021, 08:49:59 pm »
[OpenXcom Extended version 7.0 or newer is required to use this mod]
(Get OXCE 'HERE')


If you are looking to experience unaltered Terror From The Deep gameplay with a visual update this mod may be of interest to you.

All changes are only cosmetic and should only effect the game's graphical content.


This mod currently has five effects:
. Equipment has had its appearance altered to make the BigOb, FloorOb & HandOb match.
. Some equipment has had minor changes to make it easier to distinguish from similar items.
. Weapons will display if they are loaded or unloaded.
. Zombies will wear the armor of the X-Com soldier that the Tentaculat killed.
. Deep Ones will visually carry a weapon that matches their Ufopaedia entry's image.



Additional credit goes to Ohartenstein23 who wrote the script that allows changing of BigOb, FloorOb & HandOb sprites during the battlescape.
Thank you for making that script available for the community to use.


Downloads:
. Visual Enhancement Pack for TFTD (V1-0)

36
Help / What are [units:] race: & rank variables used for?
« on: October 09, 2021, 11:46:32 am »
(Question)
How do you use these variables?

[In the units: section]
race:
rank:


[In the alienDeployments: section]
alienRank:




So far I've been creating aliens in the units: section then assigning those units to a race in the alienRaces: section and fighting them via "New Battle" from the main menu screen.

To correctly integrate them into a real campaign I would like to know what to do with race: and rank: in the units: section.

I've just been giving these two variables temporary values like:
Code: [Select]
    race: STR_ALIENNAME
    rank: STR_LIVE_TERRORIST


The UFOpaedia Ruleset Reference Nightly lists what the variable is, but unfortunately it doesn't elaborate on how to use them:
Code: [Select]
race String ID of the unit race (for alien units).
rank String ID of the unit rank (for alien units).


The alienRaces: section of code appears to already assign each rank of alien to a deployment slot and the id: section controls the race, I think.

Code: [Select]
alienRaces:
  - id: STR_AQUATOID
    members:
      - STR_AQUATOID_COMMANDER
      - STR_AQUATOID_NAVIGATOR
      - STR_AQUATOID_MEDIC
      - STR_AQUATOID_TECHNICIAN
      - STR_AQUATOID_SQUAD_LEADER
      - STR_AQUATOID_SOLDIER
      - STR_CALCINITE_TERRORIST
      - STR_CALCINITE_TERRORIST
  - id: STR_AQUATOID_UNDERWATER
    members:
      - STR_AQUATOID_COMMANDER
      - STR_AQUATOID_NAVIGATOR
      - STR_AQUATOID_MEDIC
      - STR_AQUATOID_TECHNICIAN
      - STR_AQUATOID_SQUAD_LEADER
      - STR_AQUATOID_SOLDIER
      - STR_HALLUCINOID_TERRORIST
      - STR_HALLUCINOID_TERRORIST


I can tell there is more going on as alienDeployments: also appears to use the alienRank: variable to select units for deployment in some way.

UFOpaedia Ruleset Reference Nightly:
Code: [Select]
alienRank Rank associated with this deployment data, as defined by the order of the race in question

I've noticed that in the units: section the rank: names have _LIVE_ instead of the alien race's name from the alienRaces: members: list.
Code: [Select]
    rank: STR_LIVE_SOLDIER
    rank: STR_LIVE_SQUAD_LEADER
    rank: STR_LIVE_TECHNICIAN
    rank: STR_LIVE_TERRORIST

Is this related to the live alien item when a unit is captured?

I can see that in OXCE the liveAlien: variable on the unit controls the recovered live alien and from what I've read in the UFOpaedia OpenXcom's default method for determining the live alien is to use an item with the same name as the alien unit.

So I'm guessing that this is unrelated with a recovered item and instead performs a different action?




37
OXCE Support / "BattleGame.getTurnSide" vs "side"
« on: October 08, 2021, 06:49:54 am »
I was going to try using BattleGame.getTurnSide to determine which side (X-Com, Aliens, Civilians) is currently active, but then I noticed the variable "side" in the openxcom.log...

And thus I have two questions:

(Question #1)
What are the values that BattleGame.getTurnSide and "side" can possess?

For example I've seen this code in existing scripts which leads me to believe that X-Com may have a value of 0 and then the aliens would have 1 as their turn "side" value.
Code: [Select]
          # Make sure this doesn't run an extra time when civilians have a turn
          if eq side 2;
            return;
          end;


(Question #2)
So long as the script hook (For example: damageUnit: or newTurnUnit:) supports both "side" and BattleGame.getTurnSide is there a reason to use one over the other?

(If I'm using the wrong description and these commands aren't know as 'script hooks' please let me know, I'm still learning the terminology.)





38
OXCE Support / Scripting tags in split .rul files?
« on: October 07, 2021, 01:18:26 pm »
(Question #1)
Is there a limit to the number of tag variables I can use in a mod?


(Question #2)
I'm using separate .rul files for each of the code sections:
. items: in item.rul
. armors: in armor.rul
. units: in unit.rul

When adding scripting tags to the extended: section of each of these files do I need to duplicate all three RuleItem: RuleArmor: BattleUnit: tags in each .rul file?

Or only in the file with the corresponding section?


(Examples)

This code in each file:
Code: [Select]
extended:
  tags:
    RuleItem:
      STATUSEFFECT_HP_STRENGTH_ITEM: int
      STATUSEFFECT_HP_DURATION_ITEM: int
      STATUSEFFECT_ENERGY_STRENGTH_ITEM: int
      STATUSEFFECT_ENERGY_DURATION_ITEM: int
      STATUSEFFECT_TU_STRENGTH_ITEM: int
      STATUSEFFECT_TU_DURATION_ITEM: int
      STATUSEFFECT_MORALE_STRENGTH_ITEM: int
      STATUSEFFECT_MORALE_DURATION_ITEM: int
      STATUSEFFECT_STUN_STRENGTH_ITEM: int
      STATUSEFFECT_STUN_DURATION_ITEM: int
      STATUSEFFECT_WOUND_STRENGTH_ITEM: int
      STATUSEFFECT_WOUND_DURATION_ITEM: int
      STATUSEFFECT_MANA_STRENGTH_ITEM: int
      STATUSEFFECT_MANA_DURATION_ITEM: int


    RuleArmor:
      STATUSEFFECT_HP_SUSCEPTIBILITY_ARMOR: int
      STATUSEFFECT_ENERGY_SUSCEPTIBILITY_ARMOR: int
      STATUSEFFECT_TU_SUSCEPTIBILITY_ARMOR: int
      STATUSEFFECT_MORALE_SUSCEPTIBILITY_ARMOR: int
      STATUSEFFECT_STUN_SUSCEPTIBILITY_ARMOR: int
      STATUSEFFECT_WOUND_SUSCEPTIBILITY_ARMOR: int
      STATUSEFFECT_MANA_SUSCEPTIBILITY_ARMOR: int


    BattleUnit:
      STATUSEFFECT_HP_STRENGTH_UNIT: int
      STATUSEFFECT_HP_DURATION_UNIT: int
      STATUSEFFECT_ENERGY_STRENGTH_UNIT: int
      STATUSEFFECT_ENERGY_DURATION_UNIT: int
      STATUSEFFECT_TU_STRENGTH_UNIT: int
      STATUSEFFECT_TU_DURATION_UNIT: int
      STATUSEFFECT_MORALE_STRENGTH_UNIT: int
      STATUSEFFECT_MORALE_DURATION_UNIT: int
      STATUSEFFECT_STUN_STRENGTH_UNIT: int
      STATUSEFFECT_STUN_DURATION_UNIT: int
      STATUSEFFECT_MANA_STRENGTH_UNIT: int
      STATUSEFFECT_MANA_DURATION_UNIT: int
      STATUSEFFECT_DISPLAY_COUNTER: int



Or each file only has only its own related tags declared:

item.rul
Code: [Select]
extended:
  tags:
    RuleItem:
      STATUSEFFECT_HP_STRENGTH_ITEM: int
      STATUSEFFECT_HP_DURATION_ITEM: int
      STATUSEFFECT_ENERGY_STRENGTH_ITEM: int
      STATUSEFFECT_ENERGY_DURATION_ITEM: int
      STATUSEFFECT_TU_STRENGTH_ITEM: int
      STATUSEFFECT_TU_DURATION_ITEM: int
      STATUSEFFECT_MORALE_STRENGTH_ITEM: int
      STATUSEFFECT_MORALE_DURATION_ITEM: int
      STATUSEFFECT_STUN_STRENGTH_ITEM: int
      STATUSEFFECT_STUN_DURATION_ITEM: int
      STATUSEFFECT_WOUND_STRENGTH_ITEM: int
      STATUSEFFECT_WOUND_DURATION_ITEM: int
      STATUSEFFECT_MANA_STRENGTH_ITEM: int
      STATUSEFFECT_MANA_DURATION_ITEM: int

items:

armor.rul
Code: [Select]
extended:
  tags:
    RuleArmor:
      STATUSEFFECT_HP_SUSCEPTIBILITY_ARMOR: int
      STATUSEFFECT_ENERGY_SUSCEPTIBILITY_ARMOR: int
      STATUSEFFECT_TU_SUSCEPTIBILITY_ARMOR: int
      STATUSEFFECT_MORALE_SUSCEPTIBILITY_ARMOR: int
      STATUSEFFECT_STUN_SUSCEPTIBILITY_ARMOR: int
      STATUSEFFECT_WOUND_SUSCEPTIBILITY_ARMOR: int
      STATUSEFFECT_MANA_SUSCEPTIBILITY_ARMOR: int

armors:

unit.rul
Code: [Select]
extended:
  tags:
    BattleUnit:
      STATUSEFFECT_HP_STRENGTH_UNIT: int
      STATUSEFFECT_HP_DURATION_UNIT: int
      STATUSEFFECT_ENERGY_STRENGTH_UNIT: int
      STATUSEFFECT_ENERGY_DURATION_UNIT: int
      STATUSEFFECT_TU_STRENGTH_UNIT: int
      STATUSEFFECT_TU_DURATION_UNIT: int
      STATUSEFFECT_MORALE_STRENGTH_UNIT: int
      STATUSEFFECT_MORALE_DURATION_UNIT: int
      STATUSEFFECT_STUN_STRENGTH_UNIT: int
      STATUSEFFECT_STUN_DURATION_UNIT: int
      STATUSEFFECT_MANA_STRENGTH_UNIT: int
      STATUSEFFECT_MANA_DURATION_UNIT: int
      STATUSEFFECT_DISPLAY_COUNTER: int

units:

39
(Goal)
I've been trying to modify Yankes "Poison Script" into one that reduces all armor on an effected unit instead.

(Problem)
. The mod is producing an "End of map not found." error.
Code: [Select]
ERROR: failed to load 'Testing Mod: Acid Script'; mod disabled
./user/mods/TestModAcid/Ruleset/scriptAcid.rul: yaml-cpp: error at line 70, column 13: end of map not found

(What I've tried so far)
So far I've check that:
. All the code is indented via two spaces.
. All IF statements have a corresponding end; command.
. All lines end in a ; to close them.


(Example Mod)
For convenience I've attached the mod I'm working with that contains the modified script to this post:
TestModAcid V0-1.zip


Last time I was working with a script and it produced an "End of map not found." the error was an IF statement without an end; command.

This time all IF statements appear to be properly closed with an end; and if I remove the section of code that is referenced by the error message it just changes the line that is producing the error to be later in the .rul file.



I'm at a loss with this.





I tried removing sections of the code that had the "error at line" message but the error continued to occur:

Code: [Select]
scriptAcid.rul: yaml-cpp: error at line 70, column 13: end of map not found.
As line 70 is this block of code:
Code: [Select]
# Make sure Armor is not Less than 0
            if lt frontarmor 0;
              set frontarmor 0;
            end;

            if lt leftarmor 0;
              set leftarmor 0;
            end;

            if lt reararmor 0;
              set reararmor 0;
            end;

            if lt rightarmor 0;
              set rightarmor 0;
            end;

            if lt underarmor 0;
              set underarmor 0;
            end;


my first thought was that perhaps you cannot nest IF statements, example:
Code: [Select]
            if lt X 0;
              if lt Y 0;
                set underarmor 0;
              end;
            end;

However I've seen scripts with nested IF statements so I don't think that is the problem.

When I removed the section of code that was mentioned in the error message a new one was produced:
Code: [Select]
scriptAcid.rul: yaml-cpp: error at line 90, column 13: end of map not found.
Line 90 is the following code:
Code: [Select]
            Unit.setArmor 0 frontarmor;
            Unit.setArmor 1 leftarmor;
            Unit.setArmor 2 reararmor;
            Unit.setArmor 3 rightarmor;
            Unit.setArmor 4 underarmor;


From what I've read in the openxcom.log with verboseLogging: true the BattleUnit.setArmor variable requires two variables.

The first is the direction of the armor to be effected and the second is a variable with the value to give the selected armor.

I've noticed that in other scripts the "BattleUnit." part is abbreviated to "Unit." if I'm using the wrong command please let me know.



I tried removing that section of code as well. I need it for the script to work but I wanted to see if it would load without an error.

Unfortunately this caused the same error but with a different line referenced:
Code: [Select]
scriptAcid.rul: yaml-cpp: error at line 96, column 13: end of map not found.
Line 96 is:
Code: [Select]
            sub frontarmor acid;
            sub leftarmor acid;
            sub reararmor acid;
            sub rightarmor acid;
            sub underarmor acid;

These commands should be simple subtraction of the "acid" value from each of the five "armor" variables.

Again I tried removing the code section and again the error appeared:
Code: [Select]
scriptAcid.rul: yaml-cpp: error at line 102, column 13: end of map not found.
Line 102 is:
Code: [Select]
            sub duration 1;
            unit.setTag Tag.ACID_REMAINING duration;


After removing the code around line 102 the error directed me to line 105:
Code: [Select]
scriptAcid.rul: yaml-cpp: error at line 105, column 13: end of map not found.
Line 105 is an end; command for an IF statement earlier in the code so it shouldn't be a problem.

I checked the indentation and it should match the IF statement that it belongs to so I'm not sure why it is throwing the error.



I could keep removing lines of code but it seems like that would created additional problems as the IF end; code block would be broken.


What am I missing?

40
OXCE Support / Trying to change Yankes "Poison Script" Round 2!
« on: September 24, 2021, 01:57:36 am »
(UPDATE)
I think that I've solved the mod loading error... but now the script's poison effect isn't working when the unit is struck.

Here is the new example Mod from 2nd post in this thread:
TestModPoison V0-2.zip





(Goal)
. Edit Yankes "Simple poison bullets that do damage over time" script so that it no longer decreases the amount of health lost as the duration reduces.
. Control the duration of the poison via a tag on the weapon item.
. Change the armors: POISON_SUSCEPTIBILITY tag to a 0-1 true-false switch that determines if an armor can be poisoned.


(Problem)
. Poison effect does not apply when a unit wearing the poisonable armor is struck.
. My current attempt is throwing the following error: (Solved, see 2nd post)
Spoiler:
Code: [Select]
ERROR:
[23-09-2021_15-36-06] [FATAL] Error loading file './user/mods/TestModPoison/Ruleset/scriptPoison.rul'
[23-09-2021_15-36-06] [WARN] disabling mod with invalid ruleset: TESTPOISON
[23-09-2021_15-36-06] [ERROR] failed to load 'Testing Mod: Poison Script'; mod disabled
./user/mods/TestModPoison/Ruleset/scriptPoison.rul: yaml-cpp: error at line 34, column 13: end of map not found

(Example Mod)
For convenience I've attached the mod I'm working with that contains the modified script to this post:
TestModPoison V0-1.zip





I've been reading up on how OpenXcom's scripting works and I thought I was finally ready to make the edits I attempted a year ago back in this thread "A few questions about this "Poison Script" (OXCE)".

Unfortunately the code is throwing an error so I've missed something.

I think the error is being triggered by the removal of these lines of code, but I'm not sure why:
Code: [Select]
            mul strength susceptibility;
            div strength 10;

I'm going to break down my understanding of Yankes's original code, if anyone spots my mistake or anything odd I'm doing please let me know.





This part creates the variables that the script keeps information on the effected item, armor and unit.

POISON_STRENGTH is the amount of damage the poison does.
POISON_SUSCEPTIBILITY is the armor's resistance to the poison.
POISON_LEVEL stores the amount of poison left on the unit.

This code needs to be in the items.rul armors.rul & units.rul files.
(If you have the armors: items: units: code sections split between different .rul files)

Code: [Select]
extended:
  tags:
    RuleItem:
      POISON_STRENGTH: int
    RuleArmor:
      POISON_SUSCEPTIBILITY: int
    BattleUnit:
      POISON_LEVEL: int

This script runs when a unit is damaged.

Code: [Select]
  scripts:
    damageUnit:

offset: 1 means this script will run before any script with offset: 2 or greater.

Code: [Select]
      - offset: 1
This code block creates temporary variables to handle the values the poison scripts works with.

The var int definitions are creating variables that can hold an integer.

I'm not sure exactly how the var ptr part works but I'm guessing it is loading the entire items: and armors: section for the script to access.

Code: [Select]
        code: |
          var int susceptibility 0;
          var int strength 0;
          var int temp 0;
          var ptr RuleArmor armor_rule;
          var ptr RuleItem item_rule;

the armor_rule variable is being assigned the value found on the unit being damaged's armor's POISON_SUSCEPTIBILITY tag.

This value is then being stored in the scripts susceptibility variable to make it easier to work with.

Similarly the item being used to damage the unit has the value of its POISON_STRENGTH assigned to the scripts strength variable.
         
Code: [Select]
          unit.getRuleArmor armor_rule;
          armor_rule.getTag susceptibility Tag.POISON_SUSCEPTIBILITY;
          damaging_item.getRuleItem item_rule;
          item_rule.getTag strength Tag.POISON_STRENGTH;

I'm not sure how the debug_log commands work but I'm guessing that both strength & susceptibility variables are written in the openxcom.log file by these commands.

Then if both strength & susceptibility are gt(Greater Than) 0 the item's poison strength is multiplied by the armor's susceptibility value.

After which strength is divided by 10.

The unit being damaged's POISON_LEVEL tag variable is then stored in the temp variable.

Then if temp is lt(Less than) strength the unit's POISON_LEVEL tag is given the value of strength.

If I'm reading it correctly what this section of code has done is check to see if incoming poison damage is of a higher value than any poison currently on the unit, and if it is the new higher poison value is given to the unit's tag.

I think that return; is used to end the script and return the flow of code back to the rest of the game engine loop.

Code: [Select]
          debug_log 1 strength;
          debug_log 2 susceptibility;
          if and gt strength 0 gt susceptibility 0;
          debug_log 3 3;
            mul strength susceptibility;
            div strength 10;
            unit.getTag temp Tag.POISON_LEVEL;
            if lt temp strength;
              unit.setTag Tag.POISON_LEVEL strength;
            end;
          end;
         
          return;

This code block is separate from the above one and is only run for each unit at the beginning of a new turn.

New temporary variables are declared called poison & hp.

The poison variable is assigned the value of the unit's POISON_LEVEL tag.

If the poison value is greater than 0 (The unit is currently poisoned) then the unit's health is assigned to the hp variable.

The value of poison is subtracted from hp and then the unit has its actual health value changed to match the hp variable.

The poison value is subtracted by 1 and then the unit's POISON_LEVEL is assigned the resulting new value.

Code: [Select]
    newTurnUnit:
      - offset: 1
        code: |
          var int poison;
          var int hp;
          unit.getTag poison Tag.POISON_LEVEL;
          if gt poison 0;
            unit.getHealth hp;
            sub hp poison;
            unit.setHealth hp;
            sub poison 1;
            unit.setTag Tag.POISON_LEVEL poison;
          end;
          return;

This code block changes the colour of a unit that is currently poisoned.

The 4 on the line:
set_color new_pixel 4; #green color
controls what the new colour is.

If I'm understanding it correctly the number indicates the row used in the X-Com palette.



When using the TFTD palette a value of 5 gives a similar green shade to the one expected in X-COM: UFO Defense.

Code: [Select]
    recolorUnitSprite:
      - offset: 4
        code: |
          var int poison;
          unit.getTag poison Tag.POISON_LEVEL;
          if gt poison 0;
            set_color new_pixel 4; #green color
          end;
          return new_pixel;





That is my understanding of how the code works, and now here is the way I've tried to alter the script.

Code: [Select]
extended:
  tags:
    RuleItem:
      POISON_STRENGTH: int
      POISON_DURATION: int
    RuleArmor:
      POISON_SUSCEPTIBILITY: int
    BattleUnit:
      POISON_REMAINING: int
      POISON_LEVEL: int
  scripts:
    damageUnit:
      - offset: 1
        code: |
          var int susceptibility 0;
          var int strength 0;
          var int duration 0;
          var int temp 0;
          var ptr RuleArmor armor_rule;
          var ptr RuleItem item_rule;
         
          unit.getRuleArmor armor_rule;
          armor_rule.getTag susceptibility Tag.POISON_SUSCEPTIBILITY;
          damaging_item.getRuleItem item_rule;
          item_rule.getTag strength Tag.POISON_STRENGTH;
          item_rule.getTag duration Tag.POISON_DURATION;
         
          debug_log 1 strength;
          debug_log 2 susceptibility;
          if and gt strength 0 gt susceptibility 0;
          debug_log 3 3;
#            mul strength susceptibility;
#            div strength 10;
            unit.getTag temp Tag.POISON_LEVEL;
            if lt temp strength;
              unit.setTag Tag.POISON_LEVEL strength;

            unit.getTag temp Tag.POISON_REMAINING;
            if lt temp duration;
              unit.setTag Tag.POISON_REMAINING duration;

            end;
          end;
         
          return;
    newTurnUnit:
      - offset: 1
        code: |
          var int poison;
          var int hp;
          var int duration 0;
          unit.getTag poison Tag.POISON_LEVEL;
          unit.getTag duration Tag.POISON_REMAINING;
          if gt poison 0;
            unit.getHealth hp;
            sub hp poison;
            unit.setHealth hp;
            sub duration 1;
            unit.setTag Tag.POISON_REMAINING duration;
          if le duration 0;
            unit.setTag Tag.POISON_LEVEL 0;
          end;
          return;
    recolorUnitSprite:
      - offset: 4
        code: |
          var int poison;
          unit.getTag poison Tag.POISON_LEVEL;
          if gt poison 0;
            set_color new_pixel 5; # 4 green color
          end;
          return new_pixel;


I've tried to changed the tags used by the script a bit.

(Items:)
POISON_STRENGTH = How strong the weapon's poison is.
POISON_DURATION = How long the weapon's poison lasts when applied.

(Armors:)
POISON_SUSCEPTIBILITY = Can this unit be poisoned? 0 = false. 1 = true.

(Units:)
POISON_REMAINING = Tag for storing POISON_DURATION when a unit is poisoned.
POISON_LEVEL = Tag for storing POISON_STRENGTH when a unit is poisoned.


A new variable is declared at the start of the script to store the amount of time the inflicted poison will last.
Code: [Select]
          var int duration 0;
The item also now passes the Tag.POISON_DURATION value to the scripts duration variable:
Code: [Select]
          item_rule.getTag duration Tag.POISON_DURATION;
As susceptibility now is used only to check if the armor can be poisoned or not these two lines of code are removed:
Code: [Select]
            mul strength susceptibility;
            div strength 10;


If the tag.POISON_DURATION of the weapon is higher than the tag.POISON_REMAINING value on the unit then the unit's POISON_REMAINING value is assigned the weapons poison duration value:
Code: [Select]
            unit.getTag temp Tag.POISON_REMAINING;
            if lt temp duration;
              unit.setTag Tag.POISON_REMAINING duration;


in the newTurnUnit: code block the temporary variable duration is created again:
Code: [Select]
          var int duration 0;
and has the value held by the unit's POISON_REMAINING tag assigned to it.
Code: [Select]
          unit.getTag duration Tag.POISON_REMAINING;
As POISON_LEVEL is no longer linked to the time a unit spends poisoned the duration variable is subtracted from instead of poison:
Code: [Select]
            sub duration 1;
            unit.setTag Tag.POISON_REMAINING duration;


An additional if statement is checked to see if the duration is 0 and then zero the POISON_LEVEL tag on the unit if it is:
Code: [Select]
          if le duration 0;
            unit.setTag Tag.POISON_LEVEL 0;


When the mod is loaded, the following error is displayed

Code: [Select]
ERROR:
[23-09-2021_15-36-06] [FATAL] Error loading file './user/mods/TestModPoison/Ruleset/scriptPoison.rul'
[23-09-2021_15-36-06] [WARN] disabling mod with invalid ruleset: TESTPOISON
[23-09-2021_15-36-06] [ERROR] failed to load 'Testing Mod: Poison Script'; mod disabled
./user/mods/TestModPoison/Ruleset/scriptPoison.rul: yaml-cpp: error at line 34, column 13: end of map not found

41
Help / Spawning a unit with builtInWeaponSets: that has a grenade?
« on: September 12, 2021, 12:10:03 pm »
(Goal)
When a unit dies via damage caused by either enviroEffects: or negative health regen on its armor that unit will not trigger the specab: 1 effect on death and explode.

If I understand correctly this occurs because the unit is not dying during a turn but instead between turns.

This got me thinking that maybe a makeshift solution could be created using a pre-primed grenade.

Fortunately Greenscarf has posted a script that does just that: (Thank you for sharing your script Greenscarf!)
[Documentation][y-script] OXCE Script examples.

(Problem)
I've run into a snag, for some reason I cannot spawn a unit with a grenade using the units: builtInWeaponSets: list.

Code: [Select]
    builtInWeaponSets:
      - - STR_MAGNA_BLAST_GRENADE


If someone could take a quick look at my code in the mod attached to this post and see if they can spot the problem I would appreciate it. (TestMod.zip)

The small example mod is composed of:
- Greenscarf's scripts that auto-prime the grenade.
- A test unit that will die via decaying health on its armor.
- A test weapon to spawn the enemy unit quickly where it can easily be observed.


42
I'm hoping that it is possible to implement it so that one or both of the below methods can trigger the specab: 1 effect on unit death.

If a unit dies due to either having its armor cause negative health regen or via enviroEffects: damage the unit's death does not appear to trigger its specab: 1 effect and explode on death.


Armor with decaying health example:

Code: [Select]
armors:
  - type: AQUATOID_ARMOR
    spriteSheet: AQUATOID.PCK
    allowInv: false
    corpseBattle:
      - STR_AQUATOID_CORPSE
    frontArmor: 5
    sideArmor: 5
    rearArmor: 5
    underArmor: 5
    drawingRoutine: 4
    constantAnimation: true
    damageModifier:
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
    loftempsSet: [ 5 ]
    overKill: 10.0
    recovery:
      health:
        flatHundred: -0.5

items:
  - type: STR_AQUATOID_CORPSE
    size: 0.4
    costSell: 20000
    weight: 30
    bigSprite: 46
    floorSprite: 41
    invWidth: 2
    invHeight: 3
    recoveryPoints: 5
    battleType: 11
    armor: 26
    blastRadius: 5
    power: 100
    damageType: 2

enviroEffects: that causes harm to units example:

Code: [Select]
enviroEffects:
  - type: COND_P1
    mapBackgroundColor: 10
    environmentalConditions:
      STR_HOSTILE:
        chancePerTurn: 100
        firstTurn: 1
        lastTurn: 1000
        message: "STR_TEST"
        color: 29
        weaponOrAmmo: "STR_TEST_EFFECT"
        side: 4
        bodyPart: 1

items:
  - type: STR_TEST_EFFECT
    size: 0.3
    costSell: 9590
    weight: 3
    bigSprite: 25
    floorSprite: 33
    handSprite: 200
    hitSound: 31
    hitAnimation: 46
    power: 130
    damageType: 19
    clipSize: 10
    battleType: 2
    recoveryPoints: 1
    armor: 50
    attraction: 1
    vaporColor: 3
    vaporDensity: 30

armors:
  - type: AQUATOID_ARMOR0
    damageModifier:
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.6
      - 1.5
      - 1.0
      - 1.0 # Extra Resistances
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0 # Enviroment Effect

items:
  - type: STR_AQUATOID_CORPSE
    size: 0.4
    costSell: 20000
    weight: 30
    bigSprite: 46
    floorSprite: 41
    invWidth: 2
    invHeight: 3
    recoveryPoints: 5
    battleType: 11
    armor: 26
    blastRadius: 5
    power: 100
    damageType: 2

43
Help / Armor with decaying health?
« on: August 31, 2021, 05:47:53 am »
I'm trying to create an armor for a unit that loses health every turn.

So far I've tried both:

Code: [Select]
armors:
  - type: DECAYING_HEALTH_ARMOR
    recovery:
      health:
        flatHundred: -0.5


and

Code: [Select]
armors:
  - type: DECAYING_HEALTH_ARMOR
    recovery.health: -50


But the unit just wanders around and never loses any health.

What am I doing wrong?

44
Resources / The Martian's Cydonian Art Gallery
« on: July 28, 2021, 12:02:14 am »
Within this thread you will find a selection of altered, edited, recoloured or recombined images that may (or may not) be useful to you.

Please make sure to credit the original author(s) of the source images if you choose to make use of them.

45
I've been making a mod to display firing animations in TFTD.

So far the unit sprite sheets are finished but now I need the land variants to be worn by X-Com when not underwater.

The solution to this I'm attempting is to use startingConditions: & armorTransformations: to swap the X-Com soldier's armor for their land versions when engaging in the Base Defence, Port attacks, Island attacks and Ship attack missions.

Unfortunately my attempts to use startingConditions: have not yielded results.


In the current version of my mod when the aliens attack a surface city X-Com soldier's armor is not transformed into the variant without a helmet.


Here is the code involving the transformation.
Code: [Select]
# [====]  Alien Deployments [====]
alienDeployments:

# [=] Island Terror Mission [=]
  - type: STR_ISLAND_TERROR
    startingCondition: STR_LAND_MISSION_HELMETS_OFF

# [=] Port Terror Mission [=]
  - type: STR_PORT_TERROR
    startingCondition: STR_LAND_MISSION_HELMETS_OFF

# [=] Cargo Ship Mission (Part 1) [=]
  - type: STR_CARGO_SHIP_P1
    startingCondition: STR_LAND_MISSION_HELMETS_OFF

# [=] Cargo Ship Mission (Part 2) [=]
  - type: STR_CARGO_SHIP_P2
    startingCondition: STR_LAND_MISSION_HELMETS_OFF

# [=] Cruise Ship Mission (Part 1) [=]
  - type: STR_CRUISE_SHIP_P1
    startingCondition: STR_LAND_MISSION_HELMETS_OFF

# [=] Cruise Ship Mission (Part 2) [=]
  - type: STR_CRUISE_SHIP_P2
    startingCondition: STR_LAND_MISSION_HELMETS_OFF
   
# [=] Base Defence Mission [=]
  - type: STR_BASE_DEFENSE
    startingCondition: STR_LAND_MISSION_HELMETS_OFF
   

# [====] Starting Conditions [====]
startingConditions:
  - type: STR_LAND_MISSION_HELMETS_OFF
    armorTransformations:
      STR_NONE_UC: STR_NONE_UC_LAND
      STR_PLASTIC_AQUA_ARMOR_UC: STR_PLASTIC_AQUA_ARMOR_UC_LAND
      STR_ION_ARMOR_UC: STR_ION_ARMOR_UC_LAND
      STR_MAGNETIC_ION_ARMOR_UC: STR_MAGNETIC_ION_ARMOR_UC_LAND



I've also attached the mod directly to this post as well for convenience:
. Firing Animation for TFTD (V0-4)

Pages: 1 2 [3] 4 5 ... 9