- Joined
- Feb 22, 2025
- Messages
- 315
Hi, this is supposed to be just a detection and warning system that would give the player a visual warning when a certain abomination is about to cast meat hook ( dummy is the caster). Since I'm using the Unit Indexer, I suppose that each unit is given a different integer custom value. I need advice regarding indexing and recycling, so is it better to use a hashtable for this instance, also is it recommended to use a spare unit group when doing instancing? Feedback is appriciated, cheers ppl 
PS Is there a GUI option to get real - Game time ? Couldn't find it so i ussed jass f
Update 1: I'm not sure why setting 1 unit group equal other unit group never makes them even. I couldn't fix it by adding all units from abo group to abo temp group, so i sticked with the original group. The core problem i think i found is that the conditions never meet to finish the travel time, they get stuck and get cleared only upon death, and I suppose this has to do with the measuring the elapsed game time and given conditions. I added a hashtable, and now I'm really not sure how to get this to work apart from creating a timer that would run forever then doing the conditionals .... Updated triggers below
Update 2: Instead relying on time elapsed (f) created 2 real array variables, then did the math, okay so this now works, but I'm not sure is it reliable, also why is bj_gameStartedTimer for elapsed time not doing the trick, I believe someone with JASS knowledge knows a workaround to this, I couldn't find what I was looking for on the forums. Updated triggers below:

PS Is there a GUI option to get real - Game time ? Couldn't find it so i ussed jass f
Update 2: Instead relying on time elapsed (f) created 2 real array variables, then did the math, okay so this now works, but I'm not sure is it reliable, also why is bj_gameStartedTimer for elapsed time not doing the trick, I believe someone with JASS knowledge knows a workaround to this, I couldn't find what I was looking for on the forums. Updated triggers below:
-
Test group
-

Events
-


Map initialization
-
-

Conditions
-

Actions
-


Set Abomination_Index = 0
-


Set Abomination_Recycle_Count = 0
-


Hashtable - Create a hashtable
-


Set Abomination_Hashtable = (Last created hashtable)
-


Unit Group - Add Fel Abomination 0028 <gen> to AbominationGroup
-


Unit Group - Add Fel Abomination 0029 <gen> to AbominationGroup
-


Unit Group - Add Fel Abomination 0027 <gen> to AbominationGroup
-


Wait 2.00 seconds
-


Trigger - Turn on MeatHook Scan <gen>
-
-
-
MeatHook Scan
-

Events
-


Time - Every 5.00 seconds of game time
-
-

Conditions
-

Actions
-


Unit Group - Pick every unit in AbominationGroup and do (Actions)
-



Loop - Actions
-




Set Abomination_TempUnit = (Picked unit)
-




Custom script: set udg_Abomination_TempInteger = LoadInteger(udg_Abomination_Hashtable, GetHandleId(udg_Abomination_TempUnit), 0)
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






(Abomination_TempUnit is alive) Equal to True
-






Abomination_TempInteger Equal to 0
-
-





Then - Actions
-






Set Abomination_TempUnit2 = No unit
-






Set Abomination_TempPoint = (Position of Abomination_TempUnit)
-






Set Abomination_TargetGroup = (Units within 900.00 of Abomination_TempPoint matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of Abomination_TempUnit).) Equal to True))).)
-






If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







If - Conditions
-








(Number of units in Abomination_TargetGroup) Greater than 0
-
-







Then - Actions
-








Set Abomination_TempTarget = No unit
-








Set Abomination_TempReal = 1000.00
-








Set Abomination_TempPoint2 = Abomination_TempPoint
-








Unit Group - Pick every unit in Abomination_TargetGroup and do (Actions)
-









Loop - Actions
-










Set Abomination_TempPoint3 = (Position of (Picked unit))
-










Set Abomination_TempReal2 = (Distance between Abomination_TempPoint2 and Abomination_TempPoint3)
-










If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-











