- Joined
- Feb 27, 2019
- Messages
- 401
Hello,
I made the following trigger (I use damage engine, the final purpose is to use healing potion automatically to save the hero under some conditions).
- "Hero - Order Hero <> to use item <>" works fine and saves the unit from dying if I place it before the line "Set VariableSet LocalTempGroup = (Units currently selected by LocalTempPlayer)".
- In the opposite, if I place it after this line, the unit dies.
WTF ???
Is GetUnitsSelectedAll primitive actually asynchronous, with a hidden wait somewhere in its code ??
I made the following trigger (I use damage engine, the final purpose is to use healing potion automatically to save the hero under some conditions).
-
AutoPotionOfGreaterHealing
-
Events
-
Game - DamageEvent becomes Equal to 1.00
-
-
Conditions
-
((Owner of DamageEventTarget) is in ConnectedPlayers.) Equal to True
-
(DamageEventTarget is A Hero) Equal to True
-
(DamageEventTarget is paused) Equal to False
-
(DamageEventTarget has an item of type Potion of Greater Healing) Equal to True
-
DamageEventAmount Greater than or equal to (Life of DamageEventTarget)
-
-
Actions
-
Custom script: local unit udg_LocalTempUnit = udg_DamageEventTarget
-
Custom script: local player udg_LocalTempPlayer = GetOwningPlayer(udg_LocalTempUnit)
-
Custom script: local group udg_LocalTempGroup
-
-------- Check if player selection is shop(s) --------
-
// Set VariableSet LocalTempGroup = (Units currently selected by LocalTempPlayer) // Would execute right and save from death
-
Set VariableSet LocalTempGroup = (Units currently selected by LocalTempPlayer)
-
Hero - Order LocalTempUnit to use (Item carried by LocalTempUnit of type Potion of Greater Healing) // Would not save the unit from death ???
-
[...] // Other unrelevant code for this post
-
Custom script: call DestroyGroup(udg_LocalTempGroup)
-
Custom script: set udg_LocalTempGroup = null
-
Custom script: set udg_LocalTempPlayer = null
-
Custom script: set udg_LocalTempUnit = null
-
-
- "Hero - Order Hero <> to use item <>" works fine and saves the unit from dying if I place it before the line "Set VariableSet LocalTempGroup = (Units currently selected by LocalTempPlayer)".
- In the opposite, if I place it after this line, the unit dies.
WTF ???
Is GetUnitsSelectedAll primitive actually asynchronous, with a hidden wait somewhere in its code ??