Triggered lightning shield graphic

averes

New Member
Reaction score
17
If this should go in the JASS forum then sorry about that, but regardless, I'm trying to make a "lightning shield graphic" where the orbs rotate through triggers so that I can increase/decrease the speed of rotation. I know how to make a single object rotate around something, but I'm drawing a blank as to how to get 3 objects rotate around a unit that make it look like a lightning shield (even distance, ect)
 

noworries

New Member
Reaction score
4
Alright, I didn't know if you wanted this multi unit, or multi player, or what, so what I wrote up I believe is multi-player instanced, meaning each player can use it at the same time. At least, it works in single player!

So, two triggers total, 5 variables.

First Trigger.

Code:
Start Cast
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Slam (Neutral Hostile)
    Actions
        Set unit_RotateAround[(Player number of (Owner of (Casting unit)))] = (Casting unit)
        Set LightningShieldOn[(Player number of (Owner of (Casting unit)))] = True
        Set tempPoint = (Position of (Casting unit))
        Unit - Create 1 Wisp for (Owner of (Casting unit)) at (tempPoint offset by 50.00 towards 0.00 degrees) facing Default building facing degrees
        Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
        Set unit_WispRotation[((Player number of (Owner of (Casting unit))) + 12)] = (Last created unit)
        Set real_WispRotation[((Player number of (Owner of (Casting unit))) + 12)] = 1.00
        Unit - Create 1 Wisp for (Owner of (Casting unit)) at (tempPoint offset by 50.00 towards 120.00 degrees) facing Default building facing degrees
        Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
        Set unit_WispRotation[((Player number of (Owner of (Casting unit))) + 25)] = (Last created unit)
        Set real_WispRotation[((Player number of (Owner of (Casting unit))) + 25)] = 121.00
        Unit - Create 1 Wisp for (Owner of (Casting unit)) at (tempPoint offset by 50.00 towards 240.00 degrees) facing Default building facing degrees
        Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
        Set unit_WispRotation[((Player number of (Owner of (Casting unit))) + 37)] = (Last created unit)
        Set real_WispRotation[((Player number of (Owner of (Casting unit))) + 37)] = 241.00
        Custom script:   call RemoveLocation( udg_tempPoint )

I chose to use wisps to rotate around, I saved them as the player number + 12/25/37 because those numbers can't be repeated with adding player numbers to them(i think.) Also, they start out at 0/120/240 because thats the same as 120/240/360(which is 360 divided by 3)

Next trigger..

Code:
Rotation
    Events
        Time - Every 0.03 seconds of game time
    Conditions
        (Number of units in (Units of type Wisp)) Greater than 0
    Actions
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        LightningShieldOn[(Integer A)] Equal to True
                    Then - Actions
                        Set tempPoint = (Position of unit_RotateAround[(Integer A)])
                        Unit - Move unit_WispRotation[((Integer A) + 12)] instantly to (tempPoint offset by 50.00 towards real_WispRotation[((Integer A) + 12)] degrees), facing Default building facing degrees
                        Set real_WispRotation[((Integer A) + 12)] = (real_WispRotation[((Integer A) + 12)] + 3.00)
                        Unit - Move unit_WispRotation[((Integer A) + 25)] instantly to (tempPoint offset by 50.00 towards real_WispRotation[((Integer A) + 25)] degrees), facing Default building facing degrees
                        Set real_WispRotation[((Integer A) + 25)] = (real_WispRotation[((Integer A) + 13)] + 3.00)
                        Unit - Move unit_WispRotation[((Integer A) + 37)] instantly to (tempPoint offset by 50.00 towards real_WispRotation[((Integer A) + 37)] degrees), facing Default building facing degrees
                        Set real_WispRotation[((Integer A) + 37)] = (real_WispRotation[((Integer A) + 37)] + 3.00)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                real_WispRotation[((Integer A) + 12)] Greater than or equal to 359.00
                            Then - Actions
                                Set real_WispRotation[((Integer A) + 12)] = 0.00
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                real_WispRotation[((Integer A) + 25)] Greater than or equal to 359.00
                            Then - Actions
                                Set real_WispRotation[((Integer A) + 25)] = 0.00
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                real_WispRotation[((Integer A) + 37)] Greater than or equal to 359.00
                            Then - Actions
                                Set real_WispRotation[((Integer A) + 37)] = 0.00
                            Else - Actions
                        Custom script:   call RemoveLocation( udg_tempPoint )
                    Else - Actions

Condition to check if at least 1 wisp exists, no reason for it to run when no one is using the ability.

Int 1-12 is for the player numbers, if their boolean is set to true, it will run, basically moves the wisps with Integer A +12/25/37 to their position around the hero +3(you can change.)

If their position becomes greater than 359, its reset to 0.

hope this helps.
 

averes

New Member
Reaction score
17
This helps alot! Thanks! My only question is how could I go about changing the speed at which the wisps move?
 

Flare

Stops copies me!
Reaction score
662
Code:
                        Set real_WispRotation[((Integer A) + 37)] = (real_WispRotation[((Integer A) + 37)] + 3.00)