If - Conditions
-












Abomination_TempReal2 Less than Abomination_TempReal
-
-











Then - Actions
-












Set Abomination_TempReal = Abomination_TempReal2
-












Set Abomination_TempUnit2 = (Picked unit)
-












Game - Display to (All players) for 2.00 seconds the text: abo picked
-
-











Else - Actions
-
-










Custom script: call RemoveLocation( udg_Abomination_TempPoint3)
-
-
-








If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-









If - Conditions
-










Abomination_TempUnit2 Not equal to No unit
-
-









Then - Actions
-










Set Abomination_TempInteger = 0
-










If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-











If - Conditions
-












Abomination_Recycle_Count Greater than 0
-
-











Then - Actions
-












Set Abomination_TempInteger = Abomination_RecycleStack[Abomination_Recycle_Count]
-












Set Abomination_Recycle_Count = (Abomination_Recycle_Count - 1)
-
-











Else - Actions
-












Set Abomination_Index = (Abomination_Index + 1)
-












Set Abomination_TempInteger = Abomination_Index
-
-
-










Custom script: call SaveInteger(udg_Abomination_Hashtable, GetHandleId(udg_Abomination_TempUnit), 0, udg_Abomination_TempInteger)
-










Set Abomination_Unit[Abomination_TempInteger] = Abomination_TempUnit
-










Set Abomination_Target[Abomination_TempInteger] = Abomination_TempUnit2
-










Set Abomination_State[Abomination_TempInteger] = 1
-










Set Abomination_Active[Abomination_TempInteger] = True
-










Set Abomination_Warning_Countdown[Abomination_TempInteger] = 1.70
-










Special Effect - Create a special effect attached to the overhead of Abomination_Unit[Abomination_TempInteger] using ExcMark_Red_Emergency.mdx
-










Set Abomination_WarningSFX[Abomination_TempInteger] = (Last created special effect)
-










Sound - Play ChainsWhoosh <gen> at 100.00% volume, located at Abomination_TempPoint with Z offset 0.00
-










Game - Display to (All players) for 2.00 seconds the text: abo paused
-










Unit - Make Abomination_Unit[Abomination_TempInteger] face Abomination_Target[Abomination_TempInteger] over 0.00 seconds
-










Unit - Pause Abomination_Unit[Abomination_TempInteger]
-










Animation - Play Abomination_Unit[Abomination_TempInteger]'s attack 2 animation
-
-









Else - Actions
-
-
-







Else - Actions
-
-






Custom script: call RemoveLocation( udg_Abomination_TempPoint)
-






Custom script: call DestroyGroup( udg_Abomination_TargetGroup)
-
-





Else - Actions
-
-
-
-
-
-
Abo Loop
-

Events
-


Time - Every 0.03 seconds of game time
-
-

Conditions
-

Actions
-


For each (Integer Abomination_LoopIndex) from 1 to Abomination_Index, do (Actions)
-



Loop - Actions
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






Abomination_Active[Abomination_LoopIndex] Equal to True
-
-





Then - Actions
-






If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







If - Conditions
-








Abomination_State[Abomination_LoopIndex] Equal to 1
-
-







Then - Actions
-








-------- Warning Finished, create dummy for cast --------
-








Set Abomination_Warning_Countdown[Abomination_LoopIndex] = (Abomination_Warning_Countdown[Abomination_LoopIndex] - 0.03)
-








If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-









If - Conditions
-










Abomination_Warning_Countdown[Abomination_LoopIndex] Less than or equal to 0.00
-
-









Then - Actions
-










Set Abomination_TempPoint4 = (Position of Abomination_Unit[Abomination_LoopIndex])
-










Set Abomination_TempPoint5 = (Position of Abomination_Target[Abomination_LoopIndex])
-










Unit - Create 1 Meat Hook Dummy for (Owner of Abomination_Unit[Abomination_LoopIndex]) at Abomination_TempPoint4 facing Default building facing degrees
-










