aliens

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 - memmaker

Pages: 1 2 3 [4] 5 6 7
46
OXCE Support Y-scripts / Re: Script help needed.
« on: March 02, 2020, 08:51:27 am »
damaging_will be set to the ammo item on weapons with ammo, while weapon_item is the weapon itself.

As for damage, I think that armor resistances gets applied before hitUnit executes. Meaning if the armor resistance reduces the damage to less than 1 hitUnit won't get called.

47
OXCE Support Y-scripts / Re: Script help needed.
« on: March 01, 2020, 10:35:53 pm »
What exactly is not working?

Did you check the openxcom.log output? Does it say anything?

Are you aware of the difference between damaging_item and weapon_item?

Did you try adding debug_log output to make debugging easier? Does the script get executed at all?

Also, are you aware how the damage formula works, and that you need more than zero power to arrive at this stage of the damage calculation in order for your script to get executed?

48
Offtopic / Re: XCOM Inspired Fantasy Game
« on: February 19, 2020, 02:15:00 pm »
Just wanted to chime in with an interesting note:

I believe randomness can be used to varying degrees. The less randomness and the more deterministic a game is, the more it resembles a puzzle instead of a strategy/tactics game.

Taken to the extreme, this concept can be seen in "Into the Breach" (https://www.youtube.com/watch?v=SZg8GAnjgyc).

A very interesting little game, which I would definitely put in the realm of puzzle games, even though it looks like turn bases tactics. Every move is completely deterministic and you even get a preview of what the AI will do next turn. Interesting concept.

49
OXCE Support Y-scripts / Re: More ModScript examples
« on: February 16, 2020, 12:37:22 am »
I will put this here, since I do not know where to put this otherwise ;)

Code: [Select]
# weapon proficicency system - by memmaker
#
# how to use: flag weapons with WEAPON_TYPE tags
# eg. You decide all shotguns are weapon type 3
# Then you would have something like this:
# items:
#   - type: STR_SHOTGUN
#     tags:
#       WEAPON_TYPE: 4 # shotguns
#   - type: STR_ALLOY_SHOTGUN
#     tags:
#       WEAPON_TYPE: 4 # shotguns
#
# You can decide which WEAPON_TYPE entry to use by using this table:
#
# Type 1 -> WEAPON_TYPE: 1
# Type 2 -> WEAPON_TYPE: 2
# Type 3 -> WEAPON_TYPE: 4
# Type 4 -> WEAPON_TYPE: 8
# Type 5 -> WEAPON_TYPE: 16
# Type 6 -> WEAPON_TYPE: 32
# Type 7 -> WEAPON_TYPE: 64
# Type 8 -> WEAPON_TYPE: 128
#
# NOTE1: The current script only allows for a maximum of 8 different weapon types. Could be expanded.
#
# All hits with weapons which are tagged with WEAPON_TYPE will be tracked.
# After the hit_limit is reached (search for "set hit_limit" if you want change it),
# the soldier is awarded the proficiency with this weapon type.
#
# A soldier's accuracy with a proficient weapon is increased (defined at "set accuracy_bonus").
# IMPORTANT: If a soldier has weapons in both hands the bonus of the right hand weapon is applied.
#            The technical reason for this is, that we do not know for which item an accuracy bonus is being calculated.
#            Also, having a proficient weapon equipped also boosts PSI accuracy, since the bonus is not bound
#            to a specific action.

extraStrings:
  - type: en-US
    strings:
      STR_PROFICIENT_MESSAGE_TYPE1: "Soldier became proficient with TYPE1"
      STR_PROFICIENT_MESSAGE_TYPE2: "Soldier became proficient with TYPE2"
      STR_PROFICIENT_MESSAGE_TYPE3: "Soldier became proficient with TYPE3"
      STR_PROFICIENT_MESSAGE_TYPE4: "Soldier became proficient with TYPE4"
      STR_PROFICIENT_MESSAGE_TYPE5: "Soldier became proficient with TYPE5"
      STR_PROFICIENT_MESSAGE_TYPE6: "Soldier became proficient with TYPE6"
      STR_PROFICIENT_MESSAGE_TYPE7: "Soldier became proficient with TYPE7"
      STR_PROFICIENT_MESSAGE_TYPE8: "Soldier became proficient with TYPE8"
   
