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

Unit Indexer for Reforged?

Status
Not open for further replies.
Level 16
Joined
Apr 4, 2011
Messages
995
Howdy all

Reforged is finally stable enough on my computer to dip my feet into resuming work on my projects. I have noticed that some things are broken, notably my unit indexer and damage detection system. I've been using Bribe's systems, which I will link for convenience

GUI Unit Indexer 1.4.0.0

Damage Engine 5.7.1.1

Bribe has stated he has no plans for adapting the indexer to reforged, which somehow broke the systems (custom value always returns 0). I'm sure other modders have run into this problem, so can anyone recommend unit indexer or DDS system that work with reforged? Preferably a pair that work together, as I need both systems. Alternatively, any work arounds to get Bribe's system to work would be fantastic, as it requires less upheaval of my code.
 
Level 18
Joined
Oct 17, 2012
Messages
821
Damage engine does not require Unit Indexer though, so any issue with the indexer should not affect the system. As for unit indexers, any will do as long as you retrieve the custom value manually, not by using any function or variable exclusive to a particular indexer. Even then, many of the unit indexers (JASS ones in particular) has similar names for their basic functions. So, it should be simple to adapt from one to another.

See if you get the same issue from UnitDex. There is also a compatibility script for Bribe's GUI Unit Indexer. However, I find that the script does not work for his 2.5D Knockback system. Just a heads up.
 
Last edited:
Level 20
Joined
Apr 12, 2018
Messages
494
Bribe has stated he has no plans for adapting the indexer to reforged, which somehow broke the systems (custom value always returns 0). I'm sure other modders have run into this problem, so can anyone recommend unit indexer or DDS system that work with reforged? Preferably a pair that work together, as I need both systems. Alternatively, any work arounds to get Bribe's system to work would be fantastic, as it requires less upheaval of my code.
As far as I know Custom Values are not bugged.

Or did this happen in one of the recent patches and nobody posted about it?
 
Level 16
Joined
Apr 4, 2011
Messages
995
I tried the UnitDex and I benchmarked my own map to test custom values. The custom values are actually applying and the unit indexer (both of them) are working, but my previously perfectly fine triggers are still having problems. I think I've narrowed it down to sometimes when I add units into unit groups, the unit isn't actually added to the unit group. This does not happen for all the times I add things to a unit group, just sometimes, but it consistently happens sometimes on the same spells. The spells with the problems are also using repeat timers and lots of if/then/else blocks, and my debugging has led me to believe that the /else part of if/then/else blocks aren't firing correctly.

Does anybody know if
-Unit groups
-Adding units to unit groups
-overwriting indexed variables
-if/then/else blocks

are having problems?

