• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Repairman inside

Status
Not open for further replies.
Level 10
Joined
May 25, 2021
Messages
376
Hey guys, I am trying to make a trigger which allows a type of transporting unit to have a autocast self-heal ability or at least can regenerate HP automatically when they have a worker type unit in their cargo. But I'm stuck. Please help me! Very appreciate it!
 

Attachments

  • Screenshot_1.jpg
    Screenshot_1.jpg
    33.8 KB · Views: 8
Level 30
Joined
Aug 29, 2012
Messages
1,385
You could create an ability based on Unholy Aura or the ring of regeneration, make sure it affects only mechanicals and self, and then give it to the boat via trigger, unless you want the repairs to cost resources which will be much tricker imo

Then remove the ability whenever the transport is unloaded :)
 
Level 10
Joined
May 25, 2021
Messages
376
You could create an ability based on Unholy Aura or the ring of regeneration, make sure it affects only mechanicals and self, and then give it to the boat via trigger, unless you want the repairs to cost resources which will be much tricker imo

Then remove the ability whenever the transport is unloaded :)
Ah yes, the one to cost resources. :cry:
I forgot to mention.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
  • Use a system like this to detect load/unload events: GUI Unit Event (now with a state-of-the-art Lua version)
  • Put the autocast heal ability in the transport's spell list.
  • Whenever a transport enters playable map area, disable its version of the heal ability. There is an action for this.
  • When a transport loads a unit with the worker classification, enable the ability for that unit.
  • When a transport unloads a unit with the worker classification, disable the ability again for that unit.
Because this logic is simple, if you load 2 workers and then unload one of them... the transport will not be able to heal itself any more even though it has a worker inside it. To resolve this problem you need to keep track of how many worker units are currently loaded into the transport, which can be accomplished in a few different ways. You could store an integer in an array for each transport that goes up/down by +-1 when workers are loaded and unloaded, save this info to a hashtable with the transport as a key, or create a unit group for each transport's loaded units and then check against the number of units in that group.
 
Status
Not open for further replies.
Top