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

Any Unit Takes damage

Status
Not open for further replies.
Level 19
Joined
Aug 24, 2007
Messages
2,888
I need a trigger that detects a unit is damaged
I know there is a trigger like that but it contains non-existing functions or are they just old or are they for WEU only anyway I need another one
Im trying to create myself these theys like a trigger that registers events for another trigger for everyunit enters the map but Im confused with this
So you help me and I get your help :D
EDIT:
JASS:
function actions takes nothing returns nothing
    call KillUnit(GetTriggerUnit())
endfunction

function unitadder takes unit dmgedunit,trigger which returns nothing
     call TriggerRegisterUnitEvent(which,dmgedunit,EVENT_UNIT_DAMAGED)
endfunction

function InitTrig_another takes nothing returns nothing
    local trigger unitdmg
    call TriggerAddAction(unitdmg,function actions)
endfunction

function unitdmgfun takes nothing returns nothing
    local trigger unitdmg
    set unitdmg = CreateTrigger()
    call unitadder(GetTriggerUnit(),unitdmg)
endfunction

function InitTrig_gtunits takes nothing returns nothing
    local trigger gtunits
     set gtunits = CreateTrigger()
    call TriggerAddAction(gtunits,function unitdmgfun)
    call TriggerRegisterAnyUnitEventBJ(gtunits,EVENT_PLAYER_HERO_REVIVE_FINISH)
    call TriggerRegisterEnterRectSimple(gtunits,GetEntireMapRect())
endfunction

function rmunits takes nothing returns nothing
    call DoNothing()
endfunction
Anyway this is my current progress I can easly do it with 1-2 global variables but I dont want anyglobal variable for a spell
Anyway I quite know this doesnt work I thought you can make a working version
 
Last edited:
Level 8
Joined
Sep 15, 2006
Messages
426
You could just use a combination of things like A Unit Is Attacked or A Unit Casts A Spell, and work that out the way you want it.
 
Level 7
Joined
Feb 18, 2007
Messages
216
You mean like this blood system by Ham Ham?

  • Detect Damage
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to Create Blood <gen> the event (Unit - (Entering unit) Takes damage)
  • First Units Detect
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Create Blood <gen> the event (Unit - (Picked unit) Takes damage)
  • Create Blood
    • Events
    • Conditions
    • Actions
      • Unit - Create 1 Blood Dummy for Neutral Passive at (Position of (Triggering unit)) facing (Random angle) degrees
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Thanks for trying to help anyway but this is not somethink I asked I know I didnt give enough information about it so I edited my tread check it again please
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
I dont know what is CSCache and I added something like
JASS:
function rmunits takes nothing returns nothing 
 call DoNothing()
 endfunction
Because may be I change it to something else for reducing lags
(BTW I know you dont need call DoNothing() for making a function useless :D)
!!! EDIT !!!
yey I found cscache :D thanks for tip
They really should make you site admin
so we put this in map header right ? (optional question dont answer :p)
 
Level 12
Joined
Aug 18, 2006
Messages
1,193
You mean like this blood system by Ham Ham?

  • Detect Damage
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to Create Blood <gen> the event (Unit - (Entering unit) Takes damage)
  • First Units Detect
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Create Blood <gen> the event (Unit - (Picked unit) Takes damage)
  • Create Blood
    • Events
    • Conditions
    • Actions
      • Unit - Create 1 Blood Dummy for Neutral Passive at (Position of (Triggering unit)) facing (Random angle) degrees
i belive this system is pretty flawed

i would say it would add a revived hero every time it is revived, making it splash very much more blood than usual
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Very Bad Situation:
The code you gave me about any unit takes damage doesnt detect the damage done by Bounced attacks :(
help please
and I know its not triggers problem specify unit takes damage event doesnt deteck these types of damages I think
this is totally unfair !!!!!!!!!!!!!!
I only need that function for a that kind of situation
EDIT:
Well my spell contains something like create a dummy unit order it to attack (it has bouncing attack) , create spellcasters and order them to cast spells to units damaged by dummy unit
Anyway they cast the spell to only first unit others get nothing just the projectile and damage it has
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Yea Thats what I tought and I have an intresting idea about it
The Dummy unit will have %100 bash or something that buffs the bounced units and trigger will check the units with that buff and spellcaster will cast them a spell Sure I have to make timing is good to not cause of double cast or no casting

ANYWAY there is a problem I still need to detect attacking player or unit to get bounty :/


EDIT: If someone is going to say "you can do it with a trigger like Chain of Frost", Im trying to make a chain of frost spell already
But the chain of frost spell we know is a little buggy like projectile doesnt chase the enemy it goes on single direction and etc etc etc etc
(BTW I checked the Chain of Frost spell in Spells section of Hive)


May be I can use chain lightning system :/ it works great
Also the banishing one has attack delay so I can make hits delayed
But Im not sure of we get bounty on killing thing too ...

EDIT #5485 :D
As you can get I dont want anything creepy on my map like using global triggers etc
Dont want it to get bugged when 2 units casted in same time or 2nd casted while 1st's is still going
I can make something like unit gets damaged if damage source is dummy create another dummy on same position with damaged unit and order it to attack another unit and a bounce counter with it but since bounce time is a variable I cant use it because even if I make it arrayed for each player it will be bugged if there are 2 same type of units in one player


So Any solutions even if there are too many conditions as I asked ? :D


---END OF POST---
 
Last edited:
Level 19
Joined
Aug 24, 2007
Messages
2,888
Have another solution about it then ?
Guess I should forget it or use the chain of frost system
anyway Frost Revenant has great spells already :p
I was just looking for 4th and tought may be its a good idea


!!! BUT !!!
a "bouncing projectile causes buffs or makes a dummy cast something to hitted targets" like system would be great how sad its this hard to create one :sad:
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Anyway Close this Thread please I dont want help with this anymore
I wont use Chain of Frost in my map one way or another
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
I didnt mean you PurplePoot one of World editor moderators I mean
Anyway I found a really good way to create the system I really dont want anyother help
BTW it is just custom value
Unit takes damage
if attacker = dummy
move attacker to dummy and order it to attack another enemy around it
and reduce custom value by 1
end when custom value is 0
 
Status
Not open for further replies.
Top