• 🏆 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!

Damage = Damage Taken

Status
Not open for further replies.
Level 5
Joined
Mar 30, 2010
Messages
75
Umm I need help

see i'm making an ability like puppet master's in hon his last skill i can actually do it but the problem i can't make the damage taken of the summoned unit to be thesame as the damage of the targeted unit there is an action but it's event response but the event has to be specific unit event but the unit i'm using for this is stored in a variable so i can't actually use it in that event please help me
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
WC3 has no way to do this. You will just have to make and leak a lot of unit is damaged events by adding them to the trigger via the add event action (the attach event native).

In SC2 you will be able to do this as there is a generic unit is damaged event and additionally the more robust garbage collector means there probably are no leaks with destroying triggers.
 
Level 8
Joined
Apr 30, 2009
Messages
338
I use this system in my map:
http://www.hiveworkshop.com/forums/spells-569/gui-friendly-damage-detection-v1-2-1-a-149098/

You don't have to know JASS at all (I don't). You should however have a basic knowledge of hashtables and you should save the target of your Voodoo Puppet to a hashtable tied to the actual Puppet unit. You just have to paste the GDD script on your map and then make this trigger:

EVENTS
GDD_Damage becomes equal to 0.00

CONDITIONS
Unit-Type of GDD_DamagedUnit equal to "Voodoo Puppet"

ACTIONS
Set temp_point = (Center of Playable map area)
Set temp_group = all units within 1.00 of temp_point
Custom Script - call RemoveLocation(udg_temp_point)
Unit Group - Remove all units from temp_group
Unit Group -Add GDD_DamagedUnit to temp_group
Unit Group - Pick every unit in temp_group and loop actions:
>>>Loop
>>>Set temp_real = 1.40 x GDD_Damage
>>>Unit - Cause (Picked Unit) to damage (Hashtable - load key "target" of key(Picked Unit) from "Hash_VoodooPuppet"), dealing temp_real of Attack Type Spells, Damage Type Magic
>>>Unit Group - Removed (Picked Unit) from temp_group
Custom Script - call DestroyGroup(udg_temp_group)


And the whole thing about making an empty group and adding one unit to it is so you can reference the unit with "Picked Unit" because you can't reference unit variables when using hashtable keys for some reason
 
Last edited:
Level 18
Joined
Jan 21, 2006
Messages
2,552
I would definitely not recommend using a unit-group just because you can't reference the unit through the GUI. If you're going to need it, use a custom script line. If you don't know what to add, tell me which line you're having troubles with (using the trigger tags) and I will help you.
 
Level 5
Joined
Mar 30, 2010
Messages
75
Thanks for the help guys i'll commend you guys in my map

I'm not good with hastables i was trying to find tutorials but i couldn't find so i'm feeling
very original so i'm making it different i'll make the puppet into to infinite health(5000000health)
but only lasts for a few seconds or if the target goes to far from it so it will be like this

Puppet Timer

Event
Unit learns a skill

Condition

Actions
If ability puppet for learning unit is equal to 1 then set puppet_timer to 5.00 else do nothing

If ability puppet for learning unit is equal to 2 then set puppet_timer to 7.00 else do nothing

If ability puppet for learning unit is equal to 3 then set puppet_timer to 10.00 else do nothing





Puppet Setup

EVENT
Unit Begins Casting a Spell

Condition
Ability being casted is equal to puppet

Actions
Create 1 puppet for owner of ability being casted target in the position of casting unit

turn on Puppet Damage




Puppet Damage

EVENT
Unit is attacked

Conditions
attacked unit is equal to puppet

Actions
Cause casting unit to damage target dealing Int of casting unit x # damage of attack type Magic and damage type normal

If target is equal to dead then remove puppet from the game

wait puppet_timer

Remove puppet from game
 
Last edited:
Status
Not open for further replies.
Top