extended:
  tags:
    GeoscapeSoldier:
      WEAPON_PROFICIENCY_FLAGS: int # 8 bits of flags, one for each weapon type
      EXP_WITH_TYPE1: int   # tracks the hits a soldier made with these weapon types
      EXP_WITH_TYPE2: int
      EXP_WITH_TYPE3: int
      EXP_WITH_TYPE4: int
      EXP_WITH_TYPE5: int
      EXP_WITH_TYPE6: int
      EXP_WITH_TYPE7: int
      EXP_WITH_TYPE8: int
    BattleUnit:
      HITS_WITH_TYPE1: int   # tracks the hits a unit makes with the specific weapon type during a mission
      HITS_WITH_TYPE2: int
      HITS_WITH_TYPE3: int
      HITS_WITH_TYPE4: int
      HITS_WITH_TYPE5: int
      HITS_WITH_TYPE6: int
      HITS_WITH_TYPE7: int
      HITS_WITH_TYPE8: int
    RuleItem:
      WEAPON_TYPE: int # one of, 0 = none, 1 = type 1, 2 = type 2, 4 = type 3, 8 = type 4, 16, 32, 64, 128
  scripts:
    hitUnit:
      - offset: 66   # get weapon type, track hit for that weapon type on unit
        code: |
          var ptr RuleItem item_rule;
          var int weapon_type;
          var int temp;
          var int hit_limit;
          var int exp;
          var int wp_flags;
          var ptre GeoscapeSoldier soldier;
          var ptr RuleSoldier soldier_rule; # replace with getFaction code, when available
         
          unit.getRuleSoldier soldier_rule;

          set hit_limit 30; # award weapon proficiency after this number of hits..

          if neq soldier_rule null; # is xcom unit
            unit.getGeoscapeSoldier soldier;
           
            damaging_item.getRuleItem item_rule;
            item_rule.getTag weapon_type Tag.WEAPON_TYPE;

            if eq weapon_type 1;
              soldier.getTag exp Tag.EXP_WITH_TYPE1;
              unit.getTag temp Tag.HITS_WITH_TYPE1;
              add temp 1;
              unit.setTag Tag.HITS_WITH_TYPE1 temp;
              add exp temp;
              if ge exp hit_limit;
                soldier.getTag wp_flags Tag.WEAPON_PROFICIENCY_FLAGS;
                bit_or wp_flags weapon_type;
                soldier.setTag Tag.WEAPON_PROFICIENCY_FLAGS wp_flags;
                battle_game.flashMessage "STR_PROFICIENT_MESSAGE_TYPE1";
              end;
            else eq weapon_type 2;
              soldier.getTag exp Tag.EXP_WITH_TYPE2;
              unit.getTag temp Tag.HITS_WITH_TYPE2;
              add temp 1;
              unit.setTag Tag.HITS_WITH_TYPE2 temp;
              add exp temp;
              if ge exp hit_limit;
                soldier.getTag wp_flags Tag.WEAPON_PROFICIENCY_FLAGS;
                bit_or wp_flags weapon_type;
                soldier.setTag Tag.WEAPON_PROFICIENCY_FLAGS wp_flags;
                battle_game.flashMessage "STR_PROFICIENT_MESSAGE_TYPE2";
              end;
            else eq weapon_type 4;
              soldier.getTag exp Tag.EXP_WITH_TYPE3;
              unit.getTag temp Tag.HITS_WITH_TYPE3;
              add temp 1;
              unit.setTag Tag.HITS_WITH_TYPE3 temp;
              add exp temp;
              if ge exp hit_limit;
                soldier.getTag wp_flags Tag.WEAPON_PROFICIENCY_FLAGS;
                bit_or wp_flags weapon_type;
                soldier.setTag Tag.WEAPON_PROFICIENCY_FLAGS wp_flags;
                battle_game.flashMessage "STR_PROFICIENT_MESSAGE_TYPE3";
              end;
            else eq weapon_type 8;
              soldier.getTag exp Tag.EXP_WITH_TYPE4;
              unit.getTag temp Tag.HITS_WITH_TYPE4;
              add temp 1;
              unit.setTag Tag.HITS_WITH_TYPE4 temp;
              add exp temp;
              if ge exp hit_limit;
                soldier.getTag wp_flags Tag.WEAPON_PROFICIENCY_FLAGS;
                bit_or wp_flags weapon_type;
                soldier.setTag Tag.WEAPON_PROFICIENCY_FLAGS wp_flags;
                battle_game.flashMessage "STR_PROFICIENT_MESSAGE_TYPE4";
              end;
            else eq weapon_type 16;
              soldier.getTag exp Tag.EXP_WITH_TYPE5;
              unit.getTag temp Tag.HITS_WITH_TYPE5;
              add temp 1;
              unit.setTag Tag.HITS_WITH_TYPE5 temp;
              add exp temp;
              if ge exp hit_limit;
                soldier.getTag wp_flags Tag.WEAPON_PROFICIENCY_FLAGS;
                bit_or wp_flags weapon_type;
                soldier.setTag Tag.WEAPON_PROFICIENCY_FLAGS wp_flags;
                battle_game.flashMessage "STR_PROFICIENT_MESSAGE_TYPE5";
              end;
            else eq weapon_type 32;
              soldier.getTag exp Tag.EXP_WITH_TYPE6;
              unit.getTag temp Tag.HITS_WITH_TYPE6;
              add temp 1;
              unit.setTag Tag.HITS_WITH_TYPE6 temp;
              add exp temp;
              if ge exp hit_limit;
                soldier.getTag wp_flags Tag.WEAPON_PROFICIENCY_FLAGS;
                bit_or wp_flags weapon_type;
                soldier.setTag Tag.WEAPON_PROFICIENCY_FLAGS wp_flags;
                battle_game.flashMessage "STR_PROFICIENT_MESSAGE_TYPE6";
              end;
            else eq weapon_type 64;
              soldier.getTag exp Tag.EXP_WITH_TYPE7;
              unit.getTag temp Tag.HITS_WITH_TYPE7;
              add temp 1;
              unit.setTag Tag.HITS_WITH_TYPE7 temp;
              add exp temp;
              if ge exp hit_limit;
                soldier.getTag wp_flags Tag.WEAPON_PROFICIENCY_FLAGS;
                bit_or wp_flags weapon_type;
                soldier.setTag Tag.WEAPON_PROFICIENCY_FLAGS wp_flags;
                battle_game.flashMessage "STR_PROFICIENT_MESSAGE_TYPE7";
              end;
            else eq weapon_type 128;
              soldier.getTag exp Tag.EXP_WITH_TYPE8;
              unit.getTag temp Tag.HITS_WITH_TYPE8;
              add temp 1;
              unit.setTag Tag.HITS_WITH_TYPE8 temp;
              add exp temp;
              if ge exp hit_limit;
                soldier.getTag wp_flags Tag.WEAPON_PROFICIENCY_FLAGS;
                bit_or wp_flags weapon_type;
                soldier.setTag Tag.WEAPON_PROFICIENCY_FLAGS wp_flags;
                battle_game.flashMessage "STR_PROFICIENT_MESSAGE_TYPE8";
              end;
            end;
          end;
          return power part side;
    accuracyMultiplierBonusStats:
      - offset: 66   # check if unit is proficient with current weapon type, boost accuracy
        code: |
          var ptr RuleItem item_rule;
          var ptr BattleItem weapon;
          var int weapon_type;
          var int temp;
          var int wp_flags;
          var ptr GeoscapeSoldier soldier;
          var int accuracy_bonus;
          var ptr RuleSoldier soldier_rule; # replace with getFaction code, when available

          set accuracy_bonus 10; # adjusts the bonus accuracy for handling proficient weapons

          unit.getRuleSoldier soldier_rule;

          if neq soldier_rule null; # is xcom unit
            unit.getGeoscapeSoldier soldier;
            soldier.getTag wp_flags Tag.WEAPON_PROFICIENCY_FLAGS;

            unit.getRightHandWeapon weapon;
            if eq weapon null;
              unit.getLeftHandWeapon weapon;
            end;
            if neq weapon null;
              weapon.getRuleItem item_rule;
              item_rule.getTag weapon_type Tag.WEAPON_TYPE;

              bit_and wp_flags weapon_type;

              if neq wp_flags 0;
                # soldier is proficient in this weapon type
                add bonus accuracy_bonus;
                debug_log "Weapon proficiency bonus added: " unit weapon;
              end;
            end;
          end;
          return bonus;
    meleeMultiplierBonusStats:
      - offset: 66   # check if unit is proficient with current weapon type, boost accuracy
        code: |
          var ptr RuleItem item_rule;
          var ptr BattleItem weapon;
          var int weapon_type;
          var int temp;
          var int wp_flags;
          var ptr GeoscapeSoldier soldier;
          var int accuracy_bonus;
          var ptr RuleSoldier soldier_rule; # replace with getFaction code, when available

          set accuracy_bonus 10; # adjusts the bonus accuracy for handling proficient weapons

          unit.getRuleSoldier soldier_rule;

          if neq soldier_rule null; # is xcom unit
            unit.getGeoscapeSoldier soldier;
            soldier.getTag wp_flags Tag.WEAPON_PROFICIENCY_FLAGS;

            unit.getRightHandWeapon weapon;
            if eq weapon null;
              unit.getLeftHandWeapon weapon;
            end;
            if neq weapon null;
              weapon.getRuleItem item_rule;
              item_rule.getTag weapon_type Tag.WEAPON_TYPE;

              bit_and wp_flags weapon_type;

              if neq wp_flags 0;
                # soldier is proficient in this weapon type
                add bonus accuracy_bonus;
                debug_log "Weapon proficiency bonus added: " unit weapon;
              end;
            end;
          end;
          return bonus;   
    throwMultiplierBonusStats:
      - offset: 66   # check if unit is proficient with current weapon type, boost accuracy
        code: |
          var ptr RuleItem item_rule;
          var ptr BattleItem weapon;
          var int weapon_type;
          var int temp;
          var int wp_flags;
          var ptr GeoscapeSoldier soldier;
          var int accuracy_bonus;
          var ptr RuleSoldier soldier_rule; # replace with getFaction code, when available

          set accuracy_bonus 10; # adjusts the bonus accuracy for handling proficient weapons

          unit.getRuleSoldier soldier_rule;

          if neq soldier_rule null; # is xcom unit
            unit.getGeoscapeSoldier soldier;
            soldier.getTag wp_flags Tag.WEAPON_PROFICIENCY_FLAGS;

            unit.getRightHandWeapon weapon;
            if eq weapon null;
              unit.getLeftHandWeapon weapon;
            end;
            if neq weapon null;
              weapon.getRuleItem item_rule;
              item_rule.getTag weapon_type Tag.WEAPON_TYPE;

              bit_and wp_flags weapon_type;

              if neq wp_flags 0;
                # soldier is proficient in this weapon type
                add bonus accuracy_bonus;
                debug_log "Weapon proficiency bonus added: " unit weapon;
              end;
            end;
          end;
          return bonus;
    returnFromMissionUnit:
      - offset: 66   # transfer hits from battlescape unit to geoscape soldier, award weapon proficiency when limit is hit
        code: |
          var int hits;
          var int exp;

          unit.getTag hits Tag.HITS_WITH_TYPE1;
          soldier.getTag exp Tag.EXP_WITH_TYPE1;
          add exp hits;
          soldier.setTag Tag.EXP_WITH_TYPE1 exp;

          unit.getTag hits Tag.HITS_WITH_TYPE2;
          soldier.getTag exp Tag.EXP_WITH_TYPE2;
          add exp hits;
          soldier.setTag Tag.EXP_WITH_TYPE2 exp;

          unit.getTag hits Tag.HITS_WITH_TYPE3;
          soldier.getTag exp Tag.EXP_WITH_TYPE3;
          add exp hits;
          soldier.setTag Tag.EXP_WITH_TYPE3 exp;

          unit.getTag hits Tag.HITS_WITH_TYPE4;
          soldier.getTag exp Tag.EXP_WITH_TYPE4;
          add exp hits;
          soldier.setTag Tag.EXP_WITH_TYPE4 exp;

          unit.getTag hits Tag.HITS_WITH_TYPE5;
          soldier.getTag exp Tag.EXP_WITH_TYPE5;
          add exp hits;
          soldier.setTag Tag.EXP_WITH_TYPE5 exp;

          unit.getTag hits Tag.HITS_WITH_TYPE6;
          soldier.getTag exp Tag.EXP_WITH_TYPE6;
          add exp hits;
          soldier.setTag Tag.EXP_WITH_TYPE6 exp;

          unit.getTag hits Tag.HITS_WITH_TYPE7;
          soldier.getTag exp Tag.EXP_WITH_TYPE7;
          add exp hits;
          soldier.setTag Tag.EXP_WITH_TYPE7 exp;

          unit.getTag hits Tag.HITS_WITH_TYPE8;
          soldier.getTag exp Tag.EXP_WITH_TYPE8;
          add exp hits;
          soldier.setTag Tag.EXP_WITH_TYPE8 exp;

          return;

