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

how to count times hit

Status
Not open for further replies.
Level 7
Joined
May 18, 2010
Messages
264
Resource needed: variable(real) to count times hit
  • Test DELETE
    • Events
    • Conditions
      • (Triggering unit) Equal to (==) My unit
    • Actions
      • Set HitCounter = (HeitCounter + 1)
how to get eaven unit hit somebody?

Evry 5th hit i do Spell damage( but cant get how to count each 5th hit)
 
Under the HitCounter add an if/then/else action, If - Conditions: HitCounter Equal to 5, Then - Actions: Set HitCounter = 1 and damage the attacked unit.
If you are using Unit - Unit takes damage as an event (from another trigger), then make sure you turn off the trigger in the beginning and turn it on, right after you deal the bonus magic, for it creates an infinite loop.
 
Level 7
Joined
May 18, 2010
Messages
264
oke done THX

insight for those who want comed here looking for data
unit takes damage
attacking unit = my unit
actions hitcounter = 4 or less
set hitcounter +1
if = 5 then do +15 damage on WHO :)
 
  • Init
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Hashtable - Create a hashtable
    • Set Hash = (Last created hashtable)
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units in (Playable Map Area)) and do (Actions)
      • Loop - Actions
        • Unit Group - Add (Picked unit) to DamageGroup
        • Trigger - Add to Tr <gen> the event (Unit - (Picked unit) takes damage)
  • Init2
  • Events
    • Unit - A unit enters (Playable Map Area)
  • Conditions
    • ((Triggering unit) is in DamageGroup) Equal to False
  • Actions
    • Unit Group - Add (Triggering unit) to DamageGroup
    • Trigger - Add to Tr <gen> the event (Unit - (Triggering unit) takes damage)
  • Trigger
  • Events
    • Unit -A unit learns a skill
  • Conditions
    • (Hero learned skill) Equal to X
  • Actions
    • Hashtable - Save 0 as 0 of (Key(Triggering unit)) in Hash
  • Tr
  • Events
  • Conditions
  • Actions
    • Set Source = (Damage source) //This is a "Handle" variable, scroll and find "Event Response - Damage Source".
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (0 is stored as a Integer of (Key(Source)) in Hash) Equal to True //Boolean comparison - Hashtable - Hashtable Value exists
      • Then - Actions
        • Set Count = (Load 0 of (Key(Source)) from Hash)
        • If (All conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • Count Less than 5
          • Then - Actions
            • Hashtable - Save (Count + 1) as 0 of (Key(Source)) in Hash
          • Else - Actions
            • Hashtable - Save 0 as 0 of (Key(Source)) in Hash
            • Trigger - Turn off (This trigger)
            • Unit - Cause (Damage source) to damage (Triggering unit), dealing 40.00 damage of Attack type Normal and Damage type Normal
            • Trigger - Turn on (This trigger)
      • Else - Actions
 
Level 7
Joined
May 18, 2010
Messages
264
  • Set Source = (Damage source) //This is a "Handle" variable, scroll and find "Event Response - Damage Source"
my fears again a mistake
  • Set HeroKoboltPoisonHandle = HeroKoboltPoisonHandle
The only thing i can select on right = som handle...

Variable = Handle(HeroKoboltPoisonHandle)
and well i did it as u sayd .. i think
 
Level 7
Joined
May 18, 2010
Messages
264
I hope its attached\
In trigger This is where u look Folder
im not good in english so u may find names around there Fk up a bit :)

EDIT: i go take a long nap take ur time
 
Last edited:
Meh, did you use WEU to make it? It doesn't open for me.
Anyway, create a variable called Source and variable type "Handle". When you are about to determine its value, scroll down to this huge list it brings up until you find "Event Response - Damage source". You can alternatively use this:
  • Custom script: set udg_Source = GetEventDamageSource()
 
Level 7
Joined
May 18, 2010
Messages
264
using 1.26a patch on WE
and using Jassnewgen5d
And frend edited that it cleans leaks ... its a script but :) hey works
so sry i 4got about it.
THX +rep

4Real ima gona make a video to show u what im doing ... THERE IS NO SUCH a think ...
 
Status
Not open for further replies.
Top