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

Spreading Disease

Status
Not open for further replies.
Level 7
Joined
Dec 14, 2012
Messages
192
Hey there~

Edit: Did some big changes to the description/triggers, please read through it again^^.


I need a little help with a hero ability, it is called "Miasma". The ability is based of the abominations disease cloud ability.


Miasma intoxicates nearby enemies, dealing damage over time to them. What I want to add are the following effects:
If a unit afflicted with Miasma dies, nearby enemies will be poisoned with a "different form" of Miasma - meaning, it will have probably a different duration/damage than the normal Miasma.


What is to note: Miasma is a hero ability, so that spreading part of it also should deal more damage/have a longer duration, if the hero levels Miasma up.


The idea I have is: Create a "Miasma Cloud" whenever a unit with the "Miasma" Buff dies. That "Miasma Cloud" will have an aversion of the ability "Howl of Terror", which it is ordered to use. That aversion simply reduces health regeneration of all hit units - as reduced life regeneration is practically the same as a DoT, this seems quite fine to me.

I discovered a new problem~ the ability, Miasma, gives the wrong buff. It seems to be somehow hard-coded into the base ability, Disease Cloud. This is rather annoying~ As I need to use the base-buff(Disease Cloud), to trigger all these effects. In any case, I shall post the triggers now and explain the problems with it.

  • Miasma Setup
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Miasma
    • Actions
      • Set MiasmaCaster = (Triggering unit)
      • Trigger - Turn on Miasma Group <gen>
  • Miasma Group
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of MiasmaCaster)) Equal to True
              • ((Picked unit) has buff Disease) Equal to True
            • Then - Actions
              • Unit Group - Add (Picked unit) to Miasma_Group
            • Else - Actions
              • Unit Group - Remove (Picked unit) from Miasma_Group
  • Miasma Cloud
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in Miasma_Group) Equal to True
    • Actions
      • Unit - Create 1 Miasma Cloud for (Owner of MiasmaCaster) at (Position of (Triggering unit)) facing Default building facing degrees
      • Unit - Set Level of Miasma Contangion DoT for (Last created unit) to (Level of Miasma for MiasmaCaster)
      • Unit - Order (Last created unit) to Neutral Pit Lord - Howl Of Terror
      • Unit - Add a 2.50 second Generic expiration timer to (Last created unit)
This Trigger actually "works", but there are a few problems with it:

1. If two heroes of the same kind are in the map (Plaguebearer), the variable can be set to the wrong Hero, as the trigger works, as it is now, only for one unit perfectly. In this case, I do not know how to change that, so some help would be appreciated.
For now, it is not that much of a problem for me: As The Hero belongs to my custom naga race, only one of them will be in the map. It just gets problematic, if more than one person would use the custom naga race at a time.

2. It conflicts with the base ability "Disease Cloud". I put in the condition "((Picked unit) belongs to an enemy of (Owner of MiasmaCaster)) Equal to True", so I can, if I play alone, at least test this skill(For balancing reasons, for example - a skill like that is rather difficult to balance).
However, if I were to ally with an undead-player, their disease cloud would also fire this trigger. Anyway, how to change that? As mentioned, I cannot change the buff of "Miasma", due to that hard-coded disease cloud.


I tried, with my knowledge, to make this spell MUI and to change whatever possible, to make the spell work out as it should, but to no avail. On the bright side: I can at least "use" the spell now and test it.
 
Last edited:
Level 33
Joined
Mar 27, 2008
Messages
8,035
Dead unit can't have a buff - therefore your trigger will never run, because dead unit don't have buff attached to them.

Therefore, you're gonna need to put them into a Unit Group.
And check if the unit dies is in the Unit Group, do actions.

And don't forget to handle the Unit Group removal when buff is destroyed.
 
Level 7
Joined
Dec 14, 2012
Messages
192
Dead unit can't have a buff - therefore your trigger will never run, because dead unit don't have buff attached to them.

Therefore, you're gonna need to put them into a Unit Group.
And check if the unit dies is in the Unit Group, do actions.

And don't forget to handle the Unit Group removal when buff is destroyed.
Ah, that is what I thought~ That the event is the problem.
So~ Problem now is, I never handled a unit group and have no idea how to do it actually.
 
