• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Spell] Harvest ability bug

Status
Not open for further replies.
Level 5
Joined
Dec 25, 2014
Messages
110
So, i planned to make the harvest ability to be able to use if only there is a specific unit exist. I tried to set the Techtree Requirements to the required unit. Yes it works that the ability is disabled until the specific unit exist BUT it is still clickable. It's very annoying. Any thoughts?
 
If I'm right about the problem you're facing, I think you could achieve what you want with some simple triggers

This one enabled by default :

  • Make Harvest Available
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equals to Peasant
    • Actions
      • Trigger - Turn off (This trigger)
      • Player - Enable Harvest for (Owner of (Triggering unit))
      • Trigger - Turn on Make Harvest Unavailable <gen>
This one disabled by default (will trigger when your last specific unit dies) :

  • Make Harvest Unavailable
    • Events
      • Unit - A unit dies
    • Conditions
      • (Number of units in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equals to Peasant))) Equals to 1
    • Actions
      • Trigger - Turn off (This trigger)
      • Player - Disable Harvest for (Owner of (Triggering unit))
      • Trigger - Turn on Make Harvest Available <gen>
Disable the abilty at start :

  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Player - Disable Harvest for (Picked player))
The code will work assuming you've got the Harvest ability on your specific unit
 
Well yes those would disabled the ability but it wouldn't show the ui and it would disabled it for the whole units of the player. I tried it once with UnitEvent for the unit create and dies and using BlzUnitDisableAbility but it comes weird, it got disabled or enabled sometimes for each event runs.
 
Last edited:
Nevermind I thought you wanted to hide the icon UI aswell. Could you post the triggers you've tried so far ?
 
  • Make Harvest Unavailable
    • Events
      • Unit - A unit dies
    • Conditions
      • (Number of units in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equals to Peasant))) Equals to 1
    • Actions
      • Trigger - Turn off (This trigger)
      • Player - Disable Harvest for (Owner of (Triggering unit))
      • Trigger - Turn on Make Harvest Available <gen>
It is worth noting that this condition will return a false, if all units of type Peasant die within the time-frame between the unit dying and the unit being removed from the game's memory. I don't know how long that time-frame is, but I think it lasts as long as the entire death animation, so that's several seconds.
You need to count living units and check that their count is at 0.

Also, you are leaking a unit group here and a player group in your last trigger.
 
You could replace the harvest ability with a dummy ability (that does nothing) that has the correct tech tree requirement, then when the requirement is met you remove the dummy ability and add the harvest ability again.


p.s. The easiest way would probably be to not actually remove the harvest ability (and re-add it) but rather to just temporarily disable it.
 
Death animation + decay duration if the unit decays. Instantly after death animation if no decay or exploded.
Right, wasn't certain about the decay duration. Thanks for the input!
On a side-note, how do spells like Reanimate Dead and Revive work?
Do the corpse units have an attached unit-type to them?
 
The corpses are the units... just dead.
I don't mean the corpse of the decaying unit, I mean the generic corpses left behind for use in abilities, like the ones unloaded by a meat wagon or generated at a graveyard, that's what some dying units turn into. Is this skeletal corpse part of the decaying cycle of a unit? If so, what are the generic corpses?
 
They're not generic corpses. Those skills all have a data field that allows you to choose which unit-type is created as a corpse; by default they are ghouls. Resurrection seems unable to target meat wagon exhumed corpses in my limited testing (yes I did change its targets allowed).
 
They're not generic corpses. Those skills all have a data field that allows you to choose which unit-type is created as a corpse; by default they are ghouls. Resurrection seems unable to target meat wagon exhumed corpses in my limited testing (yes I did change its targets allowed).
Interesting, thanks for the insight.
 
Status
Not open for further replies.
Back
Top