One of my first advanced triggered spell, is it MUI?

Tastyfish

New Member
Reaction score
2
Hi!

Its been a long time since I posted here and I've secretly worked on a wc3 project for a while now. This is a spell from my little project. I created it after reading a tutorial on dynamic effects (which I read after reading the tutorial on static shapes).

What I want to know is if it is MUI?
I would also like some criticism etc on other parts of the spell!

Spell description:
This spell creates up to 3 "electric balls" circling around you, each one will start at a random position. When a unit is within the balls "aquisition range" it self-detonates and does a certain amount of damage, afterwards the unit is slowed for 5 seconds.

Screenshot 1 (Just the electric "balls" circling the hero):


Screenshot 2 (Enemy unit impact):


Trigger 1:
Code:
Orbital
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to test three 
    Actions
        -------- Checks if Orbital_CustomValue is less then 1000, if not it resets it to 1 --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Orbital_CustomValue Less than 1000
            Then - Actions
                Set Orbital_CustomValue = (Orbital_CustomValue + 1)
            Else - Actions
                Set Orbital_CustomValue = 1
        -------- Setting variables --------
        Set Orbital_DmgRange[Orbital_CustomValue] = 100.00
        Set Orbital_RandomAngle[Orbital_CustomValue] = (Random real number between 0.00 and 360.00)
        Set Orbital_MaxProjectiles[Orbital_CustomValue] = 3
        Set Orbital_ProjectileRange[Orbital_CustomValue] = 200.00
        Set Orbital_Caster[Orbital_CustomValue] = (Triggering unit)
        Set Orbital_CurrentDuration[Orbital_CustomValue] = 0.00
        Set Orbital_MaxDuration[Orbital_CustomValue] = 15.00
        Set Orbital_temppt = (Position of Orbital_Caster[Orbital_CustomValue])
        -------- Check how many projectiles currently are moving, if there is none it creates one for you, --------
        -------- If there are as many as you are allowed too it removes the oldest one and creates a new one --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in Orbital_ProjectilesGroup) Less than Orbital_MaxProjectiles[Orbital_CustomValue]
            Then - Actions
                Unit - Create 1 Electric Ball for (Owner of Orbital_Caster[Orbital_CustomValue]) at (Orbital_temppt offset by Orbital_ProjectileRange[Orbital_CustomValue] towards Orbital_RandomAngle[Orbital_CustomValue] degrees) facing Default building facing degrees
                Unit - Set the custom value of (Last created unit) to Orbital_CustomValue
                Unit Group - Add (Last created unit) to Orbital_ProjectilesGroup
                Set Orbital_ProjectileUnit[Orbital_CustomValue] = (Last created unit)
                Unit - Turn collision for Orbital_ProjectileUnit[Orbital_CustomValue] Off
                Unit - Pause Orbital_ProjectileUnit[Orbital_CustomValue]
            Else - Actions
                Unit - Remove Orbital_ProjectileUnit[(Orbital_CustomValue - Orbital_MaxProjectiles[Orbital_CustomValue])] from the game
                Unit - Create 1 Electric Ball for (Owner of Orbital_Caster[Orbital_CustomValue]) at (Orbital_temppt offset by Orbital_ProjectileRange[Orbital_CustomValue] towards Orbital_RandomAngle[Orbital_CustomValue] degrees) facing Default building facing degrees
                Unit - Set the custom value of (Last created unit) to Orbital_CustomValue
                Unit Group - Add (Last created unit) to Orbital_ProjectilesGroup
                Set Orbital_ProjectileUnit[Orbital_CustomValue] = (Last created unit)
                Unit - Turn collision for Orbital_ProjectileUnit[Orbital_CustomValue] Off
                Unit - Pause Orbital_ProjectileUnit[Orbital_CustomValue]
        Special Effect - Destroy (Last created special effect)
        Custom script:   call RemoveLocation (udg_Orbital_temppt)

