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

Another spell problems (region bugs)

Status
Not open for further replies.
Level 9
Joined
Aug 28, 2005
Messages
271
I've created a spell which does damage depending on how long have the target stayed not moving. For every second it does 100 damage(3 seconds 300 dmage and so on).The damage is amplified after the target moves(I detect this with very small region which i place on the position on tha terget at the begining of the spell.)If the target stays more than 5 seconds without moving the spell is cancelled. Increasing the level of the ability increase the possible max damage. The problem is that the ability is not working at all. I think that the problem is that the region is not placed on the target's
position(it is preplaced somewhere in the trees) Here are the triggers:

The first starts the timer which detects the time and initializes the spell
  • soul rip time init
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Soul Rip
    • Actions
      • Set soulriptarget = (Target unit of ability being cast)
      • Set soulriptimer = 0
      • Trigger - Turn on soul rip timer incr <gen>
      • Region - Center soul rip place <gen> on (Position of soulriptarget)
      • Wait 7.00 game-time seconds
      • Set soulriptimer = 600
      • Trigger - Turn off soul rip timer incr <gen>

The timer
  • soul rip timer incr
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set soulriptimer = (soulriptimer + 1)
The spell damage dealer
  • soul rip
    • Events
      • Unit - A unit leaves soul rip place <gen>
    • Conditions
      • (Leaving unit) Equal to soulriptarget
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • soulriptimer Equal to 0
        • Then - Actions
          • Unit Group - Pick every unit in (Units of type Forest Witch) and do (Unit - Cause (Picked unit) to damage soulriptarget, dealing 100.00 damage of attack type Spells and damage type Normal)
          • Special Effect - Create a special effect attached to the overhead of soulriptarget using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
          • Wait 6.00 game-time seconds
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • soulriptimer Less than 6
            • Then - Actions
              • Unit Group - Pick every unit in (Units of type Forest Witch) and do (If (soulriptimer Less than or equal to ((Level of Soul Rip for (Picked unit)) + 1)) then do (Unit - Cause (Picked unit) to damage soulriptarget, dealing (100.00 x (Real(soulriptimer))) damage of attack type Spells and damage type Normal) else do (Unit - Cau
              • Special Effect - Create a special effect attached to the overhead of soulriptarget using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
              • Wait 6.00 game-time seconds
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
      • Region - Center soul rip place <gen> on (Point(-900.00, -1900.00))
      • Set soulriptarget = No unit
      • Set soulriptimer = 600
 
Level 6
Joined
Mar 2, 2006
Messages
306
short answer to your problem: don't move regions arround! it doesn't work as you might expect. find another way.

----- ----- -----

somewhat longer answer:
the thing is that the events (those that you place under red flags) get registrated at the map initialization. so "Unit - A unit leaves soul rip place <gen>" gets registrated as "Unit - A unit leaves Rect(123,12,234,123)"...

so, you move the region around but the event remains what it is - constant. the fact that the region is no longer there is ignored.

now, do you remember when i said "...events (those that you place under red flags) get registrated..."? does that mean that there is another way to create events? yes. you can also create events on-the-fly using Add Event to Trigger action. learn that and you might even fix the triggers some day...

------------------------------------------------------------------------

in the other news, rest of the trigger also shows signs of inexperience. on these three actions:
  • Special Effect - Create a special effect ...
  • Wait 6.00 game-time seconds
  • Special Effect - Destroy (Last created special effect)
How can you be sure that the effect will after 6s still be last created special effect? it usually won't be. use a variable to store it before the wait.


also, each of these three rows leaks memory. learn about that in other places...
  • Region - Center soul rip place <gen> on (Position of soulriptarget)
  • Unit Group - Pick every unit in (Units of type Forest Witch) and do...
  • Region - Center soul rip place <gen> on (Point(-900.00, -1900.00))
happy mapmaking...
 
Status
Not open for further replies.
Top