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

About removing leaks

Status
Not open for further replies.
Level 6
Joined
Jun 24, 2011
Messages
176
  • Set UnitGroup_Temp[1] = (Units in Choose Area <gen>)
  • UnitGroup - Pick every unit in UnitGroup_Temp[1] and do (Actions)
    • Loop - Aktionen
      • Hero - Modify unspent skill points of (Picked unit): Set to 0 points
  • Custom script: call DestroyGroup(udg_UnitGroup_Temp[1])
Is that triggered appropriately?
Can I use arrays when calling a group's destruction with a custom script? Or will it kill all arrays?

Thank you in advance.
 
Level 6
Joined
Jun 24, 2011
Messages
176
Thank you, Garfield :)
Thanks to the nice tutorials written by some very experienced users, it was very easy to handle those things step by step. T-up to this site, really improving a map-developer's working-style and efficiency multiple times.
 
Level 6
Joined
Jun 24, 2011
Messages
176
Thanks, but I'm kinda oldschool with this and I've got very far with GUI Triggering ^^
However, Paladon is the proof for perfect usage of GUI Triggers.
Yeah, I noticed that aswell that I do not need an array there, but I created already 12 triggers [1-12] with that, because I did not feel like making 12 different variables, cuz i thought i need the information provided in that variable, which was not the case.

Another thing, something is wrong about this trigger, can't really figure out what, my partner coded it.


  • Dialog Test
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Conditions
              • (Number of units in (Units owned by (Player((Integer A))) matching (((Triggering unit) is A Hero) Gleich True))) Gleich 0
            • 'THEN'-Actions
              • Dialog - Hide Dialog[((Player number of (Triggering player)) - 1)] for (Player((Integer A)))
              • Dialog - Hide AttrabuteDialog[((Player number of (Triggering player)) - 1)] for (Player((Integer A)))
            • 'ELSE'-Actions
We are using a dialog system to distribute skill points (which are given with every level in form of 3 wood)
I think he made it to disable the Dialog when your Hero is dead, to prevent wasting wood without getting a result (increased Hero Stats).
However, I think this could be coded in another (better) way... but can't really get how >_<
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Well, Paladon does (or at least: did) use an outdated dynamic indexing system for all I know.
Besides, you can't be really good at GUI if you don't know at least a little JASS :)
But you're probably right, GUI can get you far (just not as efficient and clean as JASS, but everyone has his own style).

About the trigger:
1) Unit group leak in the condition.
2) "count units in group" is very slow.

You could create a boolean arrayed variable called "dialogShown", set dialogShown[X] to true when player X is distributing skill points (so the dialog is shown).
Check whether that boolean is true, then hide the dialogs. It's faster that way.
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
  • Set UnitGroup_Temp[1] = (Units in Choose Area <gen>)
  • UnitGroup - Pick every unit in UnitGroup_Temp[1] and do (Actions)
    • Loop - Aktionen
      • Hero - Modify unspent skill points of (Picked unit): Set to 0 points
  • Custom script: call DestroyGroup(udg_UnitGroup_Temp[1])
Is that triggered appropriately?
Can I use arrays when calling a group's destruction with a custom script? Or will it kill all arrays?

Thank you in advance.

If you need Group = Units in Choose Area <gen> only while setting points to hero, better use this:

  • Custom script: set bj_wantDestroyGroup = true
  • UnitGroup - Pick every unit in (Units in Choose Area <gen>) and do (Actions)
    • Loop - Aktionen
      • Hero - Modify unspent skill points of (Picked unit): Set to 0 points
Its more efficent, faster and less code line.

EDIT Looking on second trigger now.
Its more efficent now
 
Status
Not open for further replies.
Top