Level 7
Joined
Dec 14, 2012
Messages
192
Anyone up to help me out? Or at least, up to explain how to use and handle unit groups(or provide me with a link to a tutorial, were this point is explained well)?
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Unit units to a unit group based on a buff can be a little tricky, because there is no "unit acquires buff" event.

One way is to pick every unit in playable map area, and do if then else:
if picked unit has buff
then add picked unit to UnitGroup

The event for this trigger will be every 1 second of game time or so.

Then your dying trigger changes to:
Event - Unit dies
Condition - Unit is in UnitGroup
Actions:
Unit - remove triggering unit from unit group (note that triggering unit is the same as dying unit, and is generally better to use)
Unit - Create a miasma at position of triggering unit

You should check out this thread to clean memory leaks, since currently this trigger will leak a point variable: http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/

This spell is further going to be quite tricky if you want multiple buff levels.
 
Level 7
Joined
Dec 14, 2012
Messages
192
Unit units to a unit group based on a buff can be a little tricky, because there is no "unit acquires buff" event.

One way is to pick every unit in playable map area, and do if then else:
if picked unit has buff
then add picked unit to UnitGroup

The event for this trigger will be every 1 second of game time or so.

Then your dying trigger changes to:
Event - Unit dies
Condition - Unit is in UnitGroup
Actions:
Unit - remove triggering unit from unit group (note that triggering unit is the same as dying unit, and is generally better to use)
Unit - Create a miasma at position of triggering unit

You should check out this thread to clean memory leaks, since currently this trigger will leak a point variable: http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/

This spell is further going to be quite tricky if you want multiple buff levels.
Okay~ Then, with the unit group: Should the variable be an array or not? I am still not so handy with arrays, so a little further explanation would be helpful. I'll try to remove the leaks myself~ Hopefully, I'll be able to ^^" I wonder though, what exactly do leaks do?

For the multiple levels~ How to solve that problem then? I thought about a few ways, but they all seem rather difficult/impossible...~
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
  • Derp
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff *YOUR BUFF* ) Equal to True
            • Then - Actions
              • DO LOTS OF STUFF HERE
            • Else - Actions
and if the amount of units in the group is zero (empty group; you can debug this with a string displayed), you have the trigger disable itself.
 
Level 7
Joined
Dec 14, 2012
Messages
192
  • Derp
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff *YOUR BUFF* ) Equal to True
            • Then - Actions
              • DO LOTS OF STUFF HERE
            • Else - Actions
and if the amount of units in the group is zero (empty group; you can debug this with a string displayed), you have the trigger disable itself.
Gonna try out this trigger, thank you^^
But I wish to ask: That custom script~ What exactly does it do? Could you explain that to me?
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Gonna try out this trigger, thank you^^
But I wish to ask: That custom script~ What exactly does it do? Could you explain that to me?

if i know well then make the unit group temporary. when u do pick unit then it is create a unit group what if u dont destroy then cause leak, but with that u make temporary the htoup so destroyed after loop (i hope this is how its work)
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
It sets a global variable to "true". The function that picks units, uses this variable to identify if it should destroy the group after the actions are done, or not, so it doesn't leak.

Also, make sure you put the periodical trigger to initially off and have it turned on when the spell is executed.
 
Level 7
Joined
Dec 14, 2012
Messages
192
It sets a global variable to "true". The function that picks units, uses this variable to identify if it should destroy the group after the actions are done, or not, so it doesn't leak.

Also, make sure you put the periodical trigger to initially off and have it turned on when the spell is executed.
There is a problem: It is no "spell", per se... It is a passive ability.
Miasma intoxicates nearby enemies, dealing damage over time to them. What I want to add is, if an unit affected by miasma dies, AoE damage is dealt and nearby enemies are intoxicated with a weakened version of miasma.

I encountered a few problems while using the trigger~
I do not know how to set the level of the "spreading" miasma. My idea is to create a dummy unit(miasma cloud) at the position where an enemy, that has the intoxication-buff, dies. The Miasma Cloud has an aversion of permanent Immolation for the damage and an aversion of Disease Cloud for the spreading. The levels of these two abilities also need to set to the level of the Hero, that has Miasma(The Plaguebearer).

