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

Problem with my spell

Status
Not open for further replies.
Level 6
Joined
Jul 22, 2009
Messages
214
Juste for exemple this is the spell when it's level 3:The Priestress absorb 4x her inteligence hit point to each enemy in a range of 550 and she redistribute it between all friendly unit around her.

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Divine Intervention (priestress spell)
  • Actions
    • -------- I set some variable --------
    • Set CasterTEMP = (Casting unit)
    • Set PointTEMP = (Position of CasterTEMP)
    • Set PlayerTEMP = (Owner of CasterTEMP)
    • Set InteligenceTEMP = (Intelligence of CasterTEMP (Include bonuses))
    • Set SkillLevelTEMP = (Level of Divine Intervention (priestress spell) for CasterTEMP)
    • -------- The radius depend on skill level --------
    • Set RadiusTEMP = (100.00 x (Real(SkillLevelTEMP)))
    • Set RadiusTEMP = (RadiusTEMP + 250.00)
    • -------- The damage depend on skill lvl and inteligence --------
    • Set DamageTEMP = ((Real(SkillLevelTEMP)) + 1.00)
    • Set DamageTEMP = (DamageTEMP x (Real(InteligenceTEMP)))
    • -------- I set the enemy unit in a group --------
    • Set UnitGroupTEMP = (Units within RadiusTEMP of PointTEMP matching (((Owner of (Matching unit)) is an enemy of PlayerTEMP) Equal to True))
    • -------- Calcul how many unit in the group(used later) --------
    • Set UnitQtyTEMP[1] = (Number of units in UnitGroupTEMP)
    • Unit Group - Pick every unit in UnitGroupTEMP and do (Actions)
      • Loop - Actions
        • -------- Deal the damage based on value calculed before --------
        • Unit - Cause CasterTEMP to damage (Picked unit), dealing DamageTEMP damage of attack type Hero and damage type Normal
    • -------- Destroy group(i d'ont know if it's usefull here) --------
    • Custom script: call DestroyGroup(udg_UnitGroupTEMP)
    • -------- calcul how much damage in total was dealed to enemies --------
    • Set DamageTEMP = (DamageTEMP x (Real(UnitQtyTEMP[1])))
    • -------- I set the friendly unit in a group --------
    • Set UnitGroupTEMP = (Units within RadiusTEMP of PointTEMP matching (((Owner of (Matching unit)) is an ally of PlayerTEMP) Equal to True))
    • -------- Calcul how many unit in the group --------
    • Set UnitQtyTEMP[2] = (Number of units in UnitGroupTEMP)
    • -------- calcul the total damage dealt to enemies/number of friendly unit --------
    • Set DamageTEMP = (DamageTEMP / (Real(UnitQtyTEMP[2])))
    • Set DamageTEMPinteger = (Integer(DamageTEMP))
    • Unit Group - Pick every unit in UnitGroupTEMP and do (Actions)
      • Loop - Actions
        • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + DamageTEMP)
        • Floating Text - Create floating text that reads (String(DamageTEMPinteger)) above (Picked unit) with Z offset 64.00, using font size 12.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
        • Set FloatingTextTEMP = (Last created floating text)
        • Floating Text - Set the velocity of FloatingTextTEMP to 60.00 towards 90.00 degrees
        • Floating Text - Change FloatingTextTEMP: Disable permanence
        • Floating Text - Change the lifespan of FloatingTextTEMP to 2.00 seconds
        • Floating Text - Change the fading age of FloatingTextTEMP to 1.70 seconds
        • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Orc\HealingWave\HealingWaveTarget.mdl
    • Custom script: call DestroyGroup(udg_UnitGroupTEMP)
    • Custom script: call RemoveLocation(udg_PointTEMP)
What bad with this is when i cast it and there's no longer enemy it's heal the friendly unit. But only if i've casted it normaly(with enemy) before. Need help with this.

EDIT: I've upload the map if it can help you
 

Attachments

  • Problem.w3x
    22.2 KB · Views: 41
Level 33
Joined
Mar 27, 2008
Messages
8,035
Maybe you destroyed your UnitGroupTEMP too early ?
Try put it at most bottom ?
At:
  • Unit Group - Pick every unit in UnitGroupTEMP and do (Actions)
    • Loop - Actions
    • -------- Deal the damage based on value calculed before --------
    • Unit - Cause CasterTEMP to damage (Picked unit), dealing DamageTEMP damage of attack type Hero and damage type Normal
    • -------- Destroy group(i d'ont know if it's usefull here) --------
    • Custom script: call DestroyGroup(udg_UnitGroupTEMP)
You can remove the Custom script because you will destroy it at the most bottom of your trigger, it seems you put 2 of this action
Here:
  • Custom script: call DestroyGroup(udg_UnitGroupTEMP)
  • Custom script: call RemoveLocation(udg_PointTEMP)
 
Level 5
Joined
Nov 30, 2010
Messages
184
I suggest you add more clean up actions at the end of the trigger (set all variables to default (0) or destroy them). This way you can free some memory and if the problem persists, you know that variables aren't causing it
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Disregard the other posts in this thread.

--

The problem isn't that it remembers old values if there are no enemies, it's that it doesn't check whether allies/enemies in the groups are dead or not. Modify the filters from:

(((Owner of (Matching unit)) is an enemy of PlayerTEMP) Equal to True))

(or the equivalent Ally version)

to:

((((Owner of (Matching unit)) is an enemy of PlayerTEMP) Equal to True)) And (((Matching Unit) is alive) Equal to True))

(and the equivalent Ally version).

--

Leakwise you're mostly fine (points and groups are good, but you don't destroy the special effects).
 
Status
Not open for further replies.
Top