• 🏆 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!

2 questions (Attack Speed problem and UMSWE)

Status
Not open for further replies.
Level 12
Joined
Apr 16, 2010
Messages
584
Hi! So lets start with the first one:
Solved - I've created a simple system for my map that calculates the attack speed of the hero and shows it when you type "-as", the problem is that when i have items that increase my AS, they wont be shown in formula, except the last one!
  • C Attack Speed Settings
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Trigger - Add to C Attack Speed <gen> the event (Player - (Player((Integer A))) types a chat message containing -as as An exact match)
      • Set AS_BaseCooldown = 1.90
      • -------- Setting items attack speed bonus --------
      • Set AS_NumberofTypes = 3
      • -------- Gloves of Haste --------
      • Set AS_ItemType[1] = Gloves of Haste
      • Set AS_BonusAttackSpeed[1] = 25.00
      • -------- Flame Blade --------
      • Set AS_ItemType[2] = Flame Blade
      • Set AS_BonusAttackSpeed[2] = 30.00
      • -------- Elemental Blades --------
      • Set AS_ItemType[3] = Elemental Blades //if i have this item formula will calculate its AS, but not others...
      • Set AS_BonusAttackSpeed[3] = 30.00
  • C Attack Speed
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to AS_NumberofTypes, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Game_Hero[(Player number of (Triggering player))] has an item of type AS_ItemType[(Integer A)]) Equal to True
            • Then - Actions
              • Custom script: set udg_AS_FinalSpeed[GetConvertedPlayerId(GetTriggerPlayer())] = udg_AS_BaseCooldown*(100/(100+udg_AS_BonusAttackSpeed[GetForLoopIndexA()]+(I2R(GetHeroStatBJ(bj_HEROSTAT_AGI, udg_Game_Hero[GetConvertedPlayerId(GetTriggerPlayer())], true))*(0.02*100))))
            • Else - Actions
              • Custom script: set udg_AS_FinalSpeed[GetConvertedPlayerId(GetTriggerPlayer())] = udg_AS_BaseCooldown*(100/(100+0+(I2R(GetHeroStatBJ(bj_HEROSTAT_AGI, udg_Game_Hero[GetConvertedPlayerId(GetTriggerPlayer())], true))*(0.02*100))))
      • Game - Display to (Player group((Triggering player))) the text: (|c00ff0303Your hero's attack speed has a + ((String(AS_FinalSpeed[(Player number of (Triggering player))])) + cooldown.))
And second one:
Unsolved - Lately i had problem with my map, couldn't open it in JNGP - EGUI helped me... So now i can open it in EGUI, but when i try to enable UMSWE it shows me an error:
attachment.php


+rep for help!
 

Attachments

  • 1.png
    1.png
    27 KB · Views: 150
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
For the first problem, set Final speed = 0 before the loop. In the loop, set Final speed = Final speed + modifier.

I wouldn't do it with a looping trigger at all. You could store the speed bonus into a hastable, use the item type id as the parent key and some string like "speedBonus" as the, well speed bonus.

Keep track of the total speed bonus of the unit and save it into a hashtable.

When you acquire/lose an item, load the hero bonus and item bonus and modify.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
The problem is that you need to calculate the bonus in the loop and keep adding to it.

Only after loop should you calculate the final attack speed based on the modifier calculated in the loop.

Also, is the bonus correct for the last item? To me it looks like your dividing an integer with an integer which isn't a good thing?

You could post the system in a map file.
 
Level 12
Joined
Apr 16, 2010
Messages
584
Here's a formula:
2.3 Calculative Effective Attack Speed

The formula used to calculate the Effective Attack Speed is :

a = b*(100/(100+c))

a = Effective Attack Speed
b = Base Attack Cooldown
c = Bonuses

Bonuses are all values mixed in a number, which is equal to the sum of attack speed bonuses.

To calculate the Effective Attack Speed of a hero, you should use this formula :

a = b*(100/(100+c+(d*(e*100))))

a = Effective Attack Speed
b = Base Attack Cooldown
c = Bonuses
d = Agility
e = Attack Speed Bonus per Agility Point

Bonuses get less valuable as you get more it. Because that, you may want to boost an another effective value.
From: http://world-editor-tutorials.thehelper.net/cat_usersubmit.php?view=44516
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Alright, that cleared things up. It's fixed now.

I also got rid of the bj's and used a variable for the player number.

  • C Attack Speed
    • Events
    • Conditions
    • Actions
      • Set i = (Player number of (Triggering player))
      • Set AS_FinalSpeed[i] = 0.00
      • For each (Integer A) from 1 to AS_NumberofTypes, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Game_Hero[i] has an item of type AS_ItemType[(Integer A)]) Equal to True
            • Then - Actions
              • Set AS_FinalSpeed[i] = (AS_FinalSpeed[i] + AS_BonusAttackSpeed[(Integer A)])
            • Else - Actions
      • Custom script: set udg_AS_FinalSpeed[udg_i] = udg_AS_BaseCooldown*(100/(100+udg_AS_FinalSpeed[udg_i]+(I2R(GetHeroAgi(udg_Game_Hero[udg_i], true))*(0.02*100))))
      • Game - Display to (Player group((Triggering player))) the text: (|c00ff0303Your hero's attack speed has a + ((String(AS_FinalSpeed[i])) + cooldown.))
 

Attachments

  • Attack Speed.w3x
    17.6 KB · Views: 81
Status
Not open for further replies.
Top