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

Contangious Disease Cloud

Status
Not open for further replies.
Level 7
Joined
Dec 14, 2012
Messages
192
Hello there~ I got regular access to internet again after a long long break, filled with some complications~ But well, without further ado - lets get to the problem in question.

I already posted this problem ages ago, but I have not found a solution, so I'll repost it.

I want to create an ability based of disease cloud(Miasma), that poisons enemies around my Hero. If a poisoned enemy dies, enemies near the dying enemy should be affected by a different poison, which reduces life regeneration. Once an enemy affected by any of these poisons dies, the poison will once again spread. Important is, that the poisons should stack and that both deal damage according to the level of Miasma. The trigger I have so far looks like this:

  • 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) or (((Picked unit) has buff Contangion ) 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.00 second Generic expiration timer to (Last created unit)
The Triggers "Work" - but there are a few problems:
1. If you create an ability with "Disease Cloud" as base ability, if will ALWAYS give the "Disease"-buff. Does anyone know how to prevent that?
2. I made some adjustments to prevent some nuisances with the undead's disease buff, but if my custom race(Naga) allies with undead and uses the Hero "Plaguebringer", which has the miasma ability, the undead's disease cloud will create that "Contangion"-effect.
3. The Trigger bugs around a lot, if there are 2 Plaguebringers in the game, due to the new one overwriting the "MiasmaCaster"-Variable all the time.


So, these are the problems. Any idea how to solve them? Answers would please me a lot and lots~:3
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
You can remove the second trigger and simply check when a unit with the buff from the ability dies.

The ability can also be based off "Permanent Immolation" if you don't want a buff just to damage units near the Hero only.

Phoenix Fire also may come in handy if you don't want to base it off Disease Cloud. It also has a missle art fields and can deal damage both on hit and over-time.
 
Level 7
Joined
Dec 14, 2012
Messages
192
You can remove the second trigger and simply check when a unit with the buff from the ability dies.

The ability can also be based off "Permanent Immolation" if you don't want a buff just to damage units near the Hero only.

Phoenix Fire also may come in handy if you don't want to base it off Disease Cloud. It also has a missle art fields and can deal damage both on hit and over-time.
"A unit dies" does not work at all. Why? Because a dead unit does not have buffs - and a dying unit probably does not have buffs, either. I tried it already, as it is the obvious choice - but it does not work.

Permanent Immolation does not poison enemies and deals damage constantly - it would be different very much. Also, Permanent Immolation does not even give a buff to units hit by it, if I am correct.

I could try out using Phoenix Fire. Through using some passive abilities, I can also keep the visual looking fine, and if it does indeed have a damage over time field, I can probably use that one as a base ability - and hopefully, I can alter the buff it gives then. Thanks for the help, but this is not all so far~
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
Well since Plaguebringer is a hero, I guess it is 1 Plaguebringer per player? If so, then make MiasmaCaster an array and when a plaguebringer learns Miasma, save him as MiasmaCaster[Player number of (owner of (Triggering unit))]. That way you won't replace one Plaguebringer for the other.

This, however is where the problems start. I can't really think of any way but to make this spell a huge complicated mess, to be honest. And to be honest, I don't think it's really worth the effort. I've put elaboration in hidden tags
The problem is that the spell applies passively a debuff that lasts for some time; and because of that and more Plaguebringers in game, you will have very hard time finding out whose Plaguebringer a miasma debuff even is.

You would also need to make MiasmaGroup an array and save units, who have Miasma debuff into a group. So player 3's Plaguebringer will be MiasmaCaster[3] and units he infects will be stored in MiasmaGroup[3]. You can do that easily by once again calling out to player's number.
But yet again, you can't find out to whose player Miasma debuff is, so you can't really find out to which group you should add that unit. Because of that, you can't even find out if picked unit is an enemy of MiasmaCaster or not.

What I think you would need to do is check all units in game every fraction of second if they have this debuff and if they are in range to any Plaguebringer. Then you would need to remove that unit from all MiasmaGroups and add then to the group to which belongs to that Plaguebringer, to which the unit is closest to (if the unit is in such distance to the closest Plaguebringer, that it would get affected by Miasma).

Then when the unit dies, you would need to find out in which group that unit even was and create MiasmaCloud to correct player. That could be done by For each Integer A from 1 to 12 loop using Integer A as group index and checking if the unit is in that group.

The main reason why I think its not worth the effort is because I believe it can affect user's performance (= fps). Just think about it: The trigger would be picking each and every unit every 0,1-0,3 second and checking each picked unit's distance to each enemy Plaguebringer, checking each picked unit for Miasma debuff, etc. Checking that many units in such short periods would imo affect user's performance.


For point #1
- I encountered same problem (having modified Disease buff, but the ability always applied the basic Disease debuff), don't know what to do with it.

Point #2
- Disease Cloud ability should have "Data - Plagueward unit type" don't your Miasma and the basic Disease Cloud ability share same Plagueward type atm? Also check, that the "plagueward" unit usually also has Disease Cloud (Plague Ward) ability. Didn't you change that ability perhaps?

=====================
Also you leak group here
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
    • Loop - Actions
and location here
  • Unit - Create 1 Miasma Cloud for (Owner of MiasmaCaster) at (Position of (Triggering unit)) facing Default building facing degrees
You will need to add "Custom script: set bj_wantDestroyGroup = true" before you make a unit group.
For the location, you will first need to store the location into variable, for example set loc = (Position of (Triggering unit)), then create a unit at loc; and finally after you create the unit, you destroy the location using "Custom script: call RemoveLocation(udg_loc)" and
"Custom script: set udg_loc = null". You need to use both.
 
Level 7
Joined
Dec 14, 2012
Messages
192
Well since Plaguebringer is a hero, I guess it is 1 Plaguebringer per player? If so, then make MiasmaCaster an array and when a plaguebringer learns Miasma, save him as MiasmaCaster[Player number of (owner of (Triggering unit))]. That way you won't replace one Plaguebringer for the other.

This, however is where the problems start. I can't really think of any way but to make this spell a huge complicated mess, to be honest. And to be honest, I don't think it's really worth the effort. I've put elaboration in hidden tags
Hm, I understand what you mean~ Problem is, I am not good at handling arrays - always get terribly confused once I try ._. Might I ask you to rewrite the Trigger with these arrays then? I learn best by example and you seem to be rather knowledgable~

For point #1
- I encountered same problem (having modified Disease buff, but the ability always applied the basic Disease debuff), don't know what to do with it.
Feh, how annoying. I hate it if some abilities just don't do what they should do. It took me awhile to notice that the wrong buff is applied xD

Point #2
- Disease Cloud ability should have "Data - Plagueward unit type" don't your Miasma and the basic Disease Cloud ability share same Plagueward type atm? Also check, that the "plagueward" unit usually also has Disease Cloud (Plague Ward) ability. Didn't you change that ability perhaps?
Fuu... I will need to look that up once I am at home. To de honest, the field "Data - Plagueward unit type" always served to cause me major confusion and other idiosyncrasies. What is that field even there for o.o?

Also you leak group here
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
    • Loop - Actions
and location here
  • Unit - Create 1 Miasma Cloud for (Owner of MiasmaCaster) at (Position of (Triggering unit)) facing Default building facing degrees
You will need to add "Custom script: set bj_wantDestroyGroup = true" before you make a unit group.
For the location, you will first need to store the location into variable, for example set loc = (Position of (Triggering unit)), then create a unit at loc; and finally after you create the unit, you destroy the location using "Custom script: call RemoveLocation(udg_loc)" and
"Custom script: set udg_loc = null". You need to use both.
Leaks o.o another thing I do not have much of an idea about. Could you maybe explain to me why these things actually leak?
Also, for the location one.... I have created a number of spells enhanced by trigger and I often use "Unit - Create 1 Spelldummy at location facing default"...
Do ALL of these leak o.o? If yes, do I need to create a seperate variable for each of these skills and run the custom script? And if no... Why does this one leak?
For the unit group, I need to set the custom script before I create the unit group, correct? Do I need to do this with every trigger that uses unit groups?

Sorry for asking so much of you~.~
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
I won't rewrite all triggers, because as I wrote in the elaboration, you would need to make the whole spell work differently.
Simply put, a variable can store 1 data (different type of variable can store different type of data/information). Making it an array enables that variable to store multiple informations of the same type. How many informations it can store depends on the number you put in "Size" (= i.e. that's the size of the array, so if it has Size 10, it can save 10 informations; if 150, it can save 150 informations).

Array looks like this: VariableName[INDEX], where index is an integer number. Since player's number is an integer, you can use player's own number as an Index for the VariableName. This is preffered for situations like this (1 hero-type per player), because you can easily find out player's number and so you can easily call on unit, who's index number is same as the player's number.
It's better explained and more detailed (with examples!) in this http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/variables-5896/ topic. I suggest reading it.

The first trigger should be like this. I will repeat once again, the whole spell would need to be redesigned, changing the first trigger won't make it miraculously work.
  • Miasma Setup
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Miasma
    • Actions
      • Set MiasmaCaster[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
      • Trigger - Turn on Miasma Group <gen>
So in example, if owner of the triggering unit is player 5, it will be Set MiasmaCaster[5] = (Triggering unit)

===================
For #2
It is easy - if you look at the default Undead units, you will see that under "Special" units there is Disease cloud.
You may also remember, that after Abomination dies, or after Meat Wagon lands an attack, they leave Disease Cloud in that place. They basically create Disease Cloud unit there - and that unit is that Plagueward Unit.
So if you change "Data - Plagueward Unit Type" to Villager, then upon death an Abomination will summon Villager in its place, not disease cloud; same for Meat Wagon.

======
About leaks:
Yes, all these (Position of (Triggering/Picked/etc. unit) leak. Basically all locations leak, which is why you need to save them first in a variable (like "loc"), then create units at loc and then you destroy loc.

Leaks is a "Memory leak" - if you don't destroy locations, etc. it will be stored as data in your pc and if it's too much data (like after cca 20 minutes of gameplay), your game will start lagging, worst case may even crash. This is the reason why you need to get rid of those data properly, so you won't burden your PC too much so the game won't be laggy. As a map maker, you must think also of potential players, who have older computers. Because your PC can cope with huge amount of memory leaks, it doesn't mean all PCs can.

So uhm yes, probably most (if not all) your locations leak. But not only locations leak. Also special effects created through trigger leak, groups leak, etc.
Read this http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/ topic. It's explained there what types of memory leak exist and how to get rid of them.
 
Level 14
Joined
Oct 6, 2008
Messages
759
Make a dummy that will represent the poison cloud and spread disease as the normal abomination abbility (adjust it to fit your hero) and give it to the dummy. Use a druid's Roar as a second base ability and put negative (-) value to life regen and affected targets to enemies. The Roar will be your second 'poison' that spreads when a unit dies from miasma (the disease cloud of abomination as mentioned above). When a unit that is diseased dies , create a dummy owned by the player who casted miasma that casts the Roar 'poison'. When a unit dies by the roar poison do the same to spread it. Only triggers needed are to detect which miasma disease is to which player.
 
Level 7
Joined
Dec 14, 2012
Messages
192
I won't rewrite all triggers, because as I wrote in the elaboration, you would need to make the whole spell work differently.
Simply put, a variable can store 1 data (different type of variable can store different type of data/information). Making it an array enables that variable to store multiple informations of the same type. How many informations it can store depends on the number you put in "Size" (= i.e. that's the size of the array, so if it has Size 10, it can save 10 informations; if 150, it can save 150 informations).

Array looks like this: VariableName[INDEX], where index is an integer number. Since player's number is an integer, you can use player's own number as an Index for the VariableName. This is preffered for situations like this (1 hero-type per player), because you can easily find out player's number and so you can easily call on unit, who's index number is same as the player's number.
It's better explained and more detailed (with examples!) in this http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/variables-5896/ topic. I suggest reading it.
Interesting. That means, for this Trigger, I need to set the array size to 12 to make it work out, correct?

The first trigger should be like this. I will repeat once again, the whole spell would need to be redesigned, changing the first trigger won't make it miraculously work.
  • Miasma Setup
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Miasma
    • Actions
      • Set MiasmaCaster[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
      • Trigger - Turn on Miasma Group <gen>
So in example, if owner of the triggering unit is player 5, it will be Set MiasmaCaster[5] = (Triggering unit)
Ah, thanks for the example. I think I may be able to code the ability now, got to try around a bit~


For #2
It is easy - if you look at the default Undead units, you will see that under "Special" units there is Disease cloud.
You may also remember, that after Abomination dies, or after Meat Wagon lands an attack, they leave Disease Cloud in that place. They basically create Disease Cloud unit there - and that unit is that Plagueward Unit.
So if you change "Data - Plagueward Unit Type" to Villager, then upon death an Abomination will summon Villager in its place, not disease cloud; same for Meat Wagon.
Ah yes, I remember~ I created a custom plagueward for that. However, as the "Disease"-Buff is still applied, I think it may possibly still bug around if my Naga race allies with undead, due to them also creating the "Disease" buff.
About leaks:
Yes, all these (Position of (Triggering/Picked/etc. unit) leak. Basically all locations leak, which is why you need to save them first in a variable (like "loc"), then create units at loc and then you destroy loc.

Leaks is a "Memory leak" - if you don't destroy locations, etc. it will be stored as data in your pc and if it's too much data (like after cca 20 minutes of gameplay), your game will start lagging, worst case may even crash. This is the reason why you need to get rid of those data properly, so you won't burden your PC too much so the game won't be laggy. As a map maker, you must think also of potential players, who have older computers. Because your PC can cope with huge amount of memory leaks, it doesn't mean all PCs can.

So uhm yes, probably most (if not all) your locations leak. But not only locations leak. Also special effects created through trigger leak, groups leak, etc.
Read this http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/ topic. It's explained there what types of memory leak exist and how to get rid of them.
Okay~ I didn't realize that all of these locations leak. However, it seems like it is rather easy to prevent this leaking from happening, isn't it? It's a bit of annoying work, but definetely possible~.~

Make a dummy that will represent the poison cloud and spread disease as the normal abomination abbility (adjust it to fit your hero) and give it to the dummy. Use a druid's Roar as a second base ability and put negative (-) value to life regen and affected targets to enemies. The Roar will be your second 'poison' that spreads when a unit dies from miasma (the disease cloud of abomination as mentioned above). When a unit that is diseased dies , create a dummy owned by the player who casted miasma that casts the Roar 'poison'. When a unit dies by the roar poison do the same to spread it. Only triggers needed are to detect which miasma disease is to which player.
Problem is, that the Miasma ability is a passive ability. And even if I make the dummy always follow around my Plaguebringer, it just would not change a thing. Furthermore, I also use a dummy for the contangion effect - and that one uses Howl of Terror as a base ability for the secondary poison - which practically is the negative version of roar xD Triggering it all correctly is the nuisance.
 
Level 7
Joined
Dec 14, 2012
Messages
192
The problem is that the spell applies passively a debuff that lasts for some time; and because of that and more Plaguebringers in game, you will have very hard time finding out whose Plaguebringer a miasma debuff even is.

You would also need to make MiasmaGroup an array and save units, who have Miasma debuff into a group. So player 3's Plaguebringer will be MiasmaCaster[3] and units he infects will be stored in MiasmaGroup[3]. You can do that easily by once again calling out to player's number.
But yet again, you can't find out to whose player Miasma debuff is, so you can't really find out to which group you should add that unit. Because of that, you can't even find out if picked unit is an enemy of MiasmaCaster or not.

What I think you would need to do is check all units in game every fraction of second if they have this debuff and if they are in range to any Plaguebringer. Then you would need to remove that unit from all MiasmaGroups and add then to the group to which belongs to that Plaguebringer, to which the unit is closest to (if the unit is in such distance to the closest Plaguebringer, that it would get affected by Miasma).

Then when the unit dies, you would need to find out in which group that unit even was and create MiasmaCloud to correct player. That could be done by For each Integer A from 1 to 12 loop using Integer A as group index and checking if the unit is in that group.

The main reason why I think its not worth the effort is because I believe it can affect user's performance (= fps). Just think about it: The trigger would be picking each and every unit every 0,1-0,3 second and checking each picked unit's distance to each enemy Plaguebringer, checking each picked unit for Miasma debuff, etc. Checking that many units in such short periods would imo affect user's performance.
Well, trying it a bit with your tips, however, I faced a distinct problem: How to check the distance to the plaguebringer? I tried around, looked around a bit, but have found next to nothing T_T

However, are you sure there is no other possibility to either do it simpler or do it more~ "user-friendly" in terms of performance? It would be rather nice if I could just code this damn skill xD

The thing that upsets me the most is, that it actually works fine, if there is just one plaguebringer around - this is just infuriating.

Another thing I am thinking about is: If the "Contangion" effect does not increase in damage with each level of "Miasma", wouldn't things be easier? I could do that and make it balanced by streamlining the damage and probably making the second "Contangion" effect stronger by(Meaning: A unit affected by miasma dies -> nearby units are affected with contangion -> unit affected with contangion die -> nearby units are affected by a stronger contangion effect and/or if a unit with contangion dies, low AoE damage is done; - Do you think this would work out? I like the concept: You get afflicted, you die, afflicting your allies with another type of affliction, then they die and deal AoE damage+a low lasting affliction that spreads the original "Contangion" effect; How does that sound for you?)

Also, to make sure the "contangion" effect from your ally does not damage your units/The "Contangion" effect from enemy does not damage his units, one could simply use a function like: "Create Miasmacloud for owner of dying unit(Triggering unit should work)" and then set the miasmacloud ability to hit affect friendly units.

Would it work out easier with these changes?

I also think it fits the Plaguebringers theme: A fast yet somewhat fragile melee unit, dealing a good bit of melee damage, is able to create "Plague Spawns" which can create lesser Plague Spawns, which can also create lesser Plague Spawns - all based on enemy death. The rather reliant slows his abilities have and the distraction Plague Spawns create his line of defense, as he is rather fragile as I mentioned. Add the Miasma/Contangion effect on it, to increase his damage by a good bit and it spreads on and on and on - rather harsh to get rid off in the end.
Hardest thing to do, though, is to balance out the Miasma/Contangion/Second Contangion damages. Miasma scales with level, so it won't be too hard - however - the two contangion effect are harsh to balance: They cannot be too weak or too strong, especially seeing as they are prone to happen frequently in a big fight, becoming a reliable source of constant AoE damage.
 
Status
Not open for further replies.
Top