50
OXCE Suggestions DONE / Re: [Documentation] SpecialWeapons per Soldier Type
« on: February 05, 2020, 12:10:26 pm »
Yes, but they won't be using the same UI. You can have one for the special icon and one for the hands, like ohartenstein described.

Gesendet von meinem Pixel 3 mit Tapatalk


51
OXCE Suggestions DONE / Re: [Documentation] SpecialWeapons per Soldier Type
« on: February 05, 2020, 02:11:05 am »
I see, ohartenstein beat me to the answers.

Adding one minor thing though: Yes, they work exactly as specialWeapons on armors, thus also taking no inventory space.

52
OXCE Suggestions DONE / [Documentation] Show Soldier type in inventory
« on: February 04, 2020, 10:44:18 pm »
H there, today a new OXCE feature was merged and will become available in future builds.

With the following flag set in your ruleset, the soldier type of your soldiers will be displayed in the inventory screen.

Code: [Select]
soldiers:
  - type: STR_HEAVY
    showTypeInInventory: true

The type name will be displayed as a prefix to the armor name tooltip when you hover over the armor of the soldier in the inventory screen.

53
Hi there,
a new OXCE feature has been merged and will become available in future builds: New targeting options for the PSI Amp.

You can now define which factions can be targeted with the PSI Amp.

