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

[Solved] Defiled Fountain + Healing Item Combo??

Status
Not open for further replies.
Level 6
Joined
Oct 25, 2010
Messages
203
Hopefully this is the right place to post this, I assume what I need are triggers and the object editor

Does anybody know of any tricks, or more specifically a guide, for the best way to setup a defiled fountain that requires a special item for healing? Maybe the item can be an orb of some kind?

What I actually would like is to have the defiled fountain cause damage to units (either poison or disease cloud, but I do not want it to negate the standard disease cloud)

Then when a player finds the special item, they will be able to heal from the fountain instead of being damaged

However, my concern is that it must work for multiple players without effecting other players (each player should require their own item, otherwise they will not be able to heal) so the item would probably have to work sort of like an aura instead of being useable, maybe? although I prefer not using regions if possible

Am I asking for something difficult? I hope this is pretty simple, Im sure somebody must have done something similar in the past :)
 
Last edited:

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,182
Generally speaking, you post in the WE section if you don't have half-finished or not working triggers.
Regardless, there are a few ways to do this.

One way is to nullify the healing done by default to units that do not hold the item.

Use a periodic timer with 1 second interval
unit group pick all units of type defiled fountain
unit group pick all units in X range of picked unit
if picked unit has item X
Remove Y hp from picked unit​
 
Level 6
Joined
Oct 25, 2010
Messages
203
thanks :) Ive been coming here for years but always get confused which forum is the preferred one lol!
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,456
We need to add our Defiled Fountain(s) to DF_Group, a Unit Group that will keep track of them.
  • Add DF example
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Unit - Create 1 Defiled Fountain of Life for Neutral Passive at (Center of (Playable map area)) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to DF_Group
      • Trigger - Turn on DF Loop <gen>
Every 1.00 second we search for units around our Defiled Fountain(s) and either Damage/Heal them depending on whether or not they have the "Special Item".
  • DF Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DF_Group and do (Actions)
        • Loop - Actions
          • Set VariableSet DF_Point = (Position of (Picked unit))
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 512.00 of DF_Point.) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is alive) Equal to True
                  • ((Picked unit) is A structure) Equal to False
                  • ((Picked unit) is Mechanical) Equal to False
                  • ((Picked unit) is hidden) Equal to False
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) has an item of type Special Item) Equal to False
                      • ((Picked unit) is invulnerable) Equal to False
                    • Then - Actions
                      • -------- Damage (Non-Lethal) --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Life of (Picked unit)) Greater than 10.50
                        • Then - Actions
                          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 10.00)
                        • Else - Actions
                          • Unit - Set life of (Picked unit) to 0.50
                      • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\NightElf\Immolation\ImmolationDamage.mdl
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                      • -------- Heal (If Not Full Already) --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Percentage life of (Picked unit)) Less than 100.00
                        • Then - Actions
                          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 10.00)
                          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\VampiricAura\VampiricAuraTarget.mdl
                          • Special Effect - Destroy (Last created special effect)
                        • Else - Actions
                • Else - Actions
          • Custom script: call RemoveLocation (udg_DF_Point)
 

Attachments

  • Defiled Fountain example.w3m
    18.3 KB · Views: 20
Last edited:
Level 6
Joined
Oct 25, 2010
Messages
203
Thank you so much WOW this is amazing!!!

Just one question though, I dont know much about leaks but I do see you obviously included "custom script bj destroy etc"... my concern is about having the script check every second, can that cause issues running every second? or what if I set it to be every 10-20 seconds, will it make a difference (besides slowing the effects)?

Oh and I think you have it setup to only work for the individual hero carrying the item, right? I also want it to have an aura effect for all nearby friendly units, but I think I can manage figuring it out from here! Hopefully I should be able to just change the special item to an ability attached to the item

Thanks again :)
 
Last edited:

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,456
Thank you so much!!! This is amazing

Just one question though, I dont know much about leaks but I do see you obviously included "custom script bj destroy etc"... my concern is about having the script check every second, can that cause issues running every second? or what if I set it to be every 10-20 seconds, will it make a difference (besides slowing the effects)?

Oh and I think you have it setup to only work for the individual hero carrying the item, right? I also want it to have an aura effect for all nearby friendly units, but I think I can manage figuring it out from here! Hopefully I should be able to just change the special item to an ability attached to the item

