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

Chronosphere

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
The thing is you're using a GUI Global Group. Once you destroy it it just doesn't exist. You can use "ClearGroup()" instead (or something like that, i don't remember the exact command).

It removes every unit from the group, but preserves it.

It's really hard to make a GUI version better than a JASS version... The most significative downside i find in the JASS version is it uses Hashtables. Using Unit Indexer would improve it a lot, but I'm not good at it hehe.
 
Level 10
Joined
Sep 19, 2011
Messages
527
  • Chronosphere
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Explosion
    • Actions
      • Set set_unit[1] = (Triggering unit)
      • Set set_point[1] = (Target point of ability being cast)
      • -------- Spell' duration --------
      • Set set_real[1] = 6.00
      • -------- Affected units --------
      • Set set_group[1] = (Units within 0.00 of set_point[1])
      • -------- ------------------------------------------------------------------------------------------ --------
      • Set used_units = 1
      • -------- We need an extra one to avoid leaks or having to create another variable --------
      • Set used_points = 2
      • Set used_reals = 1
      • Set used_groups = 1
      • -------- ------------------------------------------------------------------------------------------ --------
      • Set trigger = ChronospherePeriodic <gen>
      • Set timeout = 0.03
  • ChronospherePeriodic
    • Events
    • Conditions
    • Actions
      • -------- Tic tac... tic tac... --------
      • Set get_real[1] = (get_real[1] - 0.03)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • get_real[1] Greater than 0.00
        • Then - Actions
          • -------- If the spell isn't over, pick every units in the range of the casting point --------
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 512.00 of get_point[1]) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A structure) Equal to False
                  • (Picked unit) Not equal to get_unit[1]
                  • ((Picked unit) is in get_group[1]) Equal to False
                • Then - Actions
                  • -------- Affect the unit --------
                  • Unit Group - Add (Picked unit) to get_group[1]
                • Else - Actions
          • Unit Group - Pick every unit in get_group[1] and do (Actions)
            • Loop - Actions
              • -------- Check for units that are affected but they are not in the proper range --------
              • Set get_point[2] = (Position of (Picked unit))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between get_point[2] and get_point[1]) Greater than 512.00
                • Then - Actions
                  • -------- The unit is far from the spell' effect, so remove it --------
                  • Unit - Unpause (Picked unit)
                  • Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed
                  • Unit Group - Remove (Picked unit) from get_group[1]
                • Else - Actions
                  • -------- The unit is in range, so affect it! --------
                  • Unit - Pause (Picked unit)
                  • Animation - Change (Picked unit)'s animation speed to 0.00% of its original speed
        • Else - Actions
          • -------- Spell is over, remove all effects from affected units --------
          • Unit Group - Pick every unit in get_group[1] and do (Actions)
            • Loop - Actions
              • Unit - Unpause (Picked unit)
              • Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed
              • Unit Group - Remove (Picked unit) from get_group[1]
          • -------- Forget about leaks :D --------
          • Set automaticClean = True
          • Set finish = True
uses this: http://www.hiveworkshop.com/forums/spells-569/mui-242000/
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
mmm... You're creating a new group every 0.03. That's pretty heavy and you can achieve the same effect having a single group and clearing it every 0.03. If you use "(Picked Unit)" or any other event response several times it's better to store it in a variable and use the variable instead, it's better.

You're using these 2 triggers AND an additional system to handle them.

That's less efficient than the last Chronosphere trigger NightSkyAurora posted, or the JASS one I posted.
 
Level 10
Joined
Sep 19, 2011
Messages
527
mmm... You're creating a new group every 0.03. That's pretty heavy and you can achieve the same effect having a single group and clearing it every 0.03. If you use "(Picked Unit)" or any other event response several times it's better to store it in a variable and use the variable instead, it's better.

how many chronosphere could be at the same time?

You're using these 2 triggers AND an additional system to handle them.

yes, and my trigger is more readable and easy/faster to make :)

That's less efficient than the last Chronosphere trigger NightSkyAurora posted, or the JASS one I posted.

how less efficient?, benchmark please.
and again, how many chronosphere could be at the same time?, you will be fine.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
  • -------- If the spell isn't over, pick every units in the range of the casting point --------
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units within 512.00 of get_point[1]) and do (Actions)
For every Chronosphere you're creating and destroying a group every 0.03 to pause the units. Handling groups (creating/destroying) is one of the heaviest tasks Wc3 has. That's why using a single group and clearing it is better.

yes, and my trigger is more readable and easy/faster to make :)
Yet, slower and unneficient when compared to the other aproaches. Any Basic Jass'er can handle the JASS approach, and any mid-GUI'er can handle the GUI approach, both in this post.
 
