- Joined
- Jan 30, 2020
- Messages
- 775
So, I have an item that should be replaced ("turned off") if the current mana is too low.
Currently when I loop through each inventory slot to check for the correct item, if you have it and enough mana, it drains some mana, else it turns off.
That's the idea of it.
I turn it off by removing it and createing a new one.
The variables:
temp_unit: The unit casting the spell, or spending mana while using spell (channeling)
temp_real5: The mana refund/cost-increase
temp_integer1: The mana-cost of the ability (for that unit, using correct level etc.).
If I have under 2000 mana, it runs for 1 then stops. 1 is successfully replaced, but it does not continue!
If I throw another spell it runs for 2 then stops. Then 3. Always 1 at the time, instead of all at once! This means, the loop gets broken somehow.
The rest of actions below continue successfully.
Any ideas on how to solve that problem?
Currently when I loop through each inventory slot to check for the correct item, if you have it and enough mana, it drains some mana, else it turns off.
That's the idea of it.
I turn it off by removing it and createing a new one.
The variables:
temp_unit: The unit casting the spell, or spending mana while using spell (channeling)
temp_real5: The mana refund/cost-increase
temp_integer1: The mana-cost of the ability (for that unit, using correct level etc.).
-
Check item types carried by hero etc.
-
...
-
For each (Integer A) from 1 to 6, do (Actions)
-
Loop - Actions
-
Set temp_item = (Item carried by temp_unit in slot (Integer A))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item-type of temp_item) Equal to Arcane Ring of Amplification (on)
-
-
Then - Actions
-
Game - Display to (All players) the text: (has item in: + (String((Integer A))))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Mana of temp_unit) Less than 2000.00
-
-
Then - Actions
-
Item - Remove temp_item
-
Hero - Create Arcane Ring of Amplification (off) and give it to temp_unit
-
-
Else - Actions
-
Custom script: set udg_temp_real5 = udg_temp_real5 - 1.0 * udg_temp_integer1
-
-
-
-
Else - Actions
-
-
-
-
...
-
Drain mana based on temp_real5
If I have under 2000 mana, it runs for 1 then stops. 1 is successfully replaced, but it does not continue!
If I throw another spell it runs for 2 then stops. Then 3. Always 1 at the time, instead of all at once! This means, the loop gets broken somehow.
The rest of actions below continue successfully.
Any ideas on how to solve that problem?
Last edited: