Detecting when unit takes damage

bananaHUNT

You can change this now in User CP
Reaction score
55
I need your help again :D
I have a morphing spell that changes the attack missille of my Batrider from the normal burning clask to the volcano missile (looks like a burning rock).
Now, what i want is that when it hits the target, the rock rolls along for a while, damaging unit on its path. I have everything set up, but there is only 1 problem:

I don't know when to create the rolling burning rock, cause I need something like a "Unit takes Damage" event. "Unit is attacked" won't work, because it creates the rock way too early. I've tried to add the event "Triggering unit takes damage", as suggested by other people on this forums, but that doesn't work somehow and it's very glitchy. Sometimes random rocks are being made, sometimes it just doesnt work etc.

I would be very thankfull if someone could take a look at my triggers:
This is the first part of the damage detection trigger someone suggested:
Code:
Burning Rock Init
    Events
        Map initialization
    Conditions
    Actions
        Set BR_Hero = Troll Batrider 0038 <gen>
        Set BR_Group = (Units in (Playable map area))
        Unit Group - Pick every unit in BR_Group and do (Actions)
            Loop - Actions
                Trigger - Add to Burning Rock Path <gen> the event (Unit - (Picked unit) Takes damage)
                Unit Group - Add (Picked unit) to BR_Group_Check
        Custom script:   call DestroyGroup (udg_BR_Group)

This is the second part
Code:
Burning Rock Init 2
    Events
        Unit - A unit enters (Playable map area)
    Conditions
        ((Triggering unit) is in BR_Group_Check) Equal to False
    Actions
        Trigger - Add to Burning Rock Path <gen> the event (Unit - (Triggering unit) Takes damage)
        Unit Group - Add (Triggering unit) to BR_Group_Check

This is to detect when he used the morphing ability or not
Code:
Burning Rock Missile
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Burning Rock 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                BR_Check Equal to 0
            Then - Actions
                Set BR_Check = 1
                Trigger - Turn on Burning Rock Path <gen>
                Special Effect - Create a special effect attached to the weapon of (Casting unit) using Abilities\Spells\Other\Volcano\VolcanoMissile.mdl
                Set BR_Missile = (Last created special effect)
            Else - Actions
                Set BR_Check = 0
                Trigger - Turn off Burning Rock Path <gen>
                Special Effect - Destroy BR_Missile

This is when and where the rock is created - I need some help with this
Code:
Burning Rock Path
    Events
    Conditions
        (Damage source) Equal to BR_Hero
    Actions
        Set BR_TargetLoc = (Position of (Triggering unit))
        Set BR_HeroLoc = (Position of BR_Hero)
        Set BR_Angle = (Angle from BR_HeroLoc to BR_TargetLoc)
        Unit - Create 1 Burning Rock Missile for (Owner of BR_Hero) at BR_TargetLoc facing BR_Angle degrees
        Unit - Turn collision for (Last created unit) Off
        Set BR_Rock = (Last created unit)
        Trigger - Add to Burning Rock Damage <gen> the event (Unit - A unit comes within 100.00 of BADummy[(Custom value of (Last created unit))])
        Custom script:   call RemoveLocation (udg_BR_TargetLoc)
        Custom script:   call RemoveLocation (udg_BR_HeroLoc)

This is the movement of the rock (and destruction)
Code:
Burning Rock Movement
    Events
        Time - Every 0.02 seconds of game time
    Conditions
    Actions
        Set BR_RockPt = (Position of BR_Rock)
        Set BR_MovePt = (BR_RockPt offset by 10.00 towards BR_Angle degrees)
        Unit - Move BR_Rock instantly to BR_MovePt
        Set BR_Distance = (Distance between BR_HeroLoc and BR_MovePt)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                BR_Distance Greater than or equal to 500.00
            Then - Actions
                Unit - Remove BR_Rock from the game
            Else - Actions

Thank you very much :D
 

