Warcraft III resources & community, 2003–2006 · archived

Spell: Dehydration

7 posts
#1

Spell: Dehydration

I have a nice spell idea for my hero, dehydration. Its quite simple, just a spell that deals damage over time, like a shadowstrike, but when the affected hero crosses or stands in shallow water the spell will be turned off. How do i make that with triggers? :?:
#2
a few ways to do it but they wont be implementable in other maps

1: have a region for every section of water and turn off when hero enters

2: use the terrain type functions and have a separate terrain type under all the water sections (ie have sandy grass under water but no-where else).

3: use a 'terrain - cliff height function' to determine where the hero is, and turn off when he's on certain cliff height. problem being that this means all your streams must be on the same cliff height.

#2 is probably the best option

=][= Bort
#3
Thanks alot, and yes i also think #2 was best option. I've solved it with the following trigger:


        Events
        Time - Elapsed game time is 0.50 seconds
    Conditions (none)
    Actions
        Unit Group - Pick every unit in (Units in (Playable map area)) and do (If ((Terrain type at (Position of (Picked unit))) Equal to Lordaeron Winter - Rough Dirt) then do (Unit - Remove Dehydration  buff from (Picked unit)) else do (Do nothing))


And now i have one question. Can this trigger be used in a long game, say 45-60 min? Because i had some problems with triggers who were used very often just were shut down after some time. Maybe i should add a condition to solve that problem?
#4
Oh, there will be problems. When you use the "pick every unit" action it causes memory leaks, and at twice per second, it will add up and lag like hell. Read the memory leak tutorial if you don't know how to fix it.

Edit: This topic belongs in the spell forum.
#5
wheres that tutorial? And doenst it simply help to add a condition like this so that the trigger doesnt run all the time?

event - a unit starts the effect of dehydration

actions
set dehydrationboolean equal to true
wait 10 seconds
set dehydrationboolean equal to false

then i just add the condition to the dehydration trigger:

condition - dehydrationboolean equal to true

Does that prevent the memory leaks?
#6
Not completely. And if it's multiplayer, then you'd have to make an array for each player. I'll give an example on the memory leak fix. First, make a unit group variable named tempGroup.
Actions

Set tempGroup = (Units in (Playable map area))

Unit Group - Pick every unit in (tempGroup) and do (If ((Terrain type at (Position of (Picked unit))) Equal to Lordaeron Winter - Rough Dirt) then do (Unit - Remove Dehydration  buff from (Picked unit)) else do (Do nothing)) 

Custom script - call DestroyGroup(udg_tempGroup)

Just copy the custom script exactly.
#7
Thanks! So now the unit group gets destroyed afterwards so that theres no memory leak and i can have the 0.5 second event anyway! Thanks again :P