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

GUI Damage Detection Problem

Status
Not open for further replies.
Level 10
Joined
Nov 24, 2010
Messages
546
Hello Guys, So I have tried to make a block chance based on hero's items.
Block = Reduce incoming damage by 50% (does not count spells, only normal attacks.)
I have several problems here.
I am not sure if it blocks damage and I don't know a way how to decet it.
Whenever hero block damage I want floating text around him saying "Block"


Note: I'm using http://www.hiveworkshop.com/forums/...1016/?prev=search=damage%20engine&d=list&r=20


Setup Items
  • BlockDatabase
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set IBlock_Table = (Last created hashtable)
      • Set IBlock_IType = Block + 85%
      • Custom script: set udg_IBlock_I1 = udg_IBlock_IType
      • Hashtable - Save 85 as 0 of IBlock_I1 in IBlock_Table
      • Set IBlock_IType = Block + 5%
      • Custom script: set udg_IBlock_I1 = udg_IBlock_IType
      • Hashtable - Save 5 as 0 of IBlock_I1 in IBlock_Table
Setting Damage

  • Block
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • DamageEventOverride Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamageEventTarget is A Hero) Equal to True
        • Then - Actions
          • Set IBlock_I2 = 0
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Set IBlock_IType = (Item-type of (Item carried by DamageEventTarget in slot (Integer A)))
              • Custom script: set udg_IBlock_I1 = udg_IBlock_IType
              • Set IBlock_I2 = (IBlock_I2 + (Load 0 of IBlock_I1 from IBlock_Table))
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Less than or equal to IBlock_I2
            • Then - Actions
              • Set DamageEventOverride = True
              • Set DamageEventAmount = (DamageEventAmount x 0.50)
              • Floating Text - Create floating text that reads Block! above DamageEventTarget with Z offset 50.00, using font size 10.00, color (100.00%, 5.00%, 10.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 75.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 3.50 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 1.40 seconds
            • Else - Actions
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You should take the second if/then/else out of the else.
You should do the bloc valu counting with Unit acquires/loses and item triggers, and only load the value in this trigger.
The system will block spells also since you can't tell whether damage came from a spell or normal attack unless you trigger all spells.
 
Level 10
Joined
Nov 24, 2010
Messages
546
would this work?

  • ABC
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Storm Bolt
    • Actions
      • Set DamageEventType = DamageTypeSpell
      • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing 500.00 damage of attack type Spells and damage type Normal
  • Block
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • DamageEventOverride Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamageEventSource is A Hero) Equal to True
          • DamageEventType Not equal to DamageTypeSpell
        • Then - Actions
          • Set IBlock_I2 = 0
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Set IBlock_IType = (Item-type of (Item carried by DamageEventSource in slot (Integer A)))
              • Custom script: set udg_IBlock_I1 = udg_IBlock_IType
              • Set IBlock_I2 = (IBlock_I2 + (Load 0 of IBlock_I1 from IBlock_Table))
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Less than or equal to IBlock_I2
            • Then - Actions
              • Set DamageEventOverride = True
              • Set DamageEventAmount = (DamageEventAmount x 0.50)
              • Game - Display to (All players) the text: (String(DamageEventAmount))
              • Floating Text - Create floating text that reads Block! above DamageEventSource with Z offset 50.00, using font size 10.00, color (100.00%, 5.00%, 10.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 75.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 3.50 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 1.40 seconds
            • Else - Actions
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
lag...

anyway, you dont need to trigger all spell damage in your map.

JASS:
library UK012
function DamageEngine_HookSpell takes unit source, widget target, real amount, boolean b1, boolean b2, attacktype at, damagetype dt, weapontype wt returns nothing
    set udg_DamageEventType = udg_DamageTypeSpell
endfunction

function DamageEngine_HookSpellBJ takes unit c, unit t, real amt, attacktype attype, damagetype dmgtype returns nothing
    set udg_DamageEventType = udg_DamageTypeSpell
endfunction

hook UnitDamageTarget DamageEngine_HookSpell
hook UnitDamageTargetBJ DamageEngine_HookSpellBJ
endlibrary

will automatically detect wether the damage dealt was spell or not
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Yeah, if you are using Jass NewGen Pack, that is easier. But you still have to trigger all spell damage, because the system will think Object Editor damage is physical.

I dont think you should ever NOT use JNGP.

And no you dont have to trigger all spell damage. If you've ever played Vampirism Beast, i copied their rending claws ability but i wanted it to only happen on attack so i put that script in my map and it was always correct on wether it was smart attack damage or spell damage

I don't use any object editor damage, all is set to 0. I'm using damage based on hero attributes/items and for creeps it is random number between x and y + something if conditions are true and so on.

So use my script and set the damage type to magic..
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Im telling you, i use it in my map to distinguish between smart attack damage and spell damage and it works flawlessly for all the spells ive made so far
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Use my script and when u trigger the damage, set it to Magic damage.

if your triggering EVERY DAMN SPELL in the game, than you can just set damagetypespell before
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
ok atm i also dont use jngp yet, i think i will use only at end only for terrain, coz i already made few vjass system in normal jass and dont got nothing what i cant write in normal jass and exist in vjass :)

i triggered every magical spell on my map :p so need only damage type thing at magic map coz i set dmgeventype to 0 at end in set dmg trigger, so it is allways 0 at when i dont set other value before the dmg and 0 in my case allways physical :D

(1=reflect and dot, 2 magic :D)
 
Status
Not open for further replies.
Top