Thanks again :)
It will damage all nearby organic units that aren't carrying the item and heal all nearby organic units that are carrying it.

And speaking on performance, it's not that performance heavy to begin with, but if you wanted to optimize it then you could turn the Loop trigger off whenever it's not needed. That's why I have it Initially Off, to emphasize this idea that the Loop doesn't always have to be on. That being said, the trigger would need to be structured a bit differently if you wanted to do something like this.

For example, if you only have 1 Defiled Fountain in your map, you could turn on the Loop trigger when a unit comes within range of the Fountain or when a unit enters a Region surrounding the Fountain. Then turn it off when all of the units have left it's Region.

This way the Loop is only running when it knows for a fact that a unit is near the Fountain. If you have multiple Defiled Fountains, you could use this same approach but split it up among multiple triggers, so each Fountain has it's own Loop trigger.

It could also be done with a single Loop trigger, but that might come at a minor cost of performance.
 
Last edited:
Level 6
Joined
Oct 25, 2010
Messages
203
yes performance is a concern, I actually have 2 fountains but they are almost side by side (same region) so that isnt a problem for me to handle, if I decide to separate my fountains farther apart I can always handle adding the necessary additions. But i guess that wouldnt be a good idea so Ill probably just leave them together

I would like the look trigger to turn off whenever possible, if it detects no units nearby. But that might be a problem for instance, cuz I have creeps all around the fountain so I guess it wouldnt really matter

I think running the loop every 20 seconds would be fine, I can just increase the HP values from 10 to 25 or so
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,456
yes performance is a concern, I actually have 2 fountains but they are almost side by side (same region) so that isnt a problem for me to handle, if I decide to separate my fountains farther apart I can always handle adding the necessary additions. But i guess that wouldnt be a good idea so Ill probably just leave them together

I would like the look trigger to turn off whenever possible, if it detects no units nearby. But that might be a problem for instance, cuz I have creeps all around the fountain so I guess it wouldnt really matter

I think running the loop every 20 seconds would be fine, I can just increase the HP values from 10 to 25 or so
20 seems rather drastic, I would only worry about it if you notice an actual drop in performance.

And here is a more optimized version for multiple fountains that turn on/off. Not sure if you can open the map or not, I'm using the latest version.

EDIT: Fixed a bug. Uploaded a new version.
 

Attachments

  • Defiled Fountain example 2 fix.w3m
    23.5 KB · Views: 19
Last edited:
Level 6
Joined
Oct 25, 2010
Messages
203
OMG yes!!! I am so excited to get this implemented into my map :D

Thank you thank thank you my friends are going to freak when they see this lol

the reason I am concerned about performance is that, Im a big newbie at this stuff. I messed around with the editor a bit as a kid, many years ago, but I just started trying to make a rather complex map a few years ago and its been a super slow process. After working for almost a year on my map (back in 2016-17) I found it was laggy due to leaks and then I gave up and stopped playing WC for a while. Well, I started working on my map again a few months ago, and while I was able to find the source of my main leak from before, I had to remove a lot of my crappy triggers, redo a bunch of stuff, and theres still a lot of unnecessary junk left over. So Im still worried that theres probably easy to fix leaks Im not noticing because they are small, and its hard to find lots of peole to help beta test stuff

But currently, I think my map is running pretty smooth. My current small leak is caused by the Spell Book but it only causes a minor hiccup for a quick second like once every few mins. I also wonder about doodads, do they have much effect on performance? I mainly use rocks and bushes, not much water, but is there a limit at a certain point?
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,456
OMG yes!!! I am so excited to get this implemented into my map :D

Thank you thank thank you my friends are going to freak when they see this lol

the reason I am concerned about performance is that, Im a big newbie at this stuff. I messed around with the editor a bit as a kid, many years ago, but I just started trying to make a rather complex map a few years ago and its been a super slow process. After working for almost a year on my map (back in 2016-17) I found it was laggy due to leaks and then I gave up and stopped playing WC for a while. Well, I started working on my map again a few months ago, and while I was able to find the source of my main leak from before, I had to remove a lot of my crappy triggers, redo a bunch of stuff, and theres still a lot of unnecessary junk left over. So Im still worried that theres probably easy to fix leaks Im not noticing because they are small, and its hard to find lots of peole to help beta test stuff