An example looks like this:
# 1 = player, 2 = hostile, 4 = neutral

Code: [Select]
items:
  - type: STR_FRIENLDY_FIRE_PSI_AMP
    psiTargetMatrix: 1    # 1= player faction only, defaults to 6 (hostile + neutral)

This would define a PSI Amp which can target only allied units. You can disallow targeting of your own or other factions explicitly with this.

54
OXCE Suggestions DONE / [Documentation] SpecialWeapons per Soldier Type
« on: February 04, 2020, 10:35:12 pm »
Three days ago a new OXCE Feature was merged, allowing for special weapons on soldiers.

A ruleset example would look like this:

Code: [Select]
soldiers:
  - type: STR_HEAVY
    specialWeapon: STR_ROCKET_LAUNCHER

55
OXCE Suggestions DONE / Re: [Documentation] New Script hooks / data access
« on: February 04, 2020, 10:32:41 pm »
There is also a new function available on the BattleGame called tryConcealUnit. It allows scripts to try and hide units from the AIs sights. Basically resetting the status to before this unit was spotted.

An example invocation looks like this:

Code: [Select]
              battle_game.tryConcealUnit unit result;
              if gt result 0;
                unit.getTag temp Tag.PHANTOM_STATE_ORIGINAL;
                unit.setTag Tag.PHANTOM_STATE temp;
                set spend_tu 1;
              else;
                battle_game.flashMessage "Failed. You have been spotted.";
              end;

