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

Morphing Ray v0.01

  • Like
Reactions: Barade
Morphing Ray spell.
Made by G00dG4m3.

Channels (And really, CHANNELS) a stream of mana to target, turning it into a sheep (bahhhaha) and dealing % of its
max life as damage to it.

Please read the trigger comments above the triggers in the Trigger Editor

Give me credits if you use it in your map.


  • Morphing Ray Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Morphing Ray
    • Actions
      • -------- Stores caster and target into variables --------
      • -------- NOTE 1: Caster is stored only because it's easier to write the script, not searching for Triggering Unit --------
      • Set Caster = (Triggering unit)
      • Set Target = (Target unit of ability being cast)
      • -------- Finds the Caster's location --------
      • -------- NOTE 2: Will be used later for start-end points of the lightning we will create --------
      • Set Points[1] = (Position of Caster)
      • -------- Counts the damage dealt to target --------
      • -------- NOTE 3: Make your countings here --------
      • Set Real[1] = (0.01 x (Real((Level of Morphing Ray for Caster))))
      • Set Real[1] = ((Max life of Target) x Real[1])
      • -------- NOTE 4: All the counted damage MUST be multiplied by 0.03 (or divided into 33.3) --------
      • -------- It is a MUST, because all ticks of damage will be dealt at interval of 0.03 --------
      • -------- We don't want to deal 800*.05=40 damage per 0.03 or 40/0.03=1333.(3) per second, do we? --------
      • Set Real[1] = (Real[1] x 0.03)
      • -------- Counts the duration of the Spell --------
      • -------- NOTE 5: Count your duration here --------
      • -------- NOTE 6: This must be equal to follow through time for each level --------
      • Set Real[2] = (1.00 + (Real((Level of Morphing Ray for Caster))))
      • -------- Stores all information to the Hashtable --------
      • -------- NOTE 7: It is made to be easier to interupt the channeled effect through effect --------
      • -------- NOTE 8: Never, EVER, make spells w/ hashtables which is casted by CASTER and all information is attached to TARGET, cause it will get bugged! A LOT! --------
      • Hashtable - Save Handle OfTarget as 0 of (Key (Triggering unit)) in Hashtable
      • Hashtable - Save Real[1] as 1 of (Key (Triggering unit)) in Hashtable
      • Hashtable - Save Real[2] as 2 of (Key (Triggering unit)) in Hashtable
      • -------- NOTE 9: Lightning is created here, as I didn't want to waste an action for storing da lightning to da variable --------
      • -------- NOTE 10: Change your lighting type here --------
      • Lightning - Create a Drain Mana lightning effect from source Points[1] to target Points[1]
      • Hashtable - Save Handle Of(Last created lightning effect) as 3 of (Key (Triggering unit)) in Hashtable
      • -------- Checks if there is any instance of spell already in on --------
      • -------- If not, turns the Channeled effect trigger on --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (RayCasters is empty) Equal to True
        • Then - Actions
          • Trigger - Turn on Morphing Ray Channel <gen>
        • Else - Actions
      • -------- Adds the Caster/Target SFX abilities to the Caster/Target. Obvious, isn't it? --------
      • Unit - Add SFX Caster to Caster
      • Unit - Add SFX Target to Target
      • -------- 'Sheeps' target --------
      • Unit - Create 1 Dummy Caster for (Owner of Caster) at Points[1] facing Default building facing degrees
      • Unit - Add Polymorph to (Last created unit)
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Human Sorceress - Polymorph Target
      • -------- Adds caster to the Channelers' group --------
      • Unit Group - Add Caster to RayCasters
      • -------- Fixes the Leak --------
      • Custom script: call RemoveLocation(udg_Points[1])
  • Morphing Ray Channel
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in RayCasters and do (Actions)
        • Loop - Actions
          • -------- Stores Caster/Target into variables --------
          • Set Caster = (Picked unit)
          • Set Target = (Load 0 of (Key (Picked unit)) in Hashtable)
          • -------- Finds locations of Caster/Target --------
          • -------- These locations will be used to check the distance between the Duo and move lighting if possible --------
          • Set Points[1] = (Position of Caster)
          • Set Points[2] = (Position of Target)
          • -------- Loads the Tick's damage --------
          • Set Real[1] = (Load 1 of (Key (Picked unit)) from Hashtable)
          • -------- Loads the duration left and reduces it by Tick interval --------
          • -------- NOTE 1: It MUST be equal to the interval of this Trigger, as stated above --------
          • Set Real[2] = (Load 2 of (Key (Picked unit)) from Hashtable)
          • Set Real[2] = (Real[2] - 0.03)
          • -------- Loads the Lighting effect --------
          • Set Lightning = (Load 3 of (Key (Picked unit)) in Hashtable)
          • -------- Finds the Heights into which our lightning's start-end will be rised --------
          • Custom script: set udg_Real[3] = GetLocationZ(udg_Points[1])
          • Custom script: set udg_Real[4] = GetLocationZ(udg_Points[2])
          • Set Real[3] = (Real[3] + ((Current flying height of Caster) + 55.00))
          • Set Real[4] = (Real[4] + ((Current flying height of Target) + 20.00))
          • -------- If everyone in the Duo is alive, timer hasn't expired and range between the Duo isn't too big... --------
          • -------- NOTE 2: Change your max channel range in the conditions --------
          • -------- NOTE 3: if you want it be infinite, write a huge number --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between Points[1] and Points[2]) Less than or equal to 800.00
              • Real[2] Greater than 0.00
              • (Caster is alive) Equal to True
              • (Target is alive) Equal to True
            • Then - Actions
              • -------- Then... --------
              • -------- Moves lightning --------
              • Custom script: call MoveLightningEx(udg_Lightning, true, GetLocationX(udg_Points[2]), GetLocationY(udg_Points[2]), udg_Real[4], GetLocationX(udg_Points[1]), GetLocationY(udg_Points[1]), udg_Real[3])
              • -------- Causes caster to damage target --------
              • Unit - Cause Caster to damage Target, dealing Real[1] damage of attack type Spells and damage type Normal
              • -------- Updates the time left in the timer --------
              • Hashtable - Save Real[2] as 2 of (Key (Picked unit)) in Hashtable
            • Else - Actions
              • -------- Else... --------
              • -------- Removes SFX abilities from the Duo --------
              • Unit - Remove SFX Caster from Caster
              • Unit - Remove SFX Target from Target
              • -------- Removes the Transformation buff from Target. Well, if it is not dead yet --------
              • Unit - Remove Morphing Ray buff from Target
              • -------- Destroys the lightning --------
              • Lightning - Destroy Lightning
              • -------- Clears the Hashtable --------
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
              • -------- Removes Caster from the Channelers' group --------
              • Unit Group - Remove Caster from RayCasters
              • -------- Orders the Caster to hold position. Well, if it is not dead yet --------
              • Unit - Order Caster to Hold Position
          • -------- Clears the leaks --------
          • Custom script: call RemoveLocation(udg_Points[1])
          • Custom script: call RemoveLocation(udg_Points[2])
      • -------- Checks if there is any instance of spell left after loop --------
      • -------- If not, turns this trigger off --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (RayCasters is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • Morphing Ray Interupt
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Morphing Ray
    • Actions
      • -------- Stores our Duo into variables --------
      • Set Caster = (Triggering unit)
      • Set Target = (Load 0 of (Key (Triggering unit)) in Hashtable)
      • -------- Stores the Lightning into variable --------
      • Set Lightning = (Load 3 of (Key (Triggering unit)) in Hashtable)
      • -------- Clears the Hashtable, as we won't need anything anymore --------
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in Hashtable
      • -------- Removes caster from channelers' group --------
      • Unit Group - Remove (Triggering unit) from RayCasters
      • -------- Removes SFX abilities from the Duo --------
      • Unit - Remove SFX Caster from Caster
      • Unit - Remove SFX Target from Target
      • -------- Removes the Transformation buff from the Target --------
      • Unit - Remove Morphing Ray buff from Target
      • -------- Destroys the Lightning --------
      • Lightning - Destroy Lightning


v0.01 - First Upload


Keywords:
Channel, ray, mana, sheep, morph, polymorph, damage, %, percent, health
Contents

Morphing Ray v0.01 (Map)

Reviews
15:59, 11th Sep 2010 TriggerHappy: Looked fine and was leakless.

Moderator

M

Moderator

15:59, 11th Sep 2010
TriggerHappy:

Looked fine and was leakless.
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
Creating the SFX on their chest/origin or else where but not on their location will maintain the effect as long as it is not destroyed, so the "SFX Abilities" are kinda useless.

As the tooltip above says "channels a stream of mana" maybe you could do it to actually drain a portion of the targets' mana and then deal the drained mana + % of Intelligence or whatever you want. This way it will much it's tool, cause I really don't see how the beam will turn them into sheeps.

Also you could do this call AddLightningEx ("ModelName", true, x1, y1, z1, x2, y2, z2)
Instead of putting it in a location.

4/5 for originality and clean code again.
 
Level 9
Joined
Oct 31, 2009
Messages
121
"channels a stream of mana"
actually, description says channels a stream of mana AT TARGET.
this can also be seen as the lightning effect moves from caster to target, meaning you lose mana for the effect.
SFXes are easier to remove when they are in abilities, as you don't have to store it into hashtable/variable to destroy'em, but simply remove them, not to mention that I'd have to waste a pair of actions, like create sfx, then store it into hashtable, and only then repeat with the second one.

Also, I'd like that you actually rated this spell at the line above :)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You should rethink where this check should be made:
  • (RayCasters is empty) Equal to True
Yes, there is the "stops casting" trigger to worry about too. You could add the check there too. But it's not that serious, just small optimization IMO.

G00dG4m3 said:
NOTE 8: Never, EVER, make spells w/ hashtables which is casted by CASTER and all information is attached to TARGET, cause it will get bugged! A LOT!

Untrue.
 
Level 9
Joined
Oct 31, 2009
Messages
121
You should rethink where this check should be made:
  • (RayCasters is empty) Equal to True
Erm... If you do a loop with empty group, nothing really hapens, does it? After removing caster from casters' group, next loop will have no effect but turning off the Loop trigger.


Oh really? it is Hashtable-specific stuff. and by saying that, I ment spells where different stuff is attached to same slots, like in one spell 0 is target (like in this spell) and another spell's 0 - real number (cast by self). If this spell is casted during effect of another spell, and all information is seriously attached to THIS spell's target and another spell's caster (I.E. our caster), this would bugg, wouldn't it?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Erm... If you do a loop with empty group, nothing really hapens, does it? After removing caster from casters' group, next loop will have no effect but turning off the Loop trigger.

Well, let me begin by saying that it's not a big deal.

But the check is made every 0.03 seconds if it's at the end of the trigger as long as the trigger is on. If it's on for one secon, the check is done 33 times.

But if you move it to after you remove the caster from the group, it will run only once per caster.

Oh really? it is Hashtable-specific stuff. and by saying that, I ment spells where different stuff is attached to same slots, like in one spell 0 is target (like in this spell) and another spell's 0 - real number (cast by self). If this spell is casted during effect of another spell, and all information is seriously attached to THIS spell's target and another spell's caster (I.E. our caster), this would bugg, wouldn't it?

Sure, if you overwrite keys it will bug. But that's a user error, not the fault of hashtables. You can use strings as keys instead of integers, or different hashtable for different spells.
 
Level 9
Joined
Oct 31, 2009
Messages
121
Well, then I'd have to make a second looping trigger, which would run once a second and make the check, but it is faster to turn this off at the loop of the trigger IMO. It wouldn't waste .03 second loops until the next check, if there is no action made.


Maybe you're right, but then user would have to make a quite piece of job to make it working.
 
Top