• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Repairman inside

Status
Not open for further replies.
Level 10
Joined
May 25, 2021
Messages
362
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 22
Joined
Aug 29, 2012
Messages
896
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
362
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 40
Joined
Feb 27, 2007
Messages
5,122
  • 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