56
OXCE Suggestions DONE / Re: [Documentation] New Script hooks / data access
« on: February 04, 2020, 10:30:20 pm »
We got one more script hook, merged some days ago. It will soon become available.

tryPsiAttackUnit: Enables scripts to change the success of a psi attack. It gets the attackers and defenders strength and the pre-calculated outcome.

An example script that would change the success rate to 100% looks like this

Code: [Select]
    tryPsiAttackUnit:
      - offset: 23   # for Scripted Items - Automatic Success
        code: |
          var int battle_type;
          var ptr RuleItem item_rule;
          var int energy_max;
         
          item.getRuleItem item_rule;

          item_rule.getBattleType battle_type;
         
          if eq battle_type 9; # scripted psi amp
            if or eq battle_action 13 eq battle_action 14;
              debug_log "PsiAttack with scripted item. Automatic success!";
              set psi_attack_success 1;
            end;
          end;
          return psi_attack_success;

57
Suggestions / Re: Should the AI consider enemy range and partial cover?
« on: January 31, 2020, 06:22:08 pm »
Alright, thanks again for your patience, Meridian ;D

58
Suggestions / Re: Should the AI consider enemy range and partial cover?
« on: January 31, 2020, 06:08:43 pm »
Ok, we can agree on that.

But the alien should at least be able to distinguish which type of armor is being worn (would be visually different to a human) and which weapon type the enemy has (same argument), right?

59
Suggestions / Re: Should the AI consider enemy range and partial cover?
« on: January 31, 2020, 05:57:27 pm »
The AI should have, at maximum, the same abilities and access to the same information as a player controlling the aliens would have, if openxcom supported multi-player mode.

I figured as much, so weapons and armor would be fine then.

But soldier type is questionable?

60
Suggestions / Re: Should the AI consider enemy range and partial cover?
« on: January 31, 2020, 05:46:30 pm »
but the AI should NOT have access to 100% of the game state.

That completely depends on the design and I was just not aware of this design choice until now.
But you made yourself clear now.

So, one could implement the ability for aliens to use a mind probe and check the stats of X-COM soldiers?

And what about checking the weapons of soldiers? Is that considered cheating? And checking the Soldier Type? And Armor Type?


Pages: 1 2 3 [4] 5 6 7