Spell Magnetic Orb

Draphoelix

It's not the wintercold that's killing me
Reaction score
132
Forgot to use Spell Prefix >.<

GUI
MUI
Lags at first cast

How to Implement:
Copy all the objects (Mountain King not necessary) then go to Preferances and check the box that says "copy unknown variables". Then copy the spell folder and paste it into you map. To prevent lag, order a unit to cast the spell in the first seconds.

Summon a magnetic orb towards the targeted location. If your Magneticm is positive, the orb will pull nearby units to it and then create a magnetic field that prevents units from getting in or out for 8 seconds. Units inside the field will also suffer 5 damage every second and another 5 damage for each units inside the field. If your magneticm is negative, it will push nearby units from it and then create a magnetic reacton that pulls units whitin 600 range to it and deal 200 damage.

Triggers

Code:
Add
    Events
        Unit - A unit Learns a skill
    Conditions
        (Learned Hero Skill) Equal to Magnetic Orb 
    Actions
        Unit - Add Magneticm  to (Triggering unit)
Code:
Magnetic Field
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Magnetic Orb 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                A_CV Less than 1000
            Then - Actions
                Set A_CV = (A_CV + 1)
            Else - Actions
                Set A_CV = 1
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Level of Magneticm  for (Triggering unit)) Equal to 1
            Then - Actions
                Set Check[A_CV] = 180.00
            Else - Actions
                Set Check[A_CV] = 0.00
        Set Point[A_CV] = (Position of (Triggering unit))
        Set LT[A_CV] = (Target point of ability being cast)
        Set Angle[A_CV] = (Angle from Point[A_CV] to LT[A_CV])
        Set Loc[A_CV] = ((Position of (Triggering unit)) offset by 50.00 towards Angle[A_CV] degrees)
        Unit - Create 1 Pulse for (Owner of (Triggering unit)) at Loc[A_CV] facing Default building facing degrees
        Unit - Set the custom value of (Last created unit) to A_CV
        Unit - Turn collision for (Last created unit) Off
        Set Pulse[A_CV] = (Last created unit)
        Unit Group - Add (Last created unit) to Pulse_Group
Code:
Push
    Events
        Time - Every 0.05 seconds of game time
    Conditions
        (Number of units in Pulse_Group) Greater than 0
    Actions
        Unit Group - Pick every unit in Pulse_Group and do (Actions)
            Loop - Actions
                Set A_CV2 = (Custom value of (Picked unit))
                Set Loc1[A_CV2] = (Position of Pulse[A_CV2])
                Set Loc2[A_CV2] = (Loc1[A_CV2] offset by 20.00 towards Angle[A_CV2] degrees)
                Unit - Move Pulse[A_CV2] instantly to Loc2[A_CV2]
                Set Pulse_Group2 = (Units within 300.00 of Loc1[A_CV2] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of Pulse[A_CV2])) Equal to True) and (((Matching unit) is alive) Equal to True))))
                Unit Group - Pick every unit in Pulse_Group2 and do (Actions)
                    Loop - Actions
                        Unit - Turn collision for (Picked unit) Off
                        Set Pulse_Loc[A_CV2] = (Position of (Picked unit))
                        Set Pulse_Loc2[A_CV2] = (Pulse_Loc[A_CV2] offset by 20.00 towards ((Angle from Loc1[A_CV2] to Pulse_Loc[A_CV2]) - Check[A_CV2]) degrees)
                        Unit - Move (Picked unit) instantly to Pulse_Loc2[A_CV2]
                        Custom script:   call RemoveLocation(udg_Pulse_Loc[udg_A_CV2])
                        Custom script:   call RemoveLocation(udg_Pulse_Loc2[udg_A_CV2])
                        Unit - Turn collision for (Picked unit) On
                Custom script:   call DestroyGroup(udg_Pulse_Group2)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Distance between Loc1[A_CV2] and LT[A_CV2]) Less than or equal to 70.00
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Check[A_CV2] Equal to 180.00
                            Then - Actions
                                Unit - Create 1 Field for (Owner of Pulse[A_CV2]) at Loc2[A_CV2] facing Default building facing degrees
                                Unit - Add a 8.00 second Generic expiration timer to (Last created unit)
                                Unit - Add DPS  to (Last created unit)
                                Set Pulse_Group2 = (Units within 250.00 of Loc1[A_CV2] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of Pulse[A_CV2])) Equal to True) and (((Matching unit) is alive) Equal to True))))
                                Unit - Set level of DPS  for (Last created unit) to (Number of units in Pulse_Group2)
                                Unit Group - Pick every unit in Pulse_Group2 and do (Actions)
                                    Loop - Actions
                                        Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike (Picked unit)
                                Animation - Change (Last created unit)'s animation speed to 20.00% of its original speed
                                For each (Integer A) from 1 to 24, do (Actions)
                                    Loop - Actions
                                        Set Degrees[A_CV2] = (Degrees[A_CV2] + 15.00)
                                        Set LT[A_CV2] = (Loc2[A_CV2] offset by 300.00 towards Degrees[A_CV2] degrees)
                                        Unit - Create 1 Dummy for (Owner of Pulse[A_CV2]) at LT[A_CV2] facing (Angle from Loc2[A_CV2] to LT[A_CV2]) degrees
                                        Unit - Add a 8.00 second Generic expiration timer to (Last created unit)
                                        Unit - Turn collision for (Last created unit) Off
                                        Environment - Set terrain pathing at LT[A_CV2] of type Walkability to Off
                                Custom script:   call RemoveLocation(udg_LT[udg_A_CV2])
                                Custom script:   call DestroyGroup(udg_Pulse_Group2)
                                Unit - Kill Pulse[A_CV2]
                                Unit Group - Remove Pulse[A_CV2] from Pulse_Group
                            Else - Actions
                                Set Pulse_Group2 = (Units within 600.00 of Loc1[A_CV2] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of Pulse[A_CV2])) Equal to True) and (((Matching unit) is alive) Equal to True))))
                                Unit Group - Pick every unit in Pulse_Group2 and do (Actions)
                                    Loop - Actions
                                        Unit - Turn collision for (Picked unit) Off
                                        Unit - Move (Picked unit) instantly to Loc2[A_CV2]
                                        Unit - Cause Pulse[A_CV2] to damage (Picked unit), dealing 200.00 damage of attack type Spells and damage type Normal
                                        Special Effect - Create a special effect at Loc2[A_CV2] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
                                        Special Effect - Destroy (Last created special effect)
                                        Unit - Kill Pulse[A_CV2]
                                        Unit Group - Remove Pulse[A_CV2] from Pulse_Group
                                        Unit - Turn collision for (Picked unit) On
                                Custom script:   call DestroyGroup(udg_Pulse_Group2)
                                Custom script:   call RemoveLocation(udg_LT[udg_A_CV2])
                                Custom script:   call RemoveLocation(udg_Loc2[udg_A_CV2])
                    Else - Actions
                Custom script:   call RemoveLocation(udg_Loc1[udg_A_CV2])
                Custom script:   call RemoveLocation(udg_Loc2[udg_A_CV2])