Set Abomination_Dummy_Caster = (Last created unit)
-










Unit - Add a 2.00 second Generic expiration timer to Abomination_Dummy_Caster
-










Unit - Order Abomination_Dummy_Caster to Human Mortar Team - Flare Abomination_TempPoint5
-










Custom script: call RemoveLocation( udg_Abomination_TempPoint4)
-










Custom script: call RemoveLocation( udg_Abomination_TempPoint5)
-










-------- Travel State --------
-










Set Abomination_State[Abomination_LoopIndex] = 2
-










Set Abomination_Travel_Duration[Abomination_LoopIndex] = 1.70
-
-









Else - Actions
-
-
-







Else - Actions
-
-






-------- Check travel state --------
-






If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







If - Conditions
-








Abomination_State[Abomination_LoopIndex] Equal to 2
-
-







Then - Actions
-








Game - Display to (All players) for 0.50 seconds the text: "Travel finished, c...
-








-------- Travel Finished, cleanup --------
-








Set Abomination_Travel_Duration[Abomination_LoopIndex] = (Abomination_Travel_Duration[Abomination_LoopIndex] - 0.03)
-








If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-









If - Conditions
-










Abomination_Travel_Duration[Abomination_LoopIndex] Less than or equal to 0.00
-
-









Then - Actions
-










Unit - Unpause Abomination_Unit[Abomination_LoopIndex]
-










Animation - Reset Abomination_Unit[Abomination_LoopIndex]'s animation
-










Special Effect - Destroy Abomination_WarningSFX[Abomination_LoopIndex]
-










Custom script: call SaveInteger(udg_Abomination_Hashtable, GetHandleId(udg_Abomination_Unit[udg_Abomination_LoopIndex]), 0, 0)
-










Set Abomination_Unit[Abomination_LoopIndex] = No unit
-










Set Abomination_Target[Abomination_LoopIndex] = No unit
-










Set Abomination_Active[Abomination_LoopIndex] = False
-










Set Abomination_Recycle_Count = (Abomination_Recycle_Count + 1)
-










Set Abomination_RecycleStack[Abomination_Recycle_Count] = Abomination_LoopIndex
-
-









Else - Actions
-
-
-







Else - Actions
-
-
-





Else - Actions
-
-
-
-
-
-
Abo CleanupOnDeath
-

Events
-


Unit - A unit Dies
-
-

Conditions
-


((Dying unit) is in AbominationGroup.) Equal to True
-
-

Actions
-


Set Abomination_TempUnit = (Dying unit)
-


Custom script: set udg_Abomination_TempInteger = LoadInteger(udg_Abomination_Hashtable, GetHandleId(udg_Abomination_TempUnit), 0)
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




Abomination_TempInteger Greater than 0
-




Abomination_TempInteger Less than or equal to Abomination_Index
-




Abomination_Unit[Abomination_TempInteger] Equal to Abomination_TempUnit
-
-



Then - Actions
-




Special Effect - Destroy Abomination_WarningSFX[Abomination_TempInteger]
-




Unit - Unpause Abomination_TempUnit
-




Set Abomination_Unit[Abomination_TempInteger] = No unit
-




Set Abomination_Target[Abomination_TempInteger] = No unit
-




Set Abomination_Active[Abomination_TempInteger] = False
-




Custom script: call SaveInteger(udg_Abomination_Hashtable, GetHandleId(udg_Abomination_TempUnit), 0, 0)
-




Set Abomination_Recycle_Count = (Abomination_Recycle_Count + 1)
-




Set Abomination_RecycleStack[Abomination_Recycle_Count] = Abomination_TempInteger
-
-



Else - Actions
-
-


Unit Group - Remove Abomination_TempUnit from AbominationGroup.
-
-
Last edited:

That game time attempt was from before when i tried to compare the current game time with the game time of detecting... All makes sense now ty again 