aliens

Author Topic: [DONE] Armor that doesn't use energy when walking  (Read 3532 times)

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
[DONE] Armor that doesn't use energy when walking
« on: January 27, 2022, 05:34:07 pm »
I'm trying to create an armor that does not decrease a soldier's energy when it walks.

A unit's armor can be set to recover their entire energy the next turn using armors: recovery.energy but I need the amount of energy on the unit to hold at whatever its current energy value is when the unit steps between tiles so that it doesn't change during the current turn when walking.


I've been through the openxcom.log with verboseLogging, but haven't spotted a scripting section for when the unit walks.

I did see selectMoveSoundUnit but I don't think that is quite right, I think that one triggers when a unit is given the order to move by clicking a tile. (If I'm wrong please let me know)


Best case would probably be to set the units current energy to its last previous value every time movement occured between tiles.

Does anyone have advice for going about this?
« Last Edit: February 02, 2023, 01:48:34 pm by Meridian »

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
There is no "on walking" script hook, but you could give the armor a ridiculously high bonus to total energy and full energy recovery every turn to simulate movement's energy cost not mattering.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
This is hard part to add scripts as AI require to know how to handle it, if even I would allow to change cost it would be special flag on unit to give multiplier for cost, like "this unit spend 2 time more TU per tile than other units".

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
(Sorry about my delayed response)

There is no "on walking" script hook, but you could give the armor a ridiculously high bonus to total energy and full energy recovery every turn to simulate movement's energy cost not mattering.

Your solution is very function.

The only draw back is that in my case I have a few items that use energy as part of their use cost so if I give an armor an incredibly high max energy the equipped soldier would be able to spam the item without consequence.
Code: [Select]
- type: STR_EXAMPLE_ITEM
   costUse:
     energy: 20
   flatUse:
     energy: true

This is hard part to add scripts as AI require to know how to handle it, if even I would allow to change cost it would be special flag on unit to give multiplier for cost, like "this unit spend 2 time more TU per tile than other units".

It wouldn't bother me if it was only able to be used exclusively by player controlled units.

Either by a hard restriction that the AI (Alien/Civ) units can't wear armor with this variable or just by them ignoring it when present on an armor and losing energy as they normally do when walking.

So long as X-Com Soldier's can spend 0 energy when walking while wearing this specific armor, I would be perfectly happy with it.
« Last Edit: February 05, 2022, 07:18:43 am by The Martian »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
It wouldn't bother me if it was only able to be used exclusively by player controlled units.

Either by a hard restriction that the AI (Alien/Civ) units can't wear armor with this variable or just by them ignoring it when present on an armor and losing energy as they normally do when walking.

So long as X-Com Soldier's can spend 0 energy when walking while wearing this specific armor, I would be perfectly happy with it.
Adding more special cases between Player VS AI logic is big NO NO. One of my goal in OXCE is make game more uniform and symmetrical, beside AI need still handle correctly units under MC.

If you need only "can spend 0 energy" then this could be handled by version I suggest, multiplier for energy and TU move cost, because it is stable and AI can plan moves ahead. I will look if this is easy to implement.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9106
    • View Profile
Maybe I missed something obvious, but which mod are we talking about?

If this is a request for personal use modding only, then my priority for it is very low.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Adding more special cases between Player VS AI logic is big NO NO. One of my goal in OXCE is make game more uniform and symmetrical, beside AI need still handle correctly units under MC.

If you need only "can spend 0 energy" then this could be handled by version I suggest, multiplier for energy and TU move cost, because it is stable and AI can plan moves ahead. I will look if this is easy to implement.

I wasn't thinking clearly and forgot about the AI controlling the player units via MC. >_<

Your adjustable method is definitely superior and allows much more armor variety than a hard movement cost toggle on/off.


Maybe I missed something obvious, but which mod are we talking about?

If this is a request for personal use modding only, then my priority for it is very low.

The mod in question had not yet been released as it wasn't working right. . . but since using Ohartenstein23's energy solution functions well enough with standard TFTD I'll post it:
[OXCE][UFO][TFTD][ARMOR] Ride Armor

I'm still interested in updating it with a method that completely prevents energy loss from occurring when moving.
« Last Edit: February 07, 2022, 02:35:29 pm by The Martian »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
In OXCE 7.5.7 you can have:
Code: [Select]
armors:
  - type: STR_NONE_UC
    moveCost:
      basePercent: [100, 100]
Where you can alter cost multiplier for armor move cost.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
That is great news!

I see that OXCE 7.5.7 is one of the 'bleeding edge OXCE nightly preview builds'.

Where can I find documentation on the use of the moveCost: settings, I tried searching the forum and the UFOpaedia Ruleset Reference Nightly but nothing came up. (Which is not surprising as it is a preview build)

From reading it I'm guessing that moveCost: basePrecent: [100, 100] works something like basePercent: [TU%, ENERGY%].

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Yes, exactly. I used less descriptive fields as we can only use TU and ENERGY but I plan add lot more configs in future for different move modes.