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

[Trigger] Basic DoT ability help, plus an extra unrelated question

Status
Not open for further replies.
Level 6
Joined
Mar 31, 2012
Messages
169
I'm relatively new when it comes to the World Editor's triggering functionalities (coming from over a decade of Brood War modding) and I'm having difficulties setting up a variant of Critical Strike that deals flat damage and leaves a buff that deals damage over time. The flat damage was easy enough (part of the GUI for the ability in the Object Editor), but it's the DoT that's giving me trouble at the moment. I spent a few hours researching and experimenting and wound up with the mess you see below.

mLnXlan.png


Obviously enough to anyone who's been around triggers for a while, this is hardly 'safe' code, mostly with regards to the 'attacked unit' being referenced when what I really need is a check to make sure the unit still has the buff before the damage is dealt to it and making sure that that unit is the one sustaining damage. Otherwise it just gets overwritten if the buff is applied to a second target, and so on and so forth.

Is there an obvious solution to my problem or is this something that's more convoluted?

I swear I've seen this before, but I'm wondering if it's possible to lock out portions of the map (via pre-placed boundaries or what have you) and then expand them in the middle of the game. If this isn't possible I can just create a few copies of the map, since I'm working on a single player campaign, and just use the larger copy when the player returns to that map and have unlocked the new zone.


Thanks a lot for your assistance.
 
Level 6
Joined
Mar 31, 2012
Messages
169
Thanks for your quick response.

After checking a few systems out I'm trying to implement this system. I'm not sure how familiar you are with it, but would I be using spell or physical damage if I were basing it off that system? It seems like spell might be accurate since it's tied to an ability, but I'm not positive and I have zero experience with Jass and variables.
 
Not familiar with the system at all, but I do know that its pretty GUI friendly. The type of damage you want to detect is all on you... do you want it to deal spell or physical damage? If you look at the description, he gives you an example of how to use his system under the "onDamage in GUI." Your trigger will just have to be based off of the event he states :)
 
Level 6
Joined
Mar 31, 2012
Messages
169
Looking at the OnDamage trigger example, he calls pre-placed units as variables. I have already created a custom buff for this purpose so I can call upon PPD_Target (variable within that API) and check whether or not they have the buff before dealing the extended damage, but it's not dealing any damage to them even though they have the buff.

m4E0qCC.png


This is how I have it set up.

I appreciate you trying to help and recognise that you aren't familiar with this particular system, so if you can't assist with this one, could you point me towards one that you are familiar with and would suit my purposes?
 
Level 6
Joined
Mar 31, 2012
Messages
169
It seems to be dealing 66 damage (taking a 220 hp Peasant from full to 154), but it should only be dealing 10-11 (base attack value of Gnoll) plus 30 on-hit from the Object Editor data plus one instance of 10 from the triggers for a total of 50-51.

You mentioned a periodic timed event earlier. Is there a tutorial I could find to set that up? Would i even need one of these? Is it possible to create a leak-free and efficient instance of this kind of ability using just GUI and no add-ons like the damage detection systems?
 
It seems to be dealing 66 damage (taking a 220 hp Peasant from full to 154), but it should only be dealing 10-11 (base attack value of Gnoll) plus 30 on-hit from the Object Editor data plus one instance of 10 from the triggers for a total of 50-51.

You mentioned a periodic timed event earlier. Is there a tutorial I could find to set that up? Would i even need one of these? Is it possible to create a leak-free and efficient instance of this kind of ability using just GUI and no add-ons like the damage detection systems?

Let me finish this league game and I'll give you an example of how to make an MUI/DoT with quick explanations. Do you mind attaching your map with the spell?
 
Level 6
Joined
Mar 31, 2012
Messages
169
Sure. This is stripped down to just include the ability (temporarily has 100% chance to activate for testing purposes) and the unit that can activate it. No triggers whatsoever since I've probably been doing them completely incorrectly.

Good luck on your game.
 

Attachments

  • Spell Test Map.w3x
    277.8 KB · Views: 38
Here you go :) sorry, the game ended up lasting 55 minutes.