But currently, I think my map is running pretty smooth. My current small leak is caused by the Spell Book but it only causes a minor hiccup for a quick second like once every few mins. I also wonder about doodads, do they have much effect on performance? I mainly use rocks and bushes, not much water, but is there a limit at a certain point?
I'm a bit busy with my own map/helping others with their maps, but if you'd like I could take a look at your map. Feel free to PM it to me, if that's something you're interested in. I could probably run through the triggers and clean up any leaks I see.

And Destructibles, especially Walkable ones, cause the biggest performance hits. Doodads are better to use when possible, for example, replacing your Pathing Blockers with Doodad versions can actually help with performance.

Also, Leaks aren't going to cause the "hiccup" effect that you mentioned, but a poorly optimized trigger would. That, or a trigger that simply does too much stuff all at once. Leaks cause gradual performance issues that are more noticeable as the game goes on. Although, it's possible to create A LOT of leaks in a short time frame, causing that performance issue to happen much sooner. But these performance issues don't go away over time, they'll stay there forever and only get worse.
 
Last edited:
Level 6
Joined
Oct 25, 2010
Messages
203
if you'd like I could take a look at your map. Feel free to PM it to me, if that's something you're interested in. I could probably run through the triggers and clean up any leaks I see.

Id love to! I gotta try to do some more work on things, but I will be around with more questions lol

Destructibles, especially Walkable ones, cause the biggest performance hits. Doodads are better to use when possible, for example, replacing your Pathing Blockers with Doodad versions can actually help with performance.

Perfect! I read lots of guides suggesting that I create "rolling mountain" and use pathing blockers to prevent units from walking up, but I dont like that. I just use the standard terrain cliffs with rocks and bushes, looks fine that way (especially since my map is melee style, so not too fancy lol)

Leaks aren't going to cause the "hiccup" effect, but a poorly optimized trigger would. That, or a trigger that simply does too much stuff all at once.

Hmmm, yea that makes. I think I may be confusing the word "leak" with just overly redundant triggers

I wanted to create a system to swap player positions even though I am using fixed starting locations. I thought it would be a lot easier, but my method is probably not considered "correct" lol... Ive tried reading guides on lua or jass, really wish I could figure it out... I sort of know a little tiny bit about java/html but not really :(
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,456
Id love to! I gotta try to do some more work on things, but I will be around with more questions lol



Perfect! I read lots of guides suggesting that I create "rolling mountain" and use pathing blockers to prevent units from walking up, but I dont like that. I just use the standard terrain cliffs with rocks and bushes, looks fine that way (especially since my map is melee style, so not too fancy lol)



Hmmm, yea that makes. I think I may be confusing the word "leak" with just overly redundant triggers

I wanted to create a system to swap player positions even though I am using fixed starting locations. I thought it would be a lot easier, but my method is probably not considered "correct" lol... Ive tried reading guides on lua or jass, really wish I could figure it out... I sort of know a little tiny bit about java/html but not really :(
Sounds good :) I'm not that experienced with custom Melee games but I'm sure a simple swap system could be thrown together.

And for leaks, just remember that we're talking about Memory leaks. In other words, the game is remembering/keeping track of something that is no longer needed and that should have been discarded.

For example, when you create a Footman at the center of the map in GUI (the standard Trigger Editor that you use), you're really telling the game to create a Footman at the x: 0, y: 0 coordinates in the game world.

The game then converts these coordinates into what we know as Points in GUI or Locations in Jass (of course they had to make it confusing by using two different names for the same thing). This Point/Location is used only temporarily to create the Footman, therefore it's no longer needed once we're done using it. Unfortunately, the Point will remain in the game's memory FOREVER, taking up space for no good reason, and the worst part is that we can't even get rid of it because Blizzard's code was in charge of that and they didn't bother doing it.

Luckily, and I'm sure you're already doing this in your own map, we can set our own Point variable to the center of the map, tell the game to create a Footman at that Point instead, and then manually Remove the Point once we're done using it. This will clean up the Memory Leak, and thus relieve our game's memory from having to keep track of useless junk.

That same logic is applied to other types of Leaks regarding Unit Groups, Player Groups, Special Effects, etc...
 
Last edited:
Status
Not open for further replies.
Top