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

[Trigger] Trigger related to lifesteal that doesn't work though its code seems alright

Status
Not open for further replies.
Level 3
Joined
Sep 20, 2013
Messages
29
I need a help with one sequence of triggers that i've constructed recently as a part of my new map.

That sequence is related to lifesteal as mentioned above and basically thanks to it a given unit should gain hit points by attacking enemy of ammount equal to a specific percent of attack that he deals against it. However, despite the fact that i can't find a mistake in it due to the fact that for me its just errorless, the trigger doesn't work properly, considering the tests that i've run with this map to see whether it's fine or not. Does anyone reading it right now have any clue or preferably a whole solution to my problem??? IF yes, then, please, post it as it will be very helpful to me and let me finish my map successfuly. :vw_sad:

Below i've posted the image files showing the sequence of these triggers that aren't executed according to my will

232799-albums7691-picture90195.html


232799-albums7691-picture90194.html


P.S.: I don't know if the images were loaded properly, because i did it for the first time on this site, so, please, check the album, that contains them, avaliable on my profile if it will be needed to see them in case that you won't see them on this post.

THANKS IN ADVANCE
 
Last edited:
Level 6
Joined
Jan 4, 2014
Messages
227
ok, first off all your algorithme is bad, because if the target gets attacked by another source of damage between the order and the attack ( which may be a very long time ), the damage from the second source will be calculated also making the life still giving a wrong value.

item type comparison is not like that, use this instead :

Multiple ConditionsOr - Any (Conditions) are true
Conditions
(target has an item of type Planes Walker Cloak) Equal to (==) True
(target has an item of type Warrior Helm) Equal to (==) True
(target has an item of type Warrior Suit) Equal to (==) True

Which can be found in the boolean comparison category in the condition window.

The best solution know would be to use a physical damage detection system, the best is this one :

http://www.hiveworkshop.com/forums/...rch=physical%20damage%20detection&d=list&r=20

1 - it can make the difference between the damage from spells or physical attacks
2 - it can detect the amount of damage and then amplify, decrease or nullyfie it
3 - it takes you half an hour to implement and understand ( you can send me the map and i will implement it for you if you want)
4 - you will need it in many things later

with this system you can detect the damage, the source and the target and apply the life steal.

Good luck :)
 
Level 3
Joined
Sep 20, 2013
Messages
29
Firstly, thanks for your answers :D

Secondly, before I'll use DDS which is JASS type of code, I want to mention here what are the effects of this problem to make sure based on your comments about it if it's really necessary.

Namely, while making use of this lifesteal effect by me that seems to be wrong, the hero instead of gaining additional life thanks to it, is draining his own life :O; in other words his hit points decrease by approximately 200 points with his each attack regardless of the other damage he takes ...

Has anyone realised why is this happening based on this code? What part of trigger exactly causes it?
 
GUI is crappy JASS anyways so don't get hypocritical. =)
Yes it is really necessary and if you learn how to use a DDS then you will be able to make much better maps by far. It takes about 10 minutes if that for the one by looking_for_help which is able to detect code/spell/and physical damage types. All 3 which most can't do.

Unit is attacked is precisely why you need to learn how to use DDS's because it is a event that is extremely buggy and in-affective. You can spam stop to continually trigger it making extremely strong attacks in this case. Yea of course it'd lose extra life, your not using damage but its own life. Likely with the proper equation you could gain life, but it'd never be what you really want.

I'll even make this trigger for you so you only have to look/read it.
[trigger=Your answer]
OnDamage
Events
Game - PDD_damageEventTrigger becomes Equal to 1.00
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
PDD_damageType Equal to PDD_PHYSICAL
Then - Actions
-------- Actions for PHYSICAL damage --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(PDD_source has an item of type Scourge Bone Chimes) Equal to True
Then - Actions
Unit - Set life of PDD_source to ((Life of PDD_source) + (0.15 x PDD_amount))
Else - Actions
-------- End of Actions for PHYISCAL damage --------
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
PDD_damageType Equal to PDD_SPELL
Then - Actions
-------- Actions for SPELL damage --------
Game - Display to (All players) for 10.00 seconds the text: ((Name of PDD_source) + ( damages + ((Name of PDD_target) + ( with damage: + (|cff6495ed + (String(PDD_amount)))))))
-------- End of Actions for SPELL damage --------
Else - Actions
-------- Actions for CODE damage --------
Game - Display to (All players) for 10.00 seconds the text: ((Name of PDD_source) + ( damages + ((Name of PDD_target) + ( with damage: + (|cff32cd32 + (String(PDD_amount)))))))
-------- End of Actions for CODE damage --------
[/trigger]

If you want to copy the triggers directly or test it, example/demo is posted below.
 

Attachments

  • yourlifesteal.w3x
    35.1 KB · Views: 83
Last edited:
Level 6
Joined
Jan 4, 2014
Messages
227
if it removes 200 Hp it may confuse with items, other abilities or another trigger maybe, so check the items and abilitys stats.

EDIT : i found an explication, check my next post.
 
Level 6
Joined
Jan 4, 2014
Messages
227
i found the problem : look !

OriginalLifeOfTarget = Life of target unit of issued order
OriginalLifeOfTarget = 1000 HP

Damage = OriginalLifeOfTarget - Life(Attacked Unit )
Damage = 1000 HP - 1000 HP ( Because the unit did not take damage !! and thats whats bad with "Is Unit Attacked Event" )

now : damage = 0

set attacking unit life = life of attacking unit + (0.15*Damage)
life = 2000 + (0.15*0)
life = 2000 + 0
life = 2000

if the target has got more HP between the time of issued order and the time of the attack for exemple 1000 HP to 1200 HP then :

OriginalLifeOfTarget = 1000 HP
Damage = 1000 HP - 1200 HP
Damge = -200
life = 2000 + (0.15*(-200))
life = 2000 - 200
life = 1800

and that how it will drains you 200 HP instead of Giving you 200 HP ^^
 
Level 6
Joined
Jan 4, 2014
Messages
227
@Dat-C3 yes ! but new GUI coders fear JASS and finds system implementation a bit hard, but @I Am The Mapchief, you can trust us, Damage Detection is the best solution and it will help you alot in future codes ^^
 
Status
Not open for further replies.
Top