• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Repairman inside

Status
Not open for further replies.
Level 10
Joined
May 25, 2021
Messages
344
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: 4
Level 20
Joined
Aug 29, 2012
Messages
827
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
344
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 39
Joined
Feb 27, 2007
Messages
5,016
  • 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