Level 10
Joined
Sep 19, 2011
Messages
527
For every Chronosphere you're creating and destroying a group every 0.03 to pause the units. Handling groups (creating/destroying) is one of the heaviest tasks Wc3 has. That's why using a single group and clearing it is better.

you didn't ask my previus question, how many?. yet it can be easily modified to use another group:

  • Set set_group[2] = (Units within 0.00 of set_point[1])
  • Set used_groups = 2
  • Set set_group[2] = (Units within 512.00 of set_point[1])
  • Unit Group - Pick every unit in get_group[2] and do (Actions)
Yet, slower and unneficient when compared to the other aproaches. Any Basic Jass'er can handle the JASS approach, and any mid-GUI'er can handle the GUI approach, both in this post.

again, how much slower/unneficient?, will crash the map?, will be laggy?, is it worth compared to my gain?. don't see this side only, remember that we are in spells (efficiency/speed isn't that much here).
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
How much slower? A LOT compared to easyness of doing it with a single group, even having a single Chronosphere att.

Your "easiliy modified to use another group" is still bad. Still creating temp-groups to handle the stuff. Read again about USING A SINGLE GLOBAL GROUP AND CLEARING IT. You're still using (Picked Unit) like 10 times, when you should do it only once to store it in a variable.

How much slower/unneficient? Enough to be considered slow and unneficient compared to other approaches.

Will crash the map? No.

Will be laggy? Depends on how many stuff are happenning at the same time.

Is it worth compared to your gain? Yes, is it worth investing one or two minutes on improving it, since it's really easy to do it.


Your script isn't also THAT easy to read. Requires understanding your other system. I would reather invest that on learning how to read the JASS version :)
 
In the long run, Ruke's system is superior. For a single spell or spellpack or quick game/map then it depends. I found Ruke's system easy to understand after playing around with it for 10 minutes, I learned Ruke's MUI system in about 10 minutes and indexing in about a week.

There is quite a line of difference in the speed. =) Though it is bad practice using Ruke's system however I am sure I have practiced enough so it doesn't bother me. Also cool spell, I made a Chronosphere too with your system Ruke, lol.

EDIT: To continue about the long-run superiority thing so I can explain it for everyone to understand what I meant.

With Ruke's system you'll have three unit group variables, without it you'll have over 10 "global groups" if not more. Now lets compare that to map loading time and etc. . .
The difference in speed isn't noticeable unless your doing something very complex like a hundred beam system or some projectile system which I do think should be done without Ruke's system and with proper indexing that is the fastest type in order to have a fun working map.

The beam spell I made with Ruke's system only started to lag after 20+ casts at the same time so Ruke's MUI system is by far one of the best systems for GUI'ers because it can fit in almost any map to actually let the mapmakers to finish their projects because we all know most people get stuck on triggers/spells/abilities/bla bla.

So Spartipilo I think you should stick to your jass and stop trying to show the downfalls of Ruke's system because it should already be known. Like you said, Everything except difficulty to read is either Depends or No. Since I doubt your much of a GUI'er I don't think you can say it is hard to read. I am a full GUI'er who uses JASS when required too and I can say with ease that this system is quite epic.

EDIT2: Lots of text, be warned! =P
 
Level 10
Joined
Sep 19, 2011
Messages
527
How much slower? A LOT compared to easyness of doing it with a single group, even having a single Chronosphere att.

how much is "a lot"?, please benchmark so we can talk with precision.
oh wait, are you talking about the group optimization?, i thought you were talking about the utility.

Your "easiliy modified to use another group" is still bad. Still creating temp-groups to handle the stuff. Read again about USING A SINGLE GLOBAL GROUP AND CLEARING IT.

you're right, also pick every unit ... in gui leaks.

You're still using (Picked Unit) like 10 times, when you should do it only once to store it in a variable.

yes, tiny optimization but yes. remember, it's just an example.

How much slower/unneficient? Enough to be considered slow and unneficient compared to other approaches.

Will be laggy? Depends on how many stuff are happenning at the same time.

did you test it?, how did you end up with that conclusion?
edit: this is for the optimizations that you mentioned?

Is it worth compared to your gain? Yes, is it worth investing one or two minutes on improving it, since it's really easy to do it.

i was talking about using the utility, not those optimizations.

Your script isn't also THAT easy to read. Requires understanding your other system. I would reather invest that on learning how to read the JASS version :)

... yes, it is easy to read, it is more than when using indexing.

requires understanding on the utility, yes, a little bit, just how to save and retrieve data... how hard can that be?

jass would take you a little bit more of time, but yes, you could. remember that not everyone is interested in learning jass, they just want to make things, and make it quickly, and that is the goal of the utility.
 
Status
Not open for further replies.
Top