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

Spell: Dehydration

Status
Not open for further replies.
Level 6
Joined
Feb 25, 2005
Messages
230
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? :?:
 
Level 6
Joined
Aug 29, 2004
Messages
159
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
 
Level 6
Joined
Feb 25, 2005
Messages
230
Thanks alot, and yes i also think #2 was best option. I've solved it with the following trigger:

Code:
        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?
 
Level 7
Joined
Aug 5, 2005
Messages
218
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.
 
Level 6
Joined
Feb 25, 2005
Messages
230
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?
 
Level 7
Joined
Aug 5, 2005
Messages
218
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.
Code:
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.
 
Status
Not open for further replies.
Top