Change the 3.00. 360*0.03 would give you a full revolution every second.

Also, noworries' trigger leaks locations (point offset by X towards Y takes 1 location (source location) and gives back the end location. noworries only set source location to a variable and cleared it)
 

averes

New Member
Reaction score
17
Code:
                        Set real_WispRotation[((Integer A) + 37)] = (real_WispRotation[((Integer A) + 37)] + 3.00)

Change the 3.00. 360*0.03 would give you a full revolution every second.

Also, noworries' trigger leaks locations (point offset by X towards Y takes 1 location (source location) and gives back the end location. noworries only set source location to a variable and cleared it)

But wouldn't doing that make it only possible to change the speed at the creation of it? What if I wanted it to speed up/slow down after being created.
 

averes

New Member
Reaction score
17
Isn't the .03 periodic timer what states how fast it moves? Are you able to change a trigger event on the fly?
 

averes

New Member
Reaction score
17
Effectively as in not possible? Or just difficult. The main point is being able to speed up or slow down the spinning while its up, otherwise I'd just use a normal lightning shield graphic :/.
 

noworries

New Member
Reaction score
4
You can change the speed to make it go slower, or faster, as he said, by changing the value in that line.

The only problem is making it look natural, once you get over a certain value of the number, it will be look unnatural.

With 3 units spaced out 120 degrees apart, it still looks natural and fast if you set the numbers to 20.

However, if you were to set it to 70, you'd get images from where the units would be, and if you did 120 the units wouldn't appear to rotate at all.


If you want your speed to go up/down after creation, simply replace the amount that is added with a variable. Rather than it being 3, or 20, or whatever, just have it so its.


Set real_WispRotation[((Integer A) + 37)] = (real_WispRotation[((Integer A) + 37)] + RotateAmount)

or something. Then, when you change the RotateAmount, the period trigger will update and move faster or slower.
 

averes

New Member
Reaction score
17
Alright, thanks! Last question is could this be modified to work with many units per player? Such as if each player had X of these? I can just store the rotation speed of each wisp in there custom value but currently it seems this would be setup for multiple players, but only 1 use per player.
 

noworries

New Member
Reaction score
4
Well, I went ahead and tried to make it MUI, which I suppose it is. Up to 999 units using it, I think, which isn't technically MUI, since hypothetically there could be more than 999 units who could use an ability, but it recycles the unused ones, so if slot 3 becomes available but you're at 55, it will use 3 instead of going up to 56, so, I think it should be enough, and you could even come down if you wanted. As for custom speeds, you'll have to come up with that yourself.

Code:
Start Cast Copy
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Slam (Neutral Hostile)
    Actions
        Set LightningShieldOn = True
        For each (Integer A) from 1 to int_CurrentRotations, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        LightningShieldOn Equal to True
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                unit_RotateAround[(Integer A)] Equal to No unit
                            Then - Actions
                                Set LightningShieldOn = False
                                Set unit_RotateAround[(Integer A)] = (Casting unit)
                                Set tempPoint = (Position of (Casting unit))
                                Set tempPoint2 = (tempPoint offset by 50.00 towards 0.00 degrees)
                                Unit - Create 1 Wisp for (Owner of (Casting unit)) at tempPoint2 facing Default building facing degrees
                                Custom script:   call RemoveLocation( udg_tempPoint2 )
                                Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
                                Unit - Set the custom value of (Last created unit) to (Integer A)
                                Set unit_WispRotation[(Integer A)] = (Last created unit)
                                Set real_WispRotation[(Integer A)] = 1.00
                                Set tempPoint2 = (tempPoint offset by 50.00 towards 120.00 degrees)
                                Unit - Create 1 Wisp for (Owner of (Casting unit)) at tempPoint2 facing Default building facing degrees
                                Custom script:   call RemoveLocation( udg_tempPoint2 )
                                Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
                                Set unit_WispRotation[((Integer A) + 1000)] = (Last created unit)
                                Set real_WispRotation[((Integer A) + 1000)] = 121.00
                                Set tempPoint2 = (tempPoint offset by 50.00 towards 240.00 degrees)
                                Unit - Create 1 Wisp for (Owner of (Casting unit)) at tempPoint2 facing Default building facing degrees
                                Custom script:   call RemoveLocation( udg_tempPoint2 )
                                Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
                                Set unit_WispRotation[((Integer A) + 2000)] = (Last created unit)
                                Set real_WispRotation[((Integer A) + 2000)] = 241.00
                                Custom script:   call RemoveLocation( udg_tempPoint )
                            Else - Actions
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                LightningShieldOn Equal to True
            Then - Actions
                Set LightningShieldOn = False
                Set int_CurrentRotations = (int_CurrentRotations + 1)
                Set unit_RotateAround[int_CurrentRotations] = (Casting unit)
                Set tempPoint = (Position of (Casting unit))
                Set tempPoint2 = (tempPoint offset by 50.00 towards 0.00 degrees)
                Unit - Create 1 Wisp for (Owner of (Casting unit)) at (tempPoint offset by 50.00 towards 0.00 degrees) facing Default building facing degrees
                Custom script:   call RemoveLocation( udg_tempPoint2 )
                Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
                Unit - Set the custom value of (Last created unit) to int_CurrentRotations
                Set unit_WispRotation[int_CurrentRotations] = (Last created unit)
                Set real_WispRotation[int_CurrentRotations] = 1.00
                Set tempPoint2 = (tempPoint offset by 50.00 towards 120.00 degrees)
                Unit - Create 1 Wisp for (Owner of (Casting unit)) at (tempPoint offset by 50.00 towards 120.00 degrees) facing Default building facing degrees
                Custom script:   call RemoveLocation( udg_tempPoint2 )
                Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
                Set unit_WispRotation[(int_CurrentRotations + 1000)] = (Last created unit)
                Set real_WispRotation[(int_CurrentRotations + 1000)] = 121.00
                Set tempPoint2 = (tempPoint offset by 50.00 towards 240.00 degrees)
                Unit - Create 1 Wisp for (Owner of (Casting unit)) at (tempPoint offset by 50.00 towards 240.00 degrees) facing Default building facing degrees
                Custom script:   call RemoveLocation( udg_tempPoint2 )
                Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
                Set unit_WispRotation[(int_CurrentRotations + 2000)] = (Last created unit)
                Set real_WispRotation[(int_CurrentRotations + 2000)] = 241.00
                Custom script:   call RemoveLocation( udg_tempPoint )
            Else - Actions

