Author Topic: Limiting the weapon a soldier can carry  (Read 6677 times)

Offline Ethereal

  • Commander
  • *****
  • Posts: 684
    • View Profile
Re: Limiting the weapon a soldier can carry
« Reply #15 on: January 23, 2022, 10:45:35 pm »
Thanks a lot. It works. I only checked "WEAPON_SKILL_SOLDIER_MUL", because in my modification such bonuses for armor are not suitable. In general, Britney Spears can take a sniper rifle, but only to crack nuts. Yankes, once again, thank you for  help!

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: Limiting the weapon a soldier can carry
« Reply #16 on: January 24, 2022, 08:01:10 am »
probably, this is offtopic, but still - how do I set tags for GeoscapeSoldier to use it later with commands like
Code: [Select]
            unit.getGeoscapeSoldier s;
            s.getTag temp Tag.WEAPON_SKILL_SOLDIER_MUL; #if `s == null` then `getTag` will set `0` to `temp`

Offline Ethereal

  • Commander
  • *****
  • Posts: 684
    • View Profile
Re: Limiting the weapon a soldier can carry
« Reply #17 on: January 24, 2022, 02:48:04 pm »
probably, this is offtopic, but still - how do I set tags for GeoscapeSoldier to use it later with commands like

If I understood you correctly - 

Code: [Select]
items:
  - type: STR_HEAVY_LASER
    tags:
      WEAPON_SKILL_DIFF_AIM: 30
      WEAPON_SKILL_DIFF_AUTO: 30
      WEAPON_SKILL_DIFF_SNAP: 30
soldiers:
  - type: STR_SOLDIER
    tags:
      WEAPON_SKILL_SOLDIER_MUL: 10

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Limiting the weapon a soldier can carry
« Reply #18 on: January 24, 2022, 03:40:03 pm »
probably, this is offtopic, but still - how do I set tags for GeoscapeSoldier to use it later with commands like
Code: [Select]
            unit.getGeoscapeSoldier s;
            s.getTag temp Tag.WEAPON_SKILL_SOLDIER_MUL; #if `s == null` then `getTag` will set `0` to `temp`
There two things happens, in this example tag belong to `RuleSoldier` not `GeoscapeSoldier`, but you can as shortcut get rule tag using soldier itself.
And if you use tags that belong to `GeoscapeSoldier` then you can easy use `s.setTag Tag.ZZZZ 10;` to set custom values.

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: Limiting the weapon a soldier can carry
« Reply #19 on: February 18, 2022, 10:43:44 pm »
Not sure if I can understand how to get `GeoscapeSoldier`'s tag from the unit then...

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Limiting the weapon a soldier can carry
« Reply #20 on: February 19, 2022, 12:46:35 am »
Same way, `getTag` is overloaded for rule tags and soldiers tags, as each tag name is globally unique we can easy chose correct version.