bananaHUNT

You can change this now in User CP
Reaction score
55
Yeah but I don't know how long the wait would be..
I mean he can attack from 600 range on which the wait should be like 1 second,
or he can attack from 300 range on which the wait should be maybe 0.5 second?
 

Firezy

New Member
Reaction score
14
2 ranges for each unit? you could change them both to something between both like 450 and problem solved

dunno cant think im in class right now
 

WolfieeifloW

WEHZ Helper
Reaction score
372
There are damage detection systems out there.
Don't use waits, they are hugely inaccurate, especially for this type of thing.
 

bananaHUNT

You can change this now in User CP
Reaction score
55
No.. what I mean is he can attack from anywhere from 600-0 range, depending on where he stands. So a wait wouldn't work, unless I can somehow do a [time for projectile to get from Batrider to target] wait.
thanks wolfie, could you link me to a good GUI damage detection ?
 

bananaHUNT

You can change this now in User CP
Reaction score
55
Hmm can someone take a look at my map, I still can't quite figure it out.
It usually works now, but somehow it fails to roll further sometimes..
 

Attachments

  • Burning Rock.w3x
    21.2 KB · Views: 80

RaiJin

New Member
Reaction score
40
here i made i redid it for you.. the problem was the periodic shit wasn't mui
 

Attachments

  • Burning Rock.w3x
    21.7 KB · Views: 95

bOb666777

Stand against the ugly world domination face!
Reaction score
117
You can use a wait (Distance between Position of damaged unit and Position of casting unit) / 500.
 

bananaHUNT

You can change this now in User CP
Reaction score
55
Thank you sooo much :D It works perfectly now !!
bob666777 nice idea but when he gets an attack speed bonus that wont work ^^
 

bananaHUNT

You can change this now in User CP
Reaction score
55
Hmm ok, though i said it worked perfectly before..
it doesnt.

Sometimes the rock wont roll along further, and sometimes you can see a wierd model on a random unit. And also when you throw another one in a different direction, the first one starts to roll in that direction as well.. :(
I have no clue what to do really..

Here's an image of what i want, maybe its better help
62160950.png

I have a morphing abiliy (based on Bear Form), that changes the projectile.
What I want is that when a target gets hit with the big flaming rock projectile, that it rolls along further for a short distance, damaging units on its path.
(and if its possible, with every thrown rock to slow his movement speed and attack speed, but that is for later. i cant even get this to work xD)
 

Sooda

Diversity enchants
Reaction score
318
Is your Rock missile homing? It depends on multiple things where rock should move on. Easiest is to roll rock always where target stands with back. To make it easy I suggest to use Slide System and when target gets hit then create your Rock unit and use Slide System to roll it some time where you want.

Maybe this helps: http://www.wc3c.net/resources.php?f=648&page=3&order=desc
Knock back system (use it on your rock to move it in right direction): http://www.wc3c.net/showthread.php?t=99720&highlight=slide+system
 

bananaHUNT

You can change this now in User CP
Reaction score
55
Aight I dunno, but anyways I got it to work.
Changed it to an autocastable one, for anyone that likes to see it or wants to use it in their map:

burningrockcopy.png


It will work like this. Whenever you cast it on a unit (or put the ability on autocast), in stead of the normal projectile, a burning piece of rock is thrown. When it hits the target, it rolls further for 500 distance, damaging enemies on its path. In stead of mana or heath, this unit slowly wears your movement speed and attack rate out. This exhaustion effect stacks. Every time you cast it, you lose 10% attack speed and 5% movement speed. Depending on the level of the ability, this effect lasts 8/6/4/2 seconds. I used the Batrider model in the testmap, because the ability looks very good on him and fits his fiery theme.

I would upload it to Spells but I have no idea if there are leaks and such or how to check for them.
 

Attachments

  • Burning Rock(3).w3x
    73.3 KB · Views: 92
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top