• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

How can I make this work? [Gui]

Status
Not open for further replies.
Level 2
Joined
Oct 15, 2010
Messages
7
I am trying to make an cumulative attack speed increase skill for an hero in my map. I made an attack speed skill made out of Gloves of Haste (Item attack speed) and gave it 30 levels. And the skill the hero uses has 4 levels. So what I tried to do for like many hours is:

I want that when the hero has his skill on level 1, he will gain attack speed on each attack, using a cap of 10 attacks, in other words using Item attack speed bonus lvl 10 at max, and when the attacking hero reaches the cap of 10 attacks, the ability should be removed within 10 seconds.

I've tried to do this myself, believe me. Caused major spike and a massive leak occured and the attack speed ability didn't start recounting after it was removed.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I'm not sure about this, never done something like this... but I guess this should work.

1- Detect the damage dealt with some DDS (Damage Detection System). Most times It's better than using "A unit is attacked" event. I use Weep's GDD.
2- Why the item has 30 levels if the cap is 10? And what's the difference between the four levels of the Hero skill?

I guess that Hero skill with higher level would last more time after the cap is reached, and will reach a higher cap. I'll call your skill "Frenzy".

Trigger 1
E - Damage is dealt
C - Level of Frenzy for DamageSource is Greater than 0.

-> Custom script: set udg_i = GetHandleId(udg_GDD_DamageSource) (This will allow you to handle your unit in the hashtable)
-> Set Hits = ((Load 0 of i from FrenzyHash) + 1) "0" is where we're going to store the hits dealt, "i" is the handle of the unit, meaning that we're storing the hits dealt in this unit data, FrenzyHash is the Hashtable name. (Hits +1) will allow you to increase the amount of hits. The first time Hits will be 0, and will turn to 1... The second time you hit, "Hit" will be 1, and will turn to 2, and so on
-> If/Then/Else. If Hits is Greater than (Level of Frenzy for GDD_DamageSource x 2,5) Then set Hits = Level of Frenzy for GDD_DamageSource x 2,5. Else -> Leave it empty This will set the max amount of "Hits" in the count to Level of Ability x 2,5. The caps will be 2, 5, 7, and 10 respectively.
-> Hashtable - Save Hits as 0 of i in FrenzyHash
-> Set Remaining Time = Level of Frenzy for GDD_DamageSource x 2,5. This means that the effect will last 2,5 seconds for each level. In level 4 the skill will last 10 seconds, since 2,5 x 4 = 10.
-> Hashtable - Save Remaining Time as 1 of i in FrenzyHash Now we're storing the time the effect will last on that unit
-> Set Level of FrenzySpeed to Hits This means that, if the unit has dealt two hits, Hits will be "2", and will turn your bonus speed ability to 2. You'll set the bonus speed per level in the object editor
-> Add GDD_DamageSource to FrenzyGroup

^This goes all inside one trigger^

Trigger2 - FrenzyLoop

E - Every 0.5 secs of gametime
C - None

-> Pick every unit in FrenzyGroup and do Multiple Actions (Loop):
-> Set udg_i = GetHandleId(GetEnumUnit())
-> Set Remaining Time = ((Load 1 of i from FrenzyHash) - 0.5)
-> Hashtable - Save Remaining Time as 1 of i in FrenzyHash
-> If/Then/Else. If Remaining Time is Less than or equal to 0 then -->
--> Set level of FrenzySpeed for (Picked Unit) to 0
--> Clear all child of i from Hashtable.
--> Remove (Picked Unit) from FrenzyGroup



That should do... or so :p
 
Last edited:
Level 2
Joined
Oct 15, 2010
Messages
7
The level differences

Level 1: cap 10, ends in 10 seconds after cap is reached
Level 2: cap 15, ends in 12 seconds after cap is reached
Level 3: cap 20, ends in 14 seconds after cap is reached
Level 4: cap 30, ends in 16 seconds after cap is reached
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Uh... Ok... I'll edit the example in the first post for that.

EDIT: I like to do things here without doing them in the WE... but i'll do this in the WE xD

EDIT: What's the speed increase rate?

EDIT: is there any kind of time limit? Or they have to be continuous? I mean... I can hit 29 times... wait one hour, and hit the 30'th time and i'll have the bonus? Is there a Time Gap between the hit and the next one? I'll make it so, if the unit doesn't hit anything in 3 seconds, he looses 1 Hit count.

Damn... I was doint it and the Editor Crashed... lost everything -.-
 
Last edited:
Level 2
Joined
Oct 15, 2010
Messages
7
Speed Increase

Starts off with 4% then adds 3% on each attack, yeah it can lose one hit every 3 seconds if it does not attack :)