Also, the Trigger needs to check if the unit is dead and had the buff while dying... Sort of. That means, I first pick every unit, then remove all units from the last created group which do not have the buff, then I check if a unit is dead, then I create a miasma cloud at the position of the dead unit~ Is that so far correct?

Also, what I would like to know~ With the "picked unit" function, is each unit in the group treated individually then? After all, a Miasma Cloud would have to be created at the specific place a unit died.

And lastly, do I need to create a variable for the custom script~?


Sorry for asking so much, but this ability is just a bit hard to create ^^"
 
Level 7
Joined
Dec 14, 2012
Messages
192
I think it might be easier to create a unit group variable and Pick Every unit in playable map area matching unit has buff equal to true..
As mentioned, I am not that handy with variables >.< But I'll try it out.
Still, even if I manage it like that, there are still a number of things unclear - for example, how to set the right levels of the Miasma Clouds abilities. Problem is, that the Plaguebringer is not necessarily the killer or attacker nor does he cast an ability, after all. It is rather annoying~
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
if u want make in gui i can show a way how to do t-virus :D

Infect the target with poison damage, this damage deal each sec same damage than the caster INT + Ability Level * 5 in last 20 + Ability level*2 second. When unit die, then every enemy unit in 350 range also will be infected but 75% damage compared with original.

