Unit Takes Damage Event

chukky-jr

Member
Reaction score
15
how do you check the source damage is in GUI? (which unit deals the damage to the victim) i use Conditiion - Attacked Unit is blabla and it doesn't work

can you clear an Event from trigger? i'm periodically adding events to the damage trigger everytime a unit is attacked, but that would cause a lot of event in one trigger.
 

chukky-jr

Member
Reaction score
15
err can you give a quick answer first would it be codeable or not? (of course i'll read that link too)

E: well no shit.. i don't understand that..

E2 : somehow does it uses indexing system? cuz i don't really now how to index units
 

Dirac

22710180
Reaction score
147
Codeable? yes.

You need to index units, i'm quite sure Bribe submitted a GUI indexing system, and Weep a damage detection system.

You can't remove events from triggers, therefore you should only add the event once (when the unit enters the map).

I forgot everything i knew about GUI so i wouldn't know what would be the best approach since GUI is very limited
 

chukky-jr

Member
Reaction score
15
but i thought a unit enter playable map area that run once causes the next unit that enters it doesn't get added to the Event for the trigger?
 

Medeam

New Member
Reaction score
3
You can just keep doing what your doing, just make multiple copies of the same trigger and add to that trigger and so on to avoid trigger event leaks so you turn off this trigger once you make a integer and it hits 8000 then turn that trigger off and use the next one.
 

Amn

Member
Reaction score
18
RedHead damages Wall :banghead:

Trigger:
Wall Takes Damage

Unit Triggering unit = Wall
Unit Damage Source = RedHead
 

chukky-jr

Member
Reaction score
15
Use Weep's GDD system for all of your GUI damage needs. Click Me

i already know that, but i don't want directly implement something without knowing it part by part, i'm learning little by little now

You can just keep doing what your doing, just make multiple copies of the same trigger and add to that trigger and so on to avoid trigger event leaks so you turn off this trigger once you make a integer and it hits 8000 then turn that trigger off and use the next one.

maximum unit will be created in my map approximately 500 per game, so i don't think this event leaks will be huge problem (but yeah it still leaks, i'l find a way to it later) , btw i don't get what you really mean, so far i'm able to stop registering same unit into the event (so it won't run twice per unit)

RedHead damages Wall :banghead:

Trigger:
Wall Takes Damage

Unit Triggering unit = Wall
Unit Damage Source = RedHead

i'm not really sure by what you mean, if there is a GUI trigger to check damage source, i wouldn't be asking here


btw i convert the condition Attacking unit is (unit i want to check) to jass script, it turned out it uses GetAttacker (or something like that), i change GetAttacker to GetEventDamageSource, will it work find to check who is dealing damage to unit that takes damage?

btw what syntax you use to add condition in jass? and check nearest unit from unit X?
 

Dirac

22710180
Reaction score
147
Hold your horses

If you're a GUI user don't use JASS here, you don't need it, you don't know how it works. Remember that these units respond to the event, so if the event is "unit takes damage" there is no attacking unit, and if the event is "unit is attacked" there is no damage source. JASS's logic is very different to GUI's, so trying to explain how to add conditions to a trigger would have to include the whole jass deal. To check for the nearest unit you would have to run all the units within X of a location through a loop and comparing them with each other to determine which one is closer.
 

chukky-jr

Member
Reaction score
15
the event is indeed "triggering unit takes damage", i add a condition using that GetEventDamageSource to check who damages the triggering unit, would be any problem with that trigger?
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
You can only use a Specific Unit for "Unit Takes Damage". However, you can do this:

Create a trigger (T). The variables you can use are Triggering Unit (Damaged Unit), Damage Source and Damage Taken. Whenever a unit enters the Playable Map Area for the first time, add to T the event Triggering Unit Takes Damage, then add the unit to a group. This group will be used to check whether a unit's events have been added. Then do whatever actions you like.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
im pretty sure with a simple line of custom script you could add a generic unit takes damage event, you could add it in map initialization
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Do you have any idea what that line is? I sure don't. Nor do I think it even exists, or Weep's GDD probably wouldn't be around.
 

Dirac

22710180
Reaction score
147
im pretty sure with a simple line of custom script you could add a generic unit takes damage event, you could add it in map initialization
No.

There are multiple damage detection systems in vJass, all of them work adding an event to a trigger everytime an unit enters the map
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
really? i thought the reason why dds in vjass was so much easier than in gui was because of its generic damage event, there is one in sc2 :/
 

Dirac

22710180
Reaction score
147
Well it IS easier since there are already written and you can easily copy paste them into your map. They also save lots of work (like most systems do) when it comes to preventing damage done to an unit.
 

tommerbob

Minecraft. :D
Reaction score
110
Well it IS easier since there are already written and you can easily copy paste them into your map. They also save lots of work (like most systems do) when it comes to preventing damage done to an unit.

Exactly.

@ the Op: That's why I suggest using Weep's system if you are doing GUI.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top