I'm going to attach some of the triggers in question, specifically the hero revive loop is having issues where it otherwise worked before. I left the debug messages embedded inside the trigger so I could point them out. I'm getting debug 1 without problem, but only rarely debug 2 and 3. I'm never getting debug 4, which is peculiar because if we see debug 3 it should have to hit 4 eventually before turning off. I'm happy to post my map file too if that could be helpful


  • Unit Dies
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set VariableSet unit1 = (Triggering unit)
      • Set VariableSet totalkills = (totalkills + 1)
      • Multiboard - Change the title of multiboard to (Huge Big War Yay!! + ([ + ((String(totalkills)) + ])))
      • Set VariableSet player = (Owner of unit1)
      • Custom script: set udg_handle = GetHandleId(udg_player)
      • Set VariableSet integer = (Load 2 of handle from hashtable.)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (unit1 is A Hero) Equal to True
        • Then - Actions
          • Set VariableSet handle = (Custom value of unit1)
          • Set VariableSet time[handle] = 5.00
          • Unit Group - Add unit1 to herorezgroup
          • Unit Group - Add (Dying unit) to herorezgroup
          • Set VariableSet point1 = (Position of unit1)
          • Floating Text - Create floating text that reads (String((Integer(time[handle])))) at point1 with Z offset 0.00, using font size 18.00, color (100.00%, 20.00%, 40.00%), and 0.00% transparency
          • Set VariableSet floatingtext = (Last created floating text)
          • Floating Text - Show floatingtext for (All players)
          • Floating Text - Set the velocity of floatingtext to (Random real number between 32.00 and 96.00) towards (Random real number between 60.00 and 120.00) degrees
          • Floating Text - Change floatingtext: Disable permanence
          • Floating Text - Change the lifespan of floatingtext to 4.00 seconds
          • Trigger - Turn on Hero Revive Loop <gen>
          • Set VariableSet herodeaths[handle] = (herodeaths[handle] + 1)
          • Multiboard - Set the text for multiboard item in column 5, row integer to (String(herodeaths[handle]))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Killing unit) is A Hero) Equal to True
            • Then - Actions
              • Set VariableSet player = (Owner of (Killing unit))
              • Custom script: set udg_handle = GetHandleId(udg_player)
              • Set VariableSet herokills[handle] = (herokills[handle] + 1)
              • Set VariableSet integer = (Load 2 of handle from hashtable.)
              • Multiboard - Set the text for multiboard item in column 4, row integer to (String(herokills[handle]))
            • Else - Actions
          • Custom script: call RemoveLocation(udg_point1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • eclipseboolean Equal to True
          • (Unit-type of unit1) Not equal to Zombie
          • (Unit-type of unit1) Not equal to Infernal
          • (Unit-type of unit1) Not equal to Dummy
        • Then - Actions
          • Set VariableSet point1 = (Position of unit1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of eclipsehero) is in east.) Equal to True
            • Then - Actions
              • Set VariableSet player = Player 5 (Yellow)
            • Else - Actions
              • Set VariableSet player = Player 1 (Red)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Dark Eclipse (R) for eclipsehero) Equal to 1
            • Then - Actions
              • Unit - Create 1 Zombie for player at point1 facing Default building facing degrees
            • Else - Actions
              • Unit - Create 1 Infernal for player at point1 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_point1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Killing unit) is in forbiddenknowledgegroup.) Equal to True
        • Then - Actions
          • Set VariableSet unit2 = (Killing unit)
          • Set VariableSet point2 = (Position of unit2)
          • Unit - Create 1 Dummy for (Owner of unit2) at point2 facing Default building facing degrees
          • Set VariableSet unit3 = (Last created unit)
          • Set VariableSet handle = (Custom value of unit3)
          • Set VariableSet time[handle] = (15.00 x (Real((Level of Forbidden Knowledge (E) for unit2))))
          • Set VariableSet unithandle[handle] = unit2
          • Hero - Modify Intelligence of unithandle[handle]: Add 1.
          • Special Effect - Create a special effect attached to the origin of unit2 using Objects\Spawnmodels\Demon\DemonSmallDeathExplode\DemonSmallDeathExplode.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit Group - Add unit3 to knowledgedummygroup
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Forbidden Knowledge Loop <gen> is on) Equal to True
            • Then - Actions
            • Else - Actions
              • Trigger - Turn on Forbidden Knowledge Loop <gen>
          • Custom script: call RemoveLocation(udg_point2)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of unit1) Equal to footy (red)
        • Then - Actions
          • Set VariableSet point1 = (Position of unit1)
          • Special Effect - Create a special effect at point1 using Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect at point1 using Abilities\Spells\Other\Volcano\VolcanoDeath.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 300.00 of point1.) and do (Actions)
            • Loop - Actions
              • Set VariableSet unit2 = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (unit2 is alive) Equal to True
                  • (unit2 is A structure) Equal to False
                • Then - Actions
                  • Unit - Cause unit1 to damage unit2, dealing 75.00 damage of attack type Spells and damage type Normal
                • Else - Actions
          • Custom script: call RemoveLocation(udg_point1)
        • Else - Actions
  • Hero Revive Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) the text: debug 1
      • Unit Group - Pick every unit in herorezgroup and do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: debug 2
          • Set VariableSet unit1 = (Picked unit)
          • Set VariableSet handle = (Custom value of unit1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • time[handle] Greater than 0.01
            • Then - Actions
              • Game - Display to (All players) the text: debug 3
              • Set VariableSet time[handle] = (time[handle] - 1.00)
            • Else - Actions
              • Game - Display to (All players) the text: debug 4
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Owner of unit1) is in west.) Equal to True
                • Then - Actions
                  • Set VariableSet point1 = (Random point in West Base <gen>)
                • Else - Actions
                  • Set VariableSet point1 = (Random point in East Base <gen>)
              • Hero - Instantly revive unit1 at point1, Show revival graphics
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (unit1 is hidden) Equal to True
                • Then - Actions
                  • Unit - Unhide unit1
                • Else - Actions
              • Camera - Pan camera for (Owner of unit1) to point1 over 0.00 seconds
              • Custom script: call RemoveLocation(udg_point1)
              • Game - Display to (All players) the text: ((Proper name of unit1) + revivestring[(Random integer number between 1 and 15)])
              • Unit Group - Remove unit1 from herorezgroup.
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in herorezgroup) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,542
You're adding the unit to the Unit Group twice in your first trigger:
  • Unit Group - Add unit1 to herorezgroup
  • Unit Group - Add (Dying unit) to herorezgroup
I've never experienced such issues with Bribe's Unit Indexer or Damage Engine. Perhaps you're making mistakes elsewhere like the above issue.

I have however experienced issues with Array Sizes recently. Some variables were not working unless I manually set their Sizes in the variable editor, and I don't mean Unit Groups which I know need this special treatment.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,542
[Solved] - Unit Group[array] Question

Basically, you have to create the Unit Groups yourself.

You can't reference for example, UnitGroup[custom value of some unit], without first creating it.
  • Set Variable Unit = Triggering Unit
  • Set Variable CV = Custom value of Unit
  • Custom script: Set udg_UnitGroup[udg_CV] = CreateGroup()
  • Add Unit to UnitGroup[udg_CV]
You can adjust the Array Size in the Variable Editor as well. For example, if you know for a fact that your map only has 12 Players, you can set the Array Size for a Player Group to 12. This will initialize 12 Player Group variables which can then be conveniently referenced with the Player Number.
 
Last edited:
Status
Not open for further replies.
Top