Sorry for slow reply, and thanks for help!
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Start and continue with 4% =) I'll edit this post to add the map and stuff.
The cap will be 10, 15, 20, 25.

For a cosmetic thing, I'm using a Dummy Unit to cast Bloodlust on the unit. Also, I'll increase the bonus speed when the cap is reached... After the cap is reached is a long way to hit 30 times to reach the cap again. I'll give a 20 bonus speed

Example: When the cap is 10, the bonus speed when the cap is reached is 40%. The bonus lasts 10 seconds, but then you go down to 0 again... and you have to reach the cap. I'm doing it so When the cap is 10, the bonus is 60%, not 40%.

Done ->

You have to copy the thee custom abilities (The Hero ability, the Bonus speed ability, and the Dummy ability). You can copy the dummy too, but is not finished. You can change the Buff if you want, as long as you modify the triggers accordingly. It still has the Messages I used to know if the speed was changing correctly.


  • Frenzy Init
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set FrenzyHash = (Last created hashtable)
  • Frenzy
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamageSource has buff Bloodlust) Equal to False
      • (Level of PassiveFrenzy for GDD_DamageSource) Greater than 0
    • Actions
      • Custom script: set udg_i = GetHandleId(udg_GDD_DamageSource)
      • -------- Hit Cap --------
      • Set HitCap = (5 + (5 x (Level of PassiveFrenzy for GDD_DamageSource)))
      • -------- Hit Count --------
      • Set Hits = ((Load 0 of i from FrenzyHash) + 1)
      • Custom script: if udg_Hits < udg_HitCap then
      • Hashtable - Save Hits as 0 of i in FrenzyHash
      • -------- Hit Expire --------
      • Hashtable - Save 3.00 as 1 of i in FrenzyHash
      • -------- Bonus Speed --------
      • Unit - Set level of FrenzySpeed (Gloves of Haste) for GDD_DamageSource to Hits
      • Game - Display to (All players) the text: (Speed: + (String((Level of FrenzySpeed (Gloves of Haste) for GDD_DamageSource))))
      • -------- Add Unit to FrenzyGroup --------
      • Custom script: if IsUnitInGroup(udg_GDD_DamageSource, udg_FrenzyGroup) == false then
      • Unit Group - Add GDD_DamageSource to FrenzyGroup
      • Custom script: endif
      • Custom script: else
      • -------- The Cap is reached --------
      • Set Point = (Position of GDD_DamageSource)
      • Unit - Create 1 DUMMY for (Owner of GDD_DamageSource) at Point facing Default building facing degrees
      • Unit - Set level of Bloodlust Frenzy Dummy for (Last created unit) to (Level of PassiveFrenzy for GDD_DamageSource)
      • Unit - Order (Last created unit) to Orc Shaman - Bloodlust GDD_DamageSource
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Hashtable - Save 0 as 0 of i in FrenzyHash
      • Hashtable - Save 0 as 1 of i in FrenzyHash
      • Unit - Set level of FrenzySpeed (Gloves of Haste) for GDD_DamageSource to 1
      • Unit Group - Remove GDD_DamageSource from FrenzyGroup
      • Custom script: call RemoveLocation(udg_Point)
      • Custom script: endif
  • FrenzyLoop
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in FrenzyGroup and do (Actions)
        • Loop - Actions
          • Set u = (Picked unit)
          • Custom script: set udg_i = GetHandleId(udg_u)
          • Set HitsExpire = ((Load 1 of i from FrenzyHash) - 0.50)
          • Hashtable - Save HitsExpire as 1 of i in FrenzyHash
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HitsExpire Less than or equal to 0.00
            • Then - Actions
              • Set Hits = ((Load 0 of i from FrenzyHash) - 1)
              • Hashtable - Save Hits as 0 of i in FrenzyHash
              • Unit - Set level of FrenzySpeed (Gloves of Haste) for u to Hits
              • Game - Display to (All players) the text: (Speed lvl: + (String((Level of FrenzySpeed (Gloves of Haste) for u))))
              • Hashtable - Save 3.00 as 1 of i in FrenzyHash
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Hits Equal to 0
                • Then - Actions
                  • Unit Group - Remove u from FrenzyGroup
                • Else - Actions
            • Else - Actions
When the unit dies, you have to clean the data in the hashtable...

  • FrenzyHash clean
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in FrenzyGroup) Equal to True
    • Actions
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in FrenzyHash

Let me know if you want to know something about it, or change something.
 

Attachments

  • Frenzy.w3x
    26.7 KB · Views: 69
Last edited:
Status
Not open for further replies.
Top