Trigger 2:
Code:
Orbital Effect
    Events
        Time - Every 0.04 seconds of game time
    Conditions
        (Number of units in Orbital_ProjectilesGroup) Greater than 0
    Actions
        Unit Group - Pick every unit in Orbital_ProjectilesGroup and do (Actions)
            Loop - Actions
                Set Orbital_tempinteger = (Custom value of (Picked unit))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Orbital_CurrentDuration[Orbital_tempinteger] Greater than or equal to Orbital_MaxDuration[Orbital_tempinteger]
                    Then - Actions
                        Unit - Remove (Picked unit) from the game
                    Else - Actions
                        -------- Check if any enemy unit that is alive is in range and self-detonates if so --------
                        Unit Group - Pick every unit in (Units within Orbital_DmgRange[Orbital_tempinteger] of (Position of Orbital_ProjectileUnit[Orbital_tempinteger]) matching ((((Matching unit) belongs to an enemy of (Owner of Orbital_Caster[Orbital_tempinteger])) Equal to True) and (((Matching unit) is alive)  and do (Actions)
                            Loop - Actions
                                -------- Creates a dummy unit and adds electronic ball explode! to it, then uses it. after the explosion it removes the electric ball and dummy --------
                                Unit - Create 1 dummy for (Owner of Orbital_Caster[Orbital_tempinteger]) at (Position of Orbital_ProjectileUnit[Orbital_tempinteger]) facing Default building facing degrees
                                Set Orbital_DummyCaster[Orbital_tempinteger] = (Last created unit)
                                Unit - Add Electric Ball Explode!  to Orbital_DummyCaster[Orbital_tempinteger]
                                Unit - Order Orbital_DummyCaster[Orbital_tempinteger] to Human Mountain King - Thunder Clap
                                Special Effect - Create a special effect at (Position of Orbital_ProjectileUnit[Orbital_tempinteger]) using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
                                Unit - Remove Orbital_ProjectileUnit[Orbital_tempinteger] from the game
                                Unit - Remove Orbital_DummyCaster[Orbital_tempinteger] from the game
                        -------- Moves the orbital unit --------
                        Unit - Move Orbital_ProjectileUnit[Orbital_tempinteger] instantly to ((Position of Orbital_Caster[Orbital_tempinteger]) offset by Orbital_ProjectileRange[Orbital_tempinteger] towards ((Angle from (Position of Orbital_Caster[Orbital_tempinteger]) to (Position of Orbital_ProjectileUnit[Orbital_tempinteger])) + 5.00) degrees)
                        -------- Sets current duration +0.04 --------
                        Set Orbital_CurrentDuration[Orbital_tempinteger] = (Orbital_CurrentDuration[Orbital_tempinteger] + 0.04)
                        Special Effect - Destroy (Last created special effect)

Only problem I have with it, as it is now is that when you move the balls kindoff "go into eachother", it would be nice if they kept a certain distance.
 

Romek

Super Moderator
Reaction score
964
Well. We can't tell if it's MUI from just screenshots.
It would actually help if we could see the screenshots btw. (Well, I can't see them anyway)
 

Tastyfish

New Member
Reaction score
2
Oh crap sorry!
I thought those images would work but apparently they dont work!
I totally forgot to post the triggers too, I'll edit the main post ASAP.

EDIT:
Fixed it, everything should work now!
I'm sorry, my girlfriend wanted me to play perfect world with her so I stressed out a bit and didn't look at how the post ended up after I posted (which I usually do).
But it should all be fixed now!

EDIT 2:
Btw, I know the tooltip is retarded but its from the first stages of this spell, this isn't what this spell was intended for :p.
 

Flare

Stops copies me!
Reaction score
662
Looks nearly MUI, but there's one thing that gives me the idea that it won't be MUI (even though testing the spell with 2 units should answer that)

Code:
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                [B](Number of units in Orbital_ProjectilesGroup) Less than Orbital_MaxProjectiles[Orbital_CustomValue][/B]
            Then - Actions
                Unit - Create 1 Electric Ball for (Owner of Orbital_Caster[Orbital_CustomValue]) at (Orbital_temppt offset by Orbital_ProjectileRange[Orbital_CustomValue] towards Orbital_RandomAngle[Orbital_CustomValue] degrees) facing Default building facing degrees
                Unit - Set the custom value of (Last created unit) to Orbital_CustomValue
                Unit Group - Add (Last created unit) to Orbital_ProjectilesGroup
                Set Orbital_ProjectileUnit[Orbital_CustomValue] = (Last created unit)
                Unit - Turn collision for Orbital_ProjectileUnit[Orbital_CustomValue] Off
                Unit - Pause Orbital_ProjectileUnit[Orbital_CustomValue]
            Else - Actions
                Unit - Remove Orbital_ProjectileUnit[(Orbital_CustomValue - Orbital_MaxProjectiles[Orbital_CustomValue])] from the game
                Unit - Create 1 Electric Ball for (Owner of Orbital_Caster[Orbital_CustomValue]) at (Orbital_temppt offset by Orbital_ProjectileRange[Orbital_CustomValue] towards Orbital_RandomAngle[Orbital_CustomValue] degrees) facing Default building facing degrees
                Unit - Set the custom value of (Last created unit) to Orbital_CustomValue
                Unit Group - Add (Last created unit) to Orbital_ProjectilesGroup
                Set Orbital_ProjectileUnit[Orbital_CustomValue] = (Last created unit)
                Unit - Turn collision for Orbital_ProjectileUnit[Orbital_CustomValue] Off
                Unit - Pause Orbital_ProjectileUnit[Orbital_CustomValue]
That condition only allows for 3 orbs in the game at any one time (and each cast creates 3, correct?) so if unit A casts, then unit B casts, one of them won't work :p

Code:
Unit Group - Pick every unit in (Units within Orbital_DmgRange[Orbital_tempinteger] of (Position of Orbital_ProjectileUnit[Orbital_tempinteger]) matching
Group leak (Units within...) and point leak (Position of...)
 

Tastyfish

New Member
Reaction score
2
It does keep the amount of orbs to 3 and they make the orbs one at a time.
Do I have to make the unit-group an array for it to be MUI?

How would I fix those leaks?
 

Flare

Stops copies me!
Reaction score
662
To get a limit of 3 orbs, with one orb at a time, it'll be tricky (with GUI at any rate). If I was in your position, I'd probably just make it spawn all 3 at once, and disable the skill in some way for the duration of the spell so you can't summon more than 3

If you had a unit indexing system (like uareanoob's GUI MUI system, or Cohadar's PUI), you could set the number of orbs created by a unit to an array, based on it's custom value e.g.
Code:
Set CurrentOrbs[Custom value of (Triggering Unit) = CurrentOrbs[Custom value of (Triggering Unit)] + 1
then compare that to max orbs, and destroy a previous orb (you'll need more arrays for that, or you can simulate a 2D array and associate it with the caster's custom value - the (Orbital_CustomValue - Orbital_MaxOrbs) will not work, as you may destroy an incorrect orb, assuming that each individual casting of the spell only creates one orb)

If you don't have a unit indexing system then... you're gonna have a hard time getting it to work in the way you described just there :(

Code:
Orbital_temppt offset by Orbital_ProjectileRange[Orbital_CustomValue] towards Orbital_RandomAngle[Orbital_CustomValue] degrees
Another leak - you must set the offset point to a variable i.e.
Code:
Set OffsetPoint = Orbital_temppt offset by Orbital_ProjectileRange[Orbital_CustomValue] towards Orbital_RandomAngle[Orbital_CustomValue] degrees
---Then use OffsetPoint for creating the dummies, and call RemoveLocation (udg_OffsetPoint) when it's not needed---


How would I fix those leaks?
Code:
Set TempPoint = Position of (unit)
Set TempGroup = Units within X range of TempPoint matching bla bla bla
Pick every unit in TempGroup and do action(s):
  ---Actions---
Custom script: call RemoveLocation (udg_TempPoint)
Custom script: call DestroyGroup (udg_TempGroup)
 

Tastyfish

New Member
Reaction score
2
I totally forgot to say that the orbs have a 15 second limit as it is now! Would that help me? ^^,

I don't really understand your description on how to fix the possible MUI problem.
Wouldn't it work if I make a variable/an array where I store each characters own Orbital_ProjectileGroup?
 

Tastyfish

New Member
Reaction score
2
True!
Maybe I should just make them spawn 3 and 3... :D
How would I make them keep a certain distance if I did?
If I am to make all three of them spawn at once I want them to keep a certain distance between them so they don't "mixup" and basicly become one "super orb".

How would I go about it?
 

Tastyfish

New Member
Reaction score
2
I am trying to remake the spell so that it creates 3 orbs but I have run into some troubles.

To make the new orbs replace the old ones if I recast the spell (basiclly refresh the whole spell for its user) I have to locate the player/unit casting the spell, check, somehow if that unit has allready cast the spell.

Its kindoff annoying me at this point, I tried setting a custom value to the unit casting the spell (I think thats the easiest way?) but when i try to compare that custom value to others like the default custom value of the trigger it thinks:
Code:
set Orbital_CV = 1
set Orbital_CasterCV[Orbital_CV] = (Custom value of (triggering unit))

If - Conditions
     Orbital_CasterCV[Orbital_CV] Equal to Orbital_CV
Then - Actions
     Game - Display to (All players) the text: ((String(Orbital_CasterCV[Orbital_CV])) + ( =  + (String(Orbital_CV))))

That echoes 1 = 0 in game...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top