Basically, it sets a boolean to true, which will determine if anything can be created, this is needed because the For Integer A would run multiple times without it, the integer A checks to the maximum count of rotations running, and assigns it to the first one that is free, sets the variable to off, which stops the next part from running. If none are free, variable stays true, and it creates the unit while adding 1 to the counter.

Code:
Rotation Copy
    Events
        Time - Every 0.03 seconds of game time
    Conditions
        (Number of units in (Units of type Wisp)) Greater than 0
    Actions
        For each (Integer A) from 1 to int_CurrentRotations, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        unit_RotateAround[(Integer A)] Not equal to No unit
                    Then - Actions
                        Set tempPoint = (Position of unit_RotateAround[(Integer A)])
                        Set tempPoint2 = (tempPoint offset by 50.00 towards real_WispRotation[(Integer A)] degrees)
                        Unit - Move unit_WispRotation[(Integer A)] instantly to tempPoint2, facing Default building facing degrees
                        Custom script:   call RemoveLocation( udg_tempPoint2 )
                        Set real_WispRotation[(Integer A)] = (real_WispRotation[(Integer A)] + 3.00)
                        Set tempPoint2 = (tempPoint offset by 50.00 towards real_WispRotation[((Integer A) + 1000)] degrees)
                        Unit - Move unit_WispRotation[((Integer A) + 1000)] instantly to tempPoint2, facing Default building facing degrees
                        Custom script:   call RemoveLocation( udg_tempPoint2 )
                        Set real_WispRotation[((Integer A) + 1000)] = (real_WispRotation[((Integer A) + 1000)] + 3.00)
                        Set tempPoint2 = (tempPoint offset by 50.00 towards real_WispRotation[((Integer A) + 2000)] degrees)
                        Unit - Move unit_WispRotation[((Integer A) + 2000)] instantly to (tempPoint offset by 50.00 towards real_WispRotation[((Integer A) + 2000)] degrees), facing Default building facing degrees
                        Custom script:   call RemoveLocation( udg_tempPoint2 )
                        Set real_WispRotation[((Integer A) + 2000)] = (real_WispRotation[((Integer A) + 2000)] + 3.00)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                real_WispRotation[(Integer A)] Greater than or equal to 359.00
                            Then - Actions
                                Set real_WispRotation[(Integer A)] = 0.00
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                real_WispRotation[((Integer A) + 1000)] Greater than or equal to 359.00
                            Then - Actions
                                Set real_WispRotation[((Integer A) + 1000)] = 0.00
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                real_WispRotation[((Integer A) + 2000)] Greater than or equal to 359.00
                            Then - Actions
                                Set real_WispRotation[((Integer A) + 2000)] = 0.00
                            Else - Actions
                        Custom script:   call RemoveLocation( udg_tempPoint )
                    Else - Actions

The same as before, just integer A's are changed.

Code:
Subtraction
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Dying unit)) Equal to Wisp
    Actions
        Set unit_RotateAround[(Custom value of (Dying unit))] = No unit
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Custom value of (Dying unit)) Equal to int_CurrentRotations
            Then - Actions
                Set int_CurrentRotations = (int_CurrentRotations - 1)
            Else - Actions

This is where the removal happens. It only checks for the first wisp since the first wisp created for every unit is the only one given a custom value. It also checks if the custom value is the max of int_CurrentRotations, and if so it sets the max - 1.


This should work, I've been testing it out, and its working fine for me, but if you need help understanding anything else, lemme know.
 

averes

New Member
Reaction score
17
Im able to make it circle around one unit, however when I have 2 units (both are owned by player 1) on the map, only the first one circles. I removed the experation timers and never added the removal trigger as the orbs are never actually going to go away, any idea why this might happen?

EDIT: Nvm got it working. Thanks!
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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