oh, u need unit indexer :)


  • DoT
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer I) from 1 to DoT_I, do (Actions)
        • Loop - Actions
          • Set DoT_TL[I] = (DoT_TL[I] - 1)
          • Set DamageEventType = 10
          • Unit - Cause DoT_S[I] to damage DoT_T[I], dealing DoT_Dmg[I] damage of attack type Hero and damage type Normal
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • DoT_TL[I] Less than 1
                  • (DoT_T[I] is dead) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (DoT_T[I] is dead) Equal to True
                • Then - Actions
                  • Set DoT_W[I] = (DoT_W[I] - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DoT_W[I] Greater than 0
                    • Then - Actions
                      • Custom script: set bj_wantDestroyGroup = true
                      • Set Point = (Position of DoT_T[I])
                      • Set Player = (Owner of DoT_S[I])
                      • Set NewDmg = (DoT_Dmg[I] x DoT_WR[I])
                      • Unit Group - Pick every unit in (Units within 350.00 of Point matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of Player) Equal to True) and (((Triggering unit) is A structure) Equal to False)))) and do (Actions)
                        • Loop - Actions
                          • Set CV = (Custom value of (Picked unit))
                          • Custom script: if udg_DoT_FX[udg_CV] == null then
                          • Set DoT_I = (DoT_I + 1)
                          • Set DoT_S[DoT_I] = DoT_S[I]
                          • Set DoT_T[DoT_I] = (Picked unit)
                          • Set DoT_W[DoT_I] = DoT_W[I]
                          • Set DoT_WR[DoT_I] = 0.75
                          • Set DoT_Dmg[DoT_I] = NewDmg
                          • Set DoT_CV[DoT_I] = CV
                          • Set DoT_TL[DoT_I] = DoT_TLMAX[I]
                          • Special Effect - Create a special effect attached to the overhead of DoT_T[DoT_I] using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
                          • Set DoT_FX[DoT_CV[DoT_I]] = (Last created special effect)
                          • Custom script: endif
                      • Custom script: call RemoveLocation(udg_Point)
                    • Else - Actions
                  • Unit - Explode DoT_T[I]
                  • Set DoT_TL[I] = 0
                • Else - Actions
              • Special Effect - Destroy DoT_FX[DoT_CV[I]]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • I Equal to DoT_I
                • Then - Actions
                • Else - Actions
                  • Set DoT_CV[I] = DoT_CV[DoT_I]
                  • Set DoT_Dmg[I] = DoT_Dmg[DoT_I]
                  • Set DoT_S[I] = DoT_S[DoT_I]
                  • Set DoT_T[I] = DoT_T[DoT_I]
                  • Set DoT_TL[I] = DoT_TL[DoT_I]
                  • Set DoT_W[I] = DoT_W[DoT_I]
                  • Set DoT_WR[I] = DoT_WR[DoT_I]
                  • Set DoT_TLMAX[I] = DoT_TLMAX[DoT_I]
                  • Set I = (I - 1)
              • Set DoT_I = (DoT_I - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DoT_I Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
  • Infect ability cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • //index
      • Set DoT_I = (DoT_I + 1)
      • //damage search unit
      • Set DoT_S[DoT_I] = (Triggering unit)
      • //damage target unit
      • Set DoT_T[DoT_I] = (Target unit of ability being cast)
      • //second left from damage over time
      • Set DoT_TL[DoT_I] = (20 + ((Level of Infection for (Triggering unit)) x 2))
      • //initial duration
      • Set DoT_TLMAX[DoT_I] = DoT_TL[DoT_I]
      • //how many wave can infected, like infected die, give to others, then that units also die and give to 3rd generation etc
      • Set DoT_W[DoT_I] = 5
      • //damage reduction what applied if a unit die, so the nearby enemy unit will get only 75% damage (original dmg * 0.75)
      • Set DoT_WR[DoT_I] = 0.75
      • //damage amount per sec
      • Set DoT_Dmg[DoT_I] = ((Real((Intelligence of DoT_S[DoT_I] (Include bonuses)))) + (Real(((Level of Infection for (Triggering unit)) x 5))))
      • Set DoT_CV[DoT_I] = (Custom value of DoT_T[DoT_I])
      • Custom script: if udg_DoT_FX[udg_DoT_CV[udg_DoT_I]] == null then
      • Special Effect - Create a special effect attached to the overhead of DoT_T[DoT_I] using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Set DoT_FX[DoT_CV[DoT_I]] = (Last created special effect)
      • Custom script: endif
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DoT_I Equal to 1
        • Then - Actions
          • Trigger - Turn on DoT <gen>
        • Else - Actions
 

Attachments

  • Virus.w3x
    33.3 KB · Views: 44
Level 7
Joined
Dec 14, 2012
Messages
192
if u want make in gui i can show a way how to do t-virus :D



oh, u need unit indexer :)


  • DoT
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer I) from 1 to DoT_I, do (Actions)
        • Loop - Actions
          • Set DoT_TL[I] = (DoT_TL[I] - 1)
          • Set DamageEventType = 10
          • Unit - Cause DoT_S[I] to damage DoT_T[I], dealing DoT_Dmg[I] damage of attack type Hero and damage type Normal
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • DoT_TL[I] Less than 1
                  • (DoT_T[I] is dead) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (DoT_T[I] is dead) Equal to True
                • Then - Actions
                  • Set DoT_W[I] = (DoT_W[I] - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DoT_W[I] Greater than 0
                    • Then - Actions
                      • Custom script: set bj_wantDestroyGroup = true
                      • Set Point = (Position of DoT_T[I])
                      • Set Player = (Owner of DoT_S[I])
                      • Set NewDmg = (DoT_Dmg[I] x DoT_WR[I])
                      • Unit Group - Pick every unit in (Units within 350.00 of Point matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of Player) Equal to True) and (((Triggering unit) is A structure) Equal to False)))) and do (Actions)
                        • Loop - Actions
                          • Set CV = (Custom value of (Picked unit))
                          • Custom script: if udg_DoT_FX[udg_CV] == null then
                          • Set DoT_I = (DoT_I + 1)
                          • Set DoT_S[DoT_I] = DoT_S[I]
                          • Set DoT_T[DoT_I] = (Picked unit)
                          • Set DoT_W[DoT_I] = DoT_W[I]
                          • Set DoT_WR[DoT_I] = 0.75
                          • Set DoT_Dmg[DoT_I] = NewDmg
                          • Set DoT_CV[DoT_I] = CV
                          • Set DoT_TL[DoT_I] = DoT_TLMAX[I]
                          • Special Effect - Create a special effect attached to the overhead of DoT_T[DoT_I] using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
                          • Set DoT_FX[DoT_CV[DoT_I]] = (Last created special effect)
                          • Custom script: endif
                      • Custom script: call RemoveLocation(udg_Point)
                    • Else - Actions
                  • Unit - Explode DoT_T[I]
                  • Set DoT_TL[I] = 0
                • Else - Actions
              • Special Effect - Destroy DoT_FX[DoT_CV[I]]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • I Equal to DoT_I
                • Then - Actions
                • Else - Actions
                  • Set DoT_CV[I] = DoT_CV[DoT_I]
                  • Set DoT_Dmg[I] = DoT_Dmg[DoT_I]
                  • Set DoT_S[I] = DoT_S[DoT_I]
                  • Set DoT_T[I] = DoT_T[DoT_I]
                  • Set DoT_TL[I] = DoT_TL[DoT_I]
                  • Set DoT_W[I] = DoT_W[DoT_I]
                  • Set DoT_WR[I] = DoT_WR[DoT_I]
                  • Set DoT_TLMAX[I] = DoT_TLMAX[DoT_I]
                  • Set I = (I - 1)
              • Set DoT_I = (DoT_I - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DoT_I Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
  • Infect ability cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • //index
      • Set DoT_I = (DoT_I + 1)
      • //damage search unit
      • Set DoT_S[DoT_I] = (Triggering unit)
      • //damage target unit
      • Set DoT_T[DoT_I] = (Target unit of ability being cast)
      • //second left from damage over time
      • Set DoT_TL[DoT_I] = (20 + ((Level of Infection for (Triggering unit)) x 2))
      • //initial duration
      • Set DoT_TLMAX[DoT_I] = DoT_TL[DoT_I]
      • //how many wave can infected, like infected die, give to others, then that units also die and give to 3rd generation etc
      • Set DoT_W[DoT_I] = 5
      • //damage reduction what applied if a unit die, so the nearby enemy unit will get only 75% damage (original dmg * 0.75)
      • Set DoT_WR[DoT_I] = 0.75
      • //damage amount per sec
      • Set DoT_Dmg[DoT_I] = ((Real((Intelligence of DoT_S[DoT_I] (Include bonuses)))) + (Real(((Level of Infection for (Triggering unit)) x 5))))
      • Set DoT_CV[DoT_I] = (Custom value of DoT_T[DoT_I])
      • Custom script: if udg_DoT_FX[udg_DoT_CV[udg_DoT_I]] == null then
      • Special Effect - Create a special effect attached to the overhead of DoT_T[DoT_I] using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Set DoT_FX[DoT_CV[DoT_I]] = (Last created special effect)
      • Custom script: endif
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DoT_I Equal to 1
        • Then - Actions
          • Trigger - Turn on DoT <gen>
        • Else - Actions
Okay~ That is quite a trigger xD
Truth to be told, I do not understand it now o_O Need to look through it, that will take some time xD

Though, I wonder~ Could you create the ability I want for me? I am not so experienced with triggers, as mentioned ^^"
The problem with the trigger you gave me is, that it is an active ability, id est, it is casted. Mine is supposed to not be casted - it is a passive ability.
My ability also is a bit simpler, as it does not deal "scaling" damage like yours.

Anyway, I'll look through your trigger now and see what I can learn from it~ Though, I am sure I wont understand the most xD
 
Level 7
Joined
Dec 14, 2012
Messages
192
Soo~ I have posted my new triggers and explained all the new problems with them. Hope someone can help me out again, as it is pwetty annoying.
 
Level 7
Joined
Dec 14, 2012
Messages
192
sorry but i guess most of ppl busy, i am also dont have so much time and only reason why i tryed something now was because u bumped so much so i show to u a demo map, u can check if u like
I guessed that most are, but well~ If I would not keep the topic bumped, I'll never get an answer ^^"
But thank you very much for taking the time :3
I'll check the map out, once I get home~
 
Level 7
Joined
Dec 14, 2012
Messages
192
sorry but i guess most of ppl busy, i am also dont have so much time and only reason why i tryed something now was because u bumped so much so i show to u a demo map, u can check if u like
I checked your map but~ It seems like you have understand something wrong.
THe miasma is not spreaded if my Hero dies, but if a target affected by it dies.
By now, I even have found a more or less working trigger. It only has some problems when playing allying with an undead player, or if my Hero would be twice on the map. If these problems would be solved, I think I my ability would work out.
 
Status
Not open for further replies.
Top