• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Is this good??

Status
Not open for further replies.
Level 5
Joined
Mar 13, 2008
Messages
126
Is this good or is Custom_Value unnecessary?When i say good i mean bugless and leakless...
  • Untitled Trigger 001
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set Unit = (Attacked unit)
      • Set Custom_Value = 1
      • Trigger - Turn on Untitled Trigger 002 <gen>
      • Trigger - Add to Untitled Trigger 002 <gen> the event (Unit - Unit Takes damage)
  • Untitled Trigger 002
    • Events
    • Conditions
      • Custom_Value Equal to 1
    • Actions
      • -------- SOME ACTIONS --------
      • Set Custom_Value = 0
      • Trigger - Turn off (This trigger)
 
Level 12
Joined
Aug 18, 2006
Messages
1,193
you should also make a group to store all units being added to the trigger to prevent the first trigger from adding the same unit twice to the second trigger, or else the second trigger will fire twice/trice/quadrice instead of once when damaged

and by doing that, im gonna have to say that whole "turn off / turn on"-thingy can be quite bugged, even thought it would be quite hard for it to bug(two units would have to be hit, the second one before the target is damaged and after the trigger is turned off)
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
you should also make a group to store all units being added to the trigger to prevent the first trigger from adding the same unit twice to the second trigger, or else the second trigger will fire twice/trice/quadrice instead of once when damaged

and by doing that, im gonna have to say that whole "turn off / turn on"-thingy can be quite bugged, even thought it would be quite hard for it to bug(two units would have to be hit, the second one before the target is damaged and after the trigger is turned off)

You can just add the event to any unit that enters the map. This is the best way this can be done with GUI (1 possible leak for each unit).
 
Level 12
Joined
Aug 18, 2006
Messages
1,193
something like this
  • Untitled Trigger 001
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Unit - Set custom value of (Attacked unit) = 1
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Attacked unit) is in AttackedGroup) Equal to True
        • Then - Actions
        • Else - Actions
          • Unit Group - Add (Attacked unit) to AttackedGroup
          • Trigger - Add to Untitled Trigger 002 <gen> the event (Unit - Unit Takes damage)
  • Untitled Trigger 002
    • Events
    • Conditions
      • (Custom value of (Triggering unit)) Equal to 1
    • Actions
      • -------- SOME ACTIONS --------
      • Unit - Set custom value of (Triggering unit) to 0
and GhostWolf, using Unit - A unit is attacked event is actually better in some ways, since not all units might be attacked(dummy units for example) so it will take up less space

and if he wishes, he might add some conditions to limit those that the actions should apply to :p

but i must say, this is not as efficient as it could be, if you set the custom value of the damage source(attacking unit) it will not bug as much :D
 
Level 5
Joined
Mar 13, 2008
Messages
126
Trigger - Add to Untitled Trigger 002 <gen> the event (Unit - Unit Takes damage)
this won't work...you didn't set Unit variable!

EDIT:
what would be the best way to detect attack damage?It can be in JASS too,i can just make GUI actions and conditions then convert them and copy/paste them...just mark me where i should paste conditions and where actions...


TNX A LOT!
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Well I believe Razorbrain just forgot to show it exact.

  • Trigger - Add to Untitled Trigger 002 <gen> the event (Unit - <Attacked unit> Takes damage)
But the fact is that trigger will leak a unit group through the whole game.
 
Level 5
Joined
Mar 13, 2008
Messages
126
omfg dest emperor u made shit!!!it's worth nothing...it detects attacks not damage...u just made unit is attacked more complicated!

EDIT:
you even wrote:
ALL actions are executed BEFORE the damage is dealt to your unit.

so wtf did u make!?
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
omfg dest emperor u made shit!!!it's worth nothing...it detects attacks not damage...u just made unit is attacked more complicated!

EDIT:
you even wrote:
ALL actions are executed BEFORE the damage is dealt to your unit.

so wtf did u make!?

Dude, please.
With the event Unit a unit is damaged the trigger executes before damage is dealt.
About emperor_d3st's map, it works i guess(i would have done it in jass in a bit different way), but there is no explanation how to use it.
 
Level 17
Joined
Apr 13, 2008
Messages
1,597
The Map's purpose is to detect when a unit gets damaged and execute some actions before the damage is dealt - which the map fulfies perfectly, however tuurak doesn't seem to realize it and is very rude (I have no idea what's his problem).
He said he does not know JASS. I said: Okay, I can make it so you'll need 0 JASS knowledge.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Unit takes damage event fires right before actual damage.
Than immediately after that damage is dealt.
To have something happen after damage is dealt in a trigger with a unit takes damage event, start a timer with 0 timeout.
The callback will execute after the damage is dealt(someone said that and I am willing to take his word for it).
 
Level 17
Joined
Apr 13, 2008
Messages
1,597
I'm sure spiwn is aware of that and I have to say for the one 37th time that the map you made me to do for you does exactly that. It generalizes unit takes damage event.
If you want the triggers to fire after the unit takes the damage you should just wait 0.01 sec in the trigger since you don't know about JASS and timers.

/me Out.
 
Level 5
Joined
Mar 13, 2008
Messages
126
you made some periodic timer trigger and creating footmans...make me a trigger that will fire when footman attacks peasant to demonstrate me you are right...
tnx in advance!

EDIT:
just send it via msn...i'm on it!
 
Level 12
Joined
Aug 18, 2006
Messages
1,193
no, he didnt, he just showed you how to do the events and how to make it fire for all units, the periodic event was just an example, and the create footman was just an example of an action that could be made(atleast that is what i remembered from testing the map)
 
Status
Not open for further replies.
Top