Code:
Toggle
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Magneticm 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Level of Magneticm  for (Triggering unit)) Equal to 1
            Then - Actions
                Unit - Increase level of Magneticm  for (Triggering unit)
            Else - Actions
                Unit - Decrease level of Magneticm  for (Triggering unit)
Code:
Walk
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Triggering unit)) Equal to Dummy
    Actions
        Set Die_Loc = (Position of (Triggering unit))
        Environment - Set terrain pathing at Die_Loc of type Walkability to On
        Custom script:   call RemoveLocation(udg_Die_Loc)

Screenshots
Pulling units
apositive1yv4.png

The magnetic field
apositive3gk2.png

Pushing units
apositive1gw6.png

Magnetic reaction
apositive2ud1.png
 

Attachments

  • Magnetic Thing.w3x
    31 KB · Views: 267
Reaction score
86
Spelling please ;D Also, is it the spell that lags or the special fx? Put a readme in the post about how you can pre-place certain objects/skills/fx to make it lag less. Also, talk about implementation. Other than that... Looks nice :D
 

Draphoelix

It's not the wintercold that's killing me
Reaction score
132
Only the Magnetic Field lags, I've tried to preplace the objects in it but didn't work. Right now I order the unit to cast it in the first seconds.
 

Flare

Stops copies me!
Reaction score
662
Looks fun from the screenshots - must test it out :D

One problem I can immediately see from the code (haven't looked at it very thoroughly) - arrayed locations. They're fine for things like
Code:
Set Point[1] = ...
Set Point[2] = Point[1] offset by...

But using them like you did (i.e. 2 separate arrayed variables) for sliding, and using a variable to reference the arrays... it's not needed at all and just adds to the work since you have to remove leaks using the variable (when you could just be typing [1] or [2], or even no array index if you're using 2 separate variables). But, what's done is done and there's no point altering it now since that's just extra work, but it's worth remembering for future reference

There are few situations (with regards to spell-making) where you need an arrayed location variable (unless you're sliding towards a specific point, but that can be worked around using a real variable to calculate distance travelled) and sliding certainly isn't one of them (unless you only want one variable to deal with the sliding)

(Can't rep you just yet)
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
Preload the abilities to remove the lag at first cast.
Other than that: awesome screenshots/features for a GUI spell.

+R
 

Sivert

New Member
Reaction score
0
One little thing: when you target right in front the mk while the magneticthing is negative, the orb keeps going until its out of the map.
 

Draphoelix

It's not the wintercold that's killing me
Reaction score
132
Fixed that sivert.

And Flare, do you mean instead of

Code:
                        Set Pulse_Loc[A_CV2] = (Position of (Picked unit))
                        Set Pulse_Loc2[A_CV2] = (Pulse_Loc[A_CV2] offset by 20.00 towards ((Angle from Loc1[A_CV2]

I could have done
Code:
                        Set Pulse_Loc[1] = (Position of (Picked unit))
                        Set Pulse_Loc[2] = (Pulse_Loc[1] offset by 20.00 towards ((Angle from Loc1[A_CV2]

And fixed that buff, I think the color melts in pretty well with the field and the surrounding greenish things. And also you want to know how much damage you dealt (too lazy with floating text \o/ )
 

Draphoelix

It's not the wintercold that's killing me
Reaction score
132
Ye, that's what I meant.
So it will still be MUI? But don't you have to destroy it twice still?

call RemoveLocation(udg_Point[1]
call RemoveLocation(udg_Point[2]

And you could just make a single floating text at the centre of the AoE to show how much is being done

Lazyness is my excuse
 

Flare

Stops copies me!
Reaction score
662
You're gonna have to destroy both points whatever way you do it (unless you want to do some JASS, which could cut it down to none :p)

And yes, it'll still be MUI - the loop will go through all of the actions for a specific unit before moving on. If you are creating, using and destroying the point (in that order) within the loop, you are fine
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top