Anywaay, I used Weep's DDS for this. I prefer using DDS over "unit is attacked" function because events will happen for the latter before you even deal the damage or even if the unit misses the attack >.> I also added comments for you to understand why I did things, but I suggest you read Purgeandfire's tutorial to get a better understanding of dynamic indexing. Keep note that dynamic indexing isn't the only way to make things MUI! I added a config section for you so its easier to configure things to your need. Feel free to message me for more questions! I'll be happy to help.

  • RS Init
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamagedUnit is in RS_GroupCheck) Equal to False
      • (GDD_DamagedUnit has buff RS_Buff) Equal to True
    • Actions
      • -------- MaxIndex lets us use the same variable, but with different instances of a spell --------
      • Set RS_MaxIndex = (RS_MaxIndex + 1)
      • -------- Setting the NEW caster to be correlated with its corresponding instance --------
      • Set RS_Caster[RS_MaxIndex] = GDD_DamageSource
      • -------- Setting the NEW target to be correlated with its corresponding instance --------
      • Set RS_Target[RS_MaxIndex] = GDD_DamagedUnit
      • -------- Counter will be the variable that lets us detect how long the duration of the debuff has lasted --------
      • -------- This is what allows us to use "wait" functions, but still be MUI since this counter will be set to its corresponding instance --------
      • Set RS_Counter[RS_MaxIndex] = 0.00
      • -------- Adding the target to the unit group so that debuffs dont stack xP --------
      • Unit Group - Add RS_Target[RS_MaxIndex] to RS_GroupCheck
      • -------- If there is currently a unit that has a debuff, keep loop on! --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RS_MaxIndex Equal to 1
        • Then - Actions
          • Trigger - Turn on RS Loop <gen>
        • Else - Actions
  • RS Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer RS_CurrentIndex) from 1 to RS_MaxIndex, do (Actions)
        • Loop - Actions
          • -------- Calculating damage per second since 10 damage every 0.2 seconds is OP --------
          • -------- 10 x 0.02 = 0.02 damage every 20 milliseconds. That means after 1 second (1000 milliseconds), we dealt 10 damage (: --------
          • Set RS_DamageCalculate = (RS_DoTDamage x 0.02)
          • -------- This tells the corresponding caster to deal damage to the target he bled (: --------
          • Unit - Cause RS_Caster[RS_CurrentIndex] to damage RS_Target[RS_CurrentIndex], dealing RS_DamageCalculate damage of attack type RS_AttackType and damage type RS_DamageType
          • -------- Adding 0.02 to the "duration" of the debuff! --------
          • -------- 0.02 every 20 milliseconds. That means after 5 seconds (5000 milliseconds), the debuff will be over! --------
          • Set RS_Counter[RS_CurrentIndex] = (RS_Counter[RS_CurrentIndex] + 0.02)
          • -------- checking if the duration of the corresponding debuff is over ... --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RS_Counter[RS_CurrentIndex] Greater than or equal to RS_DoTDuration
            • Then - Actions
              • -------- remove them from group so that we can put more debuffs on them! --------
              • Unit Group - Remove RS_Target[RS_CurrentIndex] from RS_GroupCheck
              • -------- de-index everything (: you should read the tutorial I linked to understand this more --------
              • Set RS_Caster[RS_CurrentIndex] = RS_Caster[RS_MaxIndex]
              • Set RS_Target[RS_CurrentIndex] = RS_Target[RS_MaxIndex]
              • Set RS_Counter[RS_CurrentIndex] = RS_Counter[RS_MaxIndex]
              • Set RS_MaxIndex = (RS_MaxIndex - 1)
              • Set RS_CurrentIndex = (RS_CurrentIndex - 1)
              • -------- if there is no unit being bled, turn off this loop so its not always running! --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RS_MaxIndex Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
On a side note, I suggest you fix the texture paths of your icons so you don't get the ugly green box x)

EDIT: Sorry, I totally forgot to add a comment about the DoTDuration variable... make sure that number matches whatever the duration is in Object Editor!
 

Attachments

  • Spell Test Map.w3x
    288.3 KB · Views: 69
Last edited:
Level 6
Joined
Mar 31, 2012
Messages
169
Why is it better to check every 0.03 seconds and not every 0.02?

Thanks very much for hooking all that up for me kill, I'll move it over to my main project file later tonight and make sure it works as intended. I appreciate your assistance!
 
Level 6
Joined
Mar 31, 2012
Messages
169
I know how significant that can be from using death timers in BW maps, so thanks for letting me know. I'll make the changes.

Everything's functional after some testing and tweaking. Thanks for your help, everyone, especially killcide!

I swear I've seen this before, but I'm wondering if it's possible to lock out portions of the map (via pre-placed boundaries or what have you) and then expand them in the middle of the game. If this isn't possible I can just create a few copies of the map, since I'm working on a single player campaign, and just use the larger copy when the player returns to that map and have unlocked the new zone.

Does anyone have an answer to this?
 
Everything's functional after some testing and tweaking. Thanks for your help, everyone, especially killcide!

No problem. Just make sure you adjust all the 0.02 stuffz.

I swear I've seen this before, but I'm wondering if it's possible to lock out portions of the map (via pre-placed boundaries or what have you) and then expand them in the middle of the game. If this isn't possible I can just create a few copies of the map, since I'm working on a single player campaign, and just use the larger copy when the player returns to that map and have unlocked the new zone.

What do you mean lock out portions of the map? Are you talking about camera boundaries?
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
Maybe camera bounds as well but mostly unit bounds.

Camera bounds can not be made very specific so I would not recommend you to do that as well.

However for units, you can create pathing blockers and remove them when you grow of a certain level.
Or you trigger it when a unit is entering a region, he will be placed back to when he was outside that region and displaying on screen that he should not go there yet.
 
Level 6
Joined
Mar 31, 2012
Messages
169
If anyone's played SC2's campaign, there's a scene in Supernova where a few banshees take down a Protoss base and then the map gets bigger. That's basically what I'm talking about: seamless transitioning between a smaller map and a larger map, essentially the map you're playing on is actually larger than what you can see and what you can play with, but you can't access it until the triggers expand the battlefield.

If someone's played C&C 3, there's a similar feature in some of their missions.
 
Status
Not open for further replies.
Top