• 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.

Revive a Non Hero?

Status
Not open for further replies.
Level 3
Joined
Jun 23, 2008
Messages
22
I'm going to assume it is without an altar...
store the dying unit as a variable and when it dies create another unit of the same type and store it under the variable of the dying unit.

if it is with an altar store the unit as a variable and use this trigger
  • Unit Revive
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If ((([variable]) is alive) Equal to True) then do (Player - Make [unit type] Unavailable for training/construction by [Player]) else do (Player - Make [unit type] Available for training/construction by [Player])
when the unit is built again stare it as the same variable
 
Level 4
Joined
Aug 17, 2007
Messages
36
Thanks for the help everyone, but I'm still running into some troubles. I should have been more specific from the beginning.

The revived unit has to be the exact same unit. This is because there are triggers based around each specific unit, that cannot be generated to work for a generic unit. Simply, it is the event "Unit Takes Damage" that I need to work for each unit that I would like to revive. The "Unit Takes Damage" event does not work for generic units.

The problem I run into with each of these solutions is that they are the same type of unit and not the exact same unit.

@mj1994
I must've been tired when I wrote my first post, because it needs to be a specific unit and not a variable unit. I take the blame entirely for the misunderstanding.

@power_shaman
Yeah, making them all heroes is my backup plan. I just don't want to go through the trouble of creating 17 new hero units if I can use the ones I already have.

@Squiggy
This is the same problem, it creates the same type of unit and doesn't revive the exact same unit, because the "Unit - Replace" action can only do unit-type. Again, it's my fault for mis-communication.

Again, thanks for all the help and if anyone has any idea on how to revive the unit and not just replace it with a unit of the same type, I'd appreciate it.

[EDIT: My problem must be elsewhere than with the revive triggers because it won't even revive Heroes. There's probably something in the other triggers preventing it from reviving the unit. I'll update as soon as I figure out more.]

[EDIT2: It looks like it's just heroes based on the Paladin unit will not revive. I'm just remaking each of the units as a hero and calling it good. Thanks for the help!]
 
Last edited:
Level 28
Joined
Mar 25, 2008
Messages
2,955
Fail D:
Look, mate ^^
xxkf3.jpg

Although being in german, the picture shows the important thing
 
Level 3
Joined
Jun 6, 2008
Messages
51
No, Squiggy, that replaces the unit with a fresh unit and would break the triggers that were doing stuff to the old unit. The "Unit Takes Damage" event he mentioned above does not work for generic units or even variables (at least in the GUI), it has to be a specific unit placed in the World editor.

I thought that since a unit's corpse is still technically the unit, you could just set the unit's life to 100%, but that just created a corpse with 100% of the unit's life.
  • revive priestess
    • Events
      • Unit - Sorceress 0003 <gen> Dies
    • Conditions
    • Actions
      • Unit - Set life of Sorceress 0003 <gen> to 100.00%
      • Unit - Move Sorceress 0003 <gen> instantly to (Player 1 (Red) start location)
LOL, to make sure that whatever unit showed up was still the same sorceress, I had a trigger that would make the unit do some animation (Spell Attack), out of curiosity I set it off and the corpse model was replaced by the sorceress model, but it was unselectable, just like a corpse usually is. A ghoul could even use cannibalize on it.

So it looks like you are going to have to replace the unit, but before that, like at map initialization, set a unit variable to that unit (Set foo[3]=unit 0021 <gen>). You will have to change that trigger event "Unit Takes Damage" to something more generic like "unit is attacked" followed by the conditional "Triggering unit is foo[3]". You will also have to use that conditional in every other trigger that acts on that unit specifically. I am sure "unit is attacked doesn't take care of all instances of "Unit Takes Damage" (does AoE and stuff like standing too close to a unit with lightning shield count as attacks? Not all attacks cause damage either) so you will have to get creative with the events, conditionals and actions. Maybe using Hero Units would be easier if you have a lot of these sort of triggers. Anyways...
  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Triggering unit) Equal to foo[3]
    • Actions
      • Unit - Replace (Triggering unit) with a (Unit-type of (Triggering unit)) using The new unit's default life and mana
      • Set foo[3] = (Last created unit)
      • Unit - Move foo[3] instantly to (Player 1 (Red) start location)
 
Level 4
Joined
Aug 17, 2007
Messages
36
Thanks for the replies.

Yeah, the whole purpose of this is to create a bounty system that gives units gold after they deal damage to an enemy and not when they kill an enemy.

I currently have a system that works with "Generic Unit Is Attacked" but it is buggy and the whole problem is solved if I just revive specific units, but I'm already 1/4 done with converting the units into heroes, as well as revamping the spawn system, so that's currently the track I'm taking.

If you'd like to take a look, it's at
Epic v.2.1051 - The Hive Workshop - A Warcraft III Modding Site

...

But... you said that there's no way to have "Unit Takes Damage" work for generic or variable units in GUI. Is there any way to do it in Jass? I've tried but kept getting errors. For example:

TriggerRegisterPlayerUnitEventSimple( gg_trg_, Player(11), EVENT_PLAYER_UNIT_DAMAGED )

does not work. If there's something similar, I'd love to ditch this whole remaking units thing and just redo the bounty trigger.
 
Level 4
Joined
Aug 17, 2007
Messages
36
It would be easy to do that, I'd just add the building classification to each of the units or allow pillage to target units, but the problem with that is I wouldn't be able to control the amount of gold that is given and still keep the map RoC compatible.

That was a good idea, though. If I were making a TFT map, I'd do that without hesitation.
 
Status
Not open for further replies.
Top