Author Topic: Automatcially remove armour for an autohealer mod  (Read 232 times)

SFDMerch

  • Newbie
  • *
  • Posts: 2
    • View Profile
Automatcially remove armour for an autohealer mod
« on: July 01, 2020, 06:26:54 pm »
Hi im trying to make an auto healer and i am having trouble trying to remove pants/armour from the character to activate peredozin automatically, i have a system that works ok for using items for healing and such, i just cant figure out how to remove armour automatically, any help would be appreciated. Also if anyone has a better way to activate items let me know as my way is pretty janky. https://prnt.sc/ta4zii Also sorry for the link i have no idea how to post screenshots to the fourm.
« Last Edit: July 01, 2020, 09:09:40 pm by SFDMerch »

ai_enabled

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 1654
    • View Profile
Re: Automatcially remove armour for an autohealer mod
« Reply #1 on: July 03, 2020, 07:08:04 am »
Hello!

You need to get the player character equipment items container and move the armor from there to any other container such as inventory/hotbar/hand. Then apply the peredozin, then move the armor back to the same slot it was taken from the equipment container.
To get an items container from the player character, you can use an extension method SharedGetPlayerContainerEquip ment, also SharedGetPlayerContainerHotba r, SharedGetPlayerContainerInven tory, SharedGetPlayerContainerHand (you can find plenty of examples in Core.cpk code).
To move an item from one container to another you need to use Api.Client.Items service, method MoveOrSwapItem (also plenty of examples in Core.cpk code).

As a side note, please note that in A27 Update (since the experimental launch on 31 June) we've already changed the peredozin application mechanic so it's best to save your time and stop working on the peredozin auto-application idea. In A27 this drug cannot be applied quickly. The player has to remove the armor, apply the peredozin, wait 5 seconds, and only then the armor could be put back. So while applying the peredozin players have to take cover and the moment of application should be chosen carefully otherwise the player will risk dying in combat quickly without an armor (in A27 there is no longer a pants slot as the chest+pants now combined in a single slot). This way any advantage from the potential auto-healing mod is minimized.

Regards!

SFDMerch

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Automatcially remove armour for an autohealer mod
« Reply #2 on: July 03, 2020, 07:09:51 am »
Ahh thankyou for the heads up. That saves me alot of effort.

ai_enabled

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 1654
    • View Profile
Re: Automatcially remove armour for an autohealer mod
« Reply #3 on: July 03, 2020, 01:31:10 pm »
Sure! By the way, please consider sharing your mod. :-)

Regards!