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

Hard Thread: Making two units have same HP, same time +Rep

Status
Not open for further replies.
Level 8
Joined
Apr 6, 2009
Messages
254
Hello viewers, i realy need your help, so i will try to explain my best.

What i need is that two units have same hp when one of them is attacked:

It works like this: A unit takes damage, lets say 50 and its max HP is 6000, another unit like a Dummy will take same damage and have same Hit points (6000 - 50).
This will make both units have 5950 hit points.
Needs to work when a unit is healed to.


Why do i need this:

Its a perfect system for a healer, the Dummies will give control as heroes to the priest, when the Priest heals a dummy, the unit will be healed to.

+Rep for help
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Can't you just use this?

Damage:
  • Events
    • Unit - A unit Is attacked
  • Conditions
    • (Unit-type of (Attacked unit)) Equal to [Dummy]
  • Actions
    • Unit - Cause (Attacking unit) to damage [Hero], dealing (Damage taken) damage of attack type Normal and damage type Normal
Spells: (healing)
  • Events
    • Unit - A unit Begins casting an ability
  • Conditions
    • (Ability being cast) Equal to [Spell]
    • (Unit-type of (Target unit of ability being cast)) Equal to [Dummy]
  • Events
    • Unit - Cause (Casting unit) to damage [Hero], dealing (-1.00 x [Amount healed (attributes or something)]) damage of attack type Spells and damage type Normal
I didn't test it, though...
You can add special effects to them, or whatever (don't forget to destroy them to avoid leaks :p)
 
Level 11
Joined
Feb 16, 2009
Messages
760
Will somebody EVER learn it. You may never use a unit is attacked, it bugs as hell becuase it detects the ORDER. Use a damage detection system. Then you can use his trigger. Also I dotn think there is such a thing as [Amount healed]. Since the spell cant be MUI anyway, you can use
Set TempUnit = Target unit of ability beign cast
Set TempInteger[1] = Current life of TempUnit
wait (Casting time of the spell+0.5 seconds to be sure or something)
Set TempInteger[2] = Current life of TempUnit
Cause casting unit to damage [Hero], dealing -1.00*(TempInteger[1]-TempInteger[2]

TempUnit is because target unit of ability loses its value

PS:If you need a damage detection system ill post one later
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Will somebody EVER learn it. You may never use a unit is attacked, it bugs as hell becuase it detects the ORDER. Use a damage detection system.
I know that, thank you... no need to shout like that.
The reason I have used this is because the dummy only gets attacked by NPC's, since NPC's do not spam the stop-button, the function will not bug in this trigger.

The "[Amount Healed]" has as sidequote "(attributes or something)", because attribute/level-based skills are almost always better than ordinary, ability-level-based skills.
So you can easily calculate the Amount Healed with triggers.

I still need a damage detection system for one of my maps, so I will be waiting untill you post it, but in this case there is no need for one.
If you still have any remarks that are worth shouting at me, go ahead.
 
Level 8
Joined
Aug 4, 2008
Messages
279
Hmmmmm, why dont u try:
Make a buff named, Health Share

Make the unit u want to have that buff.Then

  • Event - A unit is attacked.
  • Conditions - Attacked unit has Health Share buff.
  • Actions - Set life of attacked unit to life of (the principal unit that share the health with the other).
Hope that help =)
 
Level 8
Joined
Apr 6, 2009
Messages
254
Thanks for trying, even when some of you are a bit angry of this thread i see...

@dimitri231

I dont understand, can u explain more? maybe it works xD

@DarkAngelAzazel

Tried that, if you do that and the damage is taken when the timer is on 0.24, the damage taking unit wont take any damage at all, prove me wrong if i am.

@ap0calypse

I think i will try to convert all spells based on Attributes then, and see how that works, maybe its more balanced since items gives stats :thumbs_up:

Note: My english is pretty bad, so please dont tell me that i spelled something wrong...
 
Level 13
Joined
Sep 14, 2008
Messages
1,408
@DarkAngelAzazel

Tried that, if you do that and the damage is taken when the timer is on 0.24, the damage taking unit wont take any damage at all, prove me wrong if i am.

Your freaking colors are driving me crazy -.-

Well let me explain what I mean.

You have a "damage taking unit" and a "dummy unit"

The dummy unit should always have the same hp as the damage taking unit.
So every 0.25 seconds you set the life of the dummy unit to the life of the damage taking unit.

Example:

Time: 0.25

Taking Unit - HP = 9000
-> Dummy Unit - HP = -> 9000

Time: 0.5

Taking Unit - HP = 8900
-> Dummy Unit - HP = -> 8900

Time: 0.75

Taking Unit - HP = 8950
-> Dummy Unit - HP = -> 8950
 
Level 8
Joined
Nov 9, 2008
Messages
502
If you are really worried about DarkAngelAzazel's method you can simply put the periodic timer to 0.03 seconds. Because it's a pretty simply function it wouldn't create much of an overhead so you would be able to use such a small time without an negatives.

P.S. I love the colours :>
 
Level 7
Joined
Nov 13, 2006
Messages
243
Ok i will explain what you should do because i am to lazy to write a trigger :))

What you need:

Variables:
AttUnit (Unit) - Attacked unit
AttUnitHP (Real) - Life of attacked unit
AttUnitDummy (Unit) - Attacked unit dummy
AttUnitDummyHP (Real) - Attacked unit dummy hitpoints
AttackingUnit (Unit) - Attacking Unit (make a trigger and set him at initialization if you want)
Triggers:

Make a trigger to check every 0.5 seconds of the game the life of both units and set them as variables.

And another trigger to check when a unit is attacked and set the hitpoints and set them according to the variables using hitpoints of dummy for unit and vice versa.
 
Level 11
Joined
Jul 25, 2005
Messages
573
Ok, couldn't this work? I didn't test it just tried coming up with something real quick.

EVENT
- Time every X.xx seconds of game time

Conditions
- None

Actions
+ Multiple Functions If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If (Conditions)
: (Life of (Dummy) Less than or equal to (Life of (Hero))
- Then (Actions)
: Set Life of Hero to Dummy
- Else (Actions)
: Set Life of Dummy to Hero


In theory I believe this would work.

Example
1) Hero's Life is 200/300
2) Dummy's Life is 200/300
3) Hero is healed for 50 Life
4) Dummy's Life becomes Less than Hero's Life
5) Dummy's Life is set to that of the Hero's Life
 
Level 11
Joined
Nov 15, 2007
Messages
800
Ok, couldn't this work? I didn't test it just tried coming up with something real quick.

EVENT
- Time every X.xx seconds of game time

Conditions
- None

Actions
+ Multiple Functions If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If (Conditions)
: (Life of (Dummy) Less than or equal to (Life of (Hero))
- Then (Actions)
: Set Life of Hero to Dummy
- Else (Actions)
: Set Life of Dummy to Hero


In theory I believe this would work.

Example
1) Hero's Life is 200/300
2) Dummy's Life is 200/300
3) Hero is healed for 50 Life
4) Dummy's Life becomes Less than Hero's Life
5) Dummy's Life is set to that of the Hero's Life

Won't work if the hero is healed directly.
 
Status
Not open for further replies.
Top