Help with Weep's damage detection system

hazylwp

Member
Reaction score
0
I am trying to trigger an ability using weep's DD system which detects damage taken from a unit until it reaches a certain amount eg. 100 damage then it is saved and counted as one stack until it reaches X amount of stacks. It's something like Dota's Death Knight's "Aphotic Shield", for those of you who don't know it is a targeted ability which gives the unit a buff and that unit will not take any damage until the damage threshold is reached then the buff is removed. How would i have to trigger this using weep's DD system?
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
Is it supposed to be MUI or MPI?
Because MPI would be rather easy.
You have an "integer" array for the stacks and a "real" array for the damage.
When damage is taken you add the damage to the real array at the owning players player id.
Then you check if the cumulative value is greater then or equal to 100.
If so you set the value in the array to be the current alue modulo 100 and add to the integer array at the owning players player id the current value divided by 100.
 

hazylwp

Member
Reaction score
0
i want it to be MUI i tried triggering for MUI before but it doesnt count individual damage dealt for individual units and stacks for different units with the same ability thus making it not MUI. Is there any way to this using unit arrays or custom values?
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
You need to save 2 individual pieces of data for every unit; number of stacks AND the current damage taken mod 100.
You can not really use custom value for that since it only allows to save one value. (unless you try some kind of crazy code)

Best solution would involve using a hashtable to save these data for each unit if you really need it to be MUI.
 

hazylwp

Member
Reaction score
0
@accname problem is i dont understand hastables and how use them it's confusing xD like you said making it MPI is easier to trigger
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
Well, complicated abilities need complicated tools. You either have to make the ability more simple to be able to implement it without hashtables or you have to learn how to use them.
They are actually very simple.

A hashtable is (more or less) like an array. But instead of having an integer number to access each element you can use any kind of object. And they can save different types of data and not just one.

It works by connecting a key value to a data value.
Code looks like this:
Trigger:
  • Hashtable - Save SomeReal as (Key "DamageTaken") of (Key (Triggering unit)) in SomeHashTable

This way you could save the value of the variable "SomeReal" in the hashtable. And the key for this data would be the combination of the String "DamageTaken" and the triggering unit.

So this variable was saved for the triggering unit under the label "DamageTaken" and with this combination you can always access it.
Trigger:
  • Set SomeReal = (Load (Key "DamageTaken") of (Key (Triggering unit)) from SomeHashTable)
 

hazylwp

Member
Reaction score
0
Yeah true enough i think i have some idea about hastables, let me give you an example. Say I wanna have stacks for each damage threshold reach for each unit so

Events
GDD_Event becomes equal to 0.00
Conditions
Level of (Assumption) for (GDD_DamagedUnit) greater than 0
Owner of GDD_DamagedUnit belongs to an enemy of owner of GDD_DamageSource
Actions
Set ASdamagetaken = ASdamagetaken + Damage Taken
Hastable - save ASdamagetaken as (Key("Damage taken") of (Key(GDD_DamagedUnit)) in hastable
If - conditions
ASdamagetaken greater than or equal to (100.00 x Level of Assumption for GDD_DamagedUnit)
Then - actions
Set ASstacks = ASstacks + 1
Hastable - Save ASstacks as (Key(???)) of (Key(GDD_DamagedUnit)) in Hastable
Set ASdamagetaken = 0

Will this be MUI and work?
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
What is the variable ASdamagetaken used for? As far as I see right now you use it globally for all units.

In pseudo-code your trigger should look somewhat like this:

Code:
Event:
 A unit takes damage
Conditions
 ... something...
Actions
 Damage-Taken-So-Far = hashtable - load "damageTaken" for (DamagedUnit)
 Damage-Stacks = hashtable - load "DamageStacks" for (DamagedUnit)
 Damage-Taken-So-Far += New-Damage-Taken
 Damage-Stacks += Damage-Taken-So-Far / 100
 Damage-Taken-So-Far = Damage-Taken-So-Far mod 100
 Hashtable - Save Damage-Taken-So-Far as "damageTaken" for (DamagedUnit)
 Hashtable - Save Damage-Stacks as "damageStacks" for (DamagedUnit)
 

hazylwp

Member
Reaction score
0
Erm to calculate the damage when the unit is attacked and if it reaches 100 i will increase the stacks by 1?correct me if my method is wrong. Just wondering is your "damage taken" an event response or a variable?
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
Just look at this example map. It uses the pseudo code from above.
But it does not use Weeps Damage Detection system. You have to connect these two by your own, but it shouldnt be that hard.
 

Attachments

  • DamageStacks MUI (with Hashtables).w3x
    20.2 KB · Views: 220

hazylwp

Member
Reaction score
0
Assumption Detect1
Events
Game - GDD_Event becomes Equal to 0.00
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Assumption for GDD_DamagedUnit) Greater than 0
Then - Actions
Cinematic - Clear the screen of text messages for (All players)
Set ASS_DamageTaken = (Load (Key damage taken) of (Key (Triggering unit)) from Hashtable)
Set ASS_Stacks = (Load (Key damage stacks) of (Key (Triggering unit)) from Hashtable)
Set ASS_DamageTaken = (ASS_DamageTaken + (Damage taken))
Set ASS_Stacks = (ASS_Stacks + (Integer((ASS_DamageTaken / 120.00))))
Set ASS_DamageTaken = (ASS_DamageTaken mod 120.00)
Hashtable - Save ASS_DamageTaken as (Key damage taken) of (Key (Triggering unit)) in Hashtable
Hashtable - Save ASS_Stacks as (Key damage stacks) of (Key (Triggering unit)) in Hashtable
Game - Display to (All players) the text: (Stacks: + (String(ASS_Stacks)))
Game - Display to (All players) the text: (Damage Taken: + (String((Damage taken))))
Game - Display to (All players) the text: (Damage Total: + (String(ASS_DamageTaken)))
Else - Actions

Assumption Learn
Events
Unit - A unit Learns a skill
Conditions
(Learned Hero Skill) Equal to Assumption
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Assumption for (Learning Hero)) Equal to 1
Then - Actions
Unit - Add Assumption Spell Book to (Learning Hero)
Player - Disable Assumption Spell Book for (Owner of (Learning Hero))
Hashtable - Save 0.00 as (Key damage taken) of (Key (Learning Hero)) in Hashtable
Else - Actions
Unit - Set level of Assumption (Magic Resistance) for (Learning Hero) to (Level of Assumption for (Learning Hero))
My trigger doesnt seem to calculate the damage taken, correct me if my trigger is wrong
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
  • The Helper The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top