deepstrasz
Map Reviewer
- Joined
- Jun 4, 2009
- Messages
- 20,215
Hey, I'm trying to convert my (solo) working triggered "spell" to work on multiple units at once using this:
Visualize: Dynamic Indexing
What am I doing wrong? I assume it might be probably related to the last triggers where I am supposed to switch variables.
I'm using 4 loops each with its own integer as the first number to the max limit of the first integer/index used in the first trigger.
What happens is, that after I train more units and they are being attacked, some of them even if not attacked lose their shield when others are attacked. Other things might happen too but I'm not quite sure what.
-
Shield Units Training
-
Events
-
Unit - A unit owned by Player 1 (Red) Finishes training a unit
-
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Unit-type of (Trained unit)) Equal to Irregular Footman
-
-
Then - Actions
-
Set ShieldsIndexInteger = (ShieldsIndexInteger + 1)
-
Set ShieldsTrainedUnit[ShieldsIndexInteger] = (Trained unit)
-
Set ShieldsInitialValue[ShieldsIndexInteger] = 500
-
Set ShieldsMaxValue[ShieldsIndexInteger] = ShieldsInitialValue[ShieldsIndexInteger]
-
Floating Text - Create floating text that reads ((String(ShieldsInitialValue[ShieldsIndexInteger])) + ( / + (String(ShieldsMaxValue[ShieldsIndexInteger])))) above ShieldsTrainedUnit[ShieldsIndexInteger] with Z offset 10.00, using font size 8.00, color (100.00%, 0.00%, 100.00%), and 0.00% transparency
-
Set ShieldsFloatingText[ShieldsIndexInteger] = (Last created floating text)
-
Floating Text - Create floating text that reads ((+ + ((String(ShieldsArmourValue[ShieldsIndexInteger])) + ))) above ShieldsTrainedUnit[ShieldsIndexInteger] with Z offset 10.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
-
Set ShieldsArmourFloatingText[ShieldsIndexInteger] = (Last created floating text)
-
-------- Floating Text with Armour --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
ShieldsArmourValue[ShieldsIndexInteger] Equal to 0
-
-
Then - Actions
-
Floating Text - Change text of ShieldsArmourFloatingText[ShieldsIndexInteger] to <Empty String> using font size 8.00
-
-
Else - Actions
-
-
-------- Check If Ready to Go --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
ShieldsIndexInteger Equal to 1
-
-
Then - Actions
-
Trigger - Add to Shield Units Damaged <gen> the event (Unit - ShieldsTrainedUnit[ShieldsIndexInteger] Takes damage)
-
Trigger - Turn on Shields Regenerate <gen>
-
Trigger - Turn on Shield Floating Texts Move <gen>
-
Trigger - Turn on Shield Texts OFF <gen>
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
-
Shield Units Damaged
-
Events
-
Conditions
-
Actions
-
For each (Integer ShieldsUnitDamagedLoopInteger) from 1 to ShieldsIndexInteger, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
ShieldsInitialValue[ShieldsUnitDamagedLoopInteger] Greater than 0
-
-
Then - Actions
-
Set DamageSourceUnits[ShieldsUnitDamagedLoopInteger] = (Damage source)
-
Set DamageTakenReals[ShieldsUnitDamagedLoopInteger] = (Damage taken)
-
Unit - Set life of ShieldsTrainedUnit[ShieldsUnitDamagedLoopInteger] to ((Life of ShieldsTrainedUnit[ShieldsUnitDamagedLoopInteger]) + DamageTakenReals[ShieldsUnitDamagedLoopInteger])
-
-------- Forbidden under 0 Shield Value --------
-
Set ShieldsInitialValue[ShieldsUnitDamagedLoopInteger] = (ShieldsInitialValue[ShieldsUnitDamagedLoopInteger] - (Integer(DamageTakenReals[ShieldsUnitDamagedLoopInteger])))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
ShieldsInitialValue[ShieldsUnitDamagedLoopInteger] Less than 0
-
-
Then - Actions
-
Set ShieldsInitialValue[ShieldsUnitDamagedLoopInteger] = 0
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
DamageTakenReals[ShieldsUnitDamagedLoopInteger] Greater than (Real(ShieldsInitialValue[ShieldsUnitDamagedLoopInteger]))
-
-
Then - Actions
-
Set LifesTaken[ShieldsUnitDamagedLoopInteger] = ((Integer(DamageTakenReals[ShieldsUnitDamagedLoopInteger])) - ShieldsInitialValue[ShieldsUnitDamagedLoopInteger])
-
Unit - Cause DamageSourceUnits[ShieldsUnitDamagedLoopInteger] to damage ShieldsTrainedUnit[ShieldsUnitDamagedLoopInteger], dealing (Real(LifesTaken[ShieldsUnitDamagedLoopInteger])) damage of attack type Chaos and damage type Normal
-
-
Else - Actions
-
-
-------- Bonus Shield Armour --------
-
-------- Lower Damage than Armour --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
DamageTakenReals[ShieldsUnitDamagedLoopInteger] Less than or equal to (Real(ShieldsArmourValue[ShieldsUnitDamagedLoopInteger]))
-
-
Then - Actions
-
Set ShieldsInitialValue[ShieldsUnitDamagedLoopInteger] = (ShieldsInitialValue[ShieldsUnitDamagedLoopInteger] + (Integer(DamageTakenReals[ShieldsUnitDamagedLoopInteger])))
-
Set DamageTakenReals[ShieldsUnitDamagedLoopInteger] = 0.00
-
-
Else - Actions
-
-
-------- Higher Damage than Armour --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
And - All (Conditions) are true
-
Conditions
-
DamageTakenReals[ShieldsUnitDamagedLoopInteger] Greater than (Real(ShieldsArmourValue[ShieldsUnitDamagedLoopInteger]))
-
DamageTakenReals[ShieldsUnitDamagedLoopInteger] Greater than 0.00
-
-
-
-
Then - Actions
-
Set DamageTakenReals[ShieldsUnitDamagedLoopInteger] = (DamageTakenReals[ShieldsUnitDamagedLoopInteger] - (Real(ShieldsArmourValue[ShieldsUnitDamagedLoopInteger])))
-
-
Else - Actions
-
-
Game - Display to (All players) the text: ((ShieldArmour + (String(ShieldsUnitDamagedLoopInteger))) + (String(ShieldsArmourValue[ShieldsUnitDamagedLoopInteger])))
-
Floating Text - Change text of ShieldsFloatingText[ShieldsUnitDamagedLoopInteger] to ((String(ShieldsInitialValue[ShieldsUnitDamagedLoopInteger])) + ( / + (String(ShieldsMaxValue[ShieldsUnitDamagedLoopInteger])))) using font size 8.00
-
-------- Floating Text with Armour --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
ShieldsArmourValue[ShieldsUnitDamagedLoopInteger] Greater than 0
-
-
Then - Actions
-
Floating Text - Change text of ShieldsArmourFloatingText[ShieldsUnitDamagedLoopInteger] to ((+ + ((String(ShieldsArmourValue[ShieldsUnitDamagedLoopInteger])) + ))) using font size 8.00
-
-
Else - Actions
-
-
Game - Display to (All players) the text: ((DamageTaken + (String(ShieldsUnitDamagedLoopInteger))) + (String(DamageTakenReals[ShieldsUnitDamagedLoopInteger])))
-
-
Else - Actions
-
-
-
-
-
-
Shields Regenerate
-
Events
-
Time - Every 0.50 seconds of game time
-
-
Conditions
-
Actions
-
For each (Integer ShieldsRegenerateLoopInteger) from 1 to ShieldsIndexInteger, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
ShieldsInitialValue[ShieldsRegenerateLoopInteger] Less than ShieldsMaxValue[ShieldsRegenerateLoopInteger]
-
-
Then - Actions
-
Set ShieldsInitialValue[ShieldsRegenerateLoopInteger] = (ShieldsInitialValue[ShieldsRegenerateLoopInteger] + 1)
-
Game - Display to (All players) the text: ((ShieldValue + (String(ShieldsRegenerateLoopInteger))) + (String(ShieldsMaxValue[ShieldsRegenerateLoopInteger])))
-
Floating Text - Change text of ShieldsFloatingText[ShieldsRegenerateLoopInteger] to ((String(ShieldsInitialValue[ShieldsRegenerateLoopInteger])) + ( / + (String(ShieldsMaxValue[ShieldsRegenerateLoopInteger])))) using font size 8.00
-
-
Else - Actions
-
-
-------- Surplus Decrease --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
ShieldsInitialValue[ShieldsRegenerateLoopInteger] Greater than ShieldsMaxValue[ShieldsRegenerateLoopInteger]
-
-
Then - Actions
-
Set ShieldsInitialValue[ShieldsRegenerateLoopInteger] = (ShieldsInitialValue[ShieldsRegenerateLoopInteger] - 1)
-
Game - Display to (All players) the text: ((ShieldValue + (String(ShieldsRegenerateLoopInteger))) + (String(ShieldsMaxValue[ShieldsRegenerateLoopInteger])))
-
Floating Text - Change text of ShieldsFloatingText[ShieldsRegenerateLoopInteger] to ((String(ShieldsInitialValue[ShieldsRegenerateLoopInteger])) + ( / + (String(ShieldsMaxValue[ShieldsRegenerateLoopInteger])))) using font size 8.00
-
-
Else - Actions
-
-
-------- Floating Text with Armour --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
ShieldsArmourValue[ShieldsRegenerateLoopInteger] Greater than 0
-
-
Then - Actions
-
Floating Text - Change text of ShieldsArmourFloatingText[ShieldsRegenerateLoopInteger] to ((+ + ((String(ShieldsArmourValue[ShieldsRegenerateLoopInteger])) + ))) using font size 8.00
-
-
Else - Actions
-
-
-
-
-
-
Shield Floating Texts Move
-
Events
-
Time - Every 0.01 seconds of game time
-
-
Conditions
-
Actions
-
For each (Integer FloatingTextsLoopInteger) from 1 to ShieldsIndexInteger, do (Actions)
-
Loop - Actions
-
Set ShieldsTrainedUnitPoint[FloatingTextsLoopInteger] = (Position of ShieldsTrainedUnit[FloatingTextsLoopInteger])
-
Floating Text - Change the position of ShieldsFloatingText[FloatingTextsLoopInteger] to (Center of ((Region centered at ShieldsTrainedUnitPoint[FloatingTextsLoopInteger] with size (0.00, 0.00)) offset by (-45.00, 0.00))) with Z offset 160.00
-
Floating Text - Change the position of ShieldsArmourFloatingText[FloatingTextsLoopInteger] to (Center of ((Region centered at ShieldsTrainedUnitPoint[FloatingTextsLoopInteger] with size (0.00, 0.00)) offset by (70.00, 0.00))) with Z offset 160.00
-
Custom script: call RemoveLocation (udg_ShieldsTrainedUnitPoint[udg_FloatingTextsLoopInteger])
-
-
-
-
-
Shield Texts OFF
-
Events
-
Unit - A unit Dies
-
-
Conditions
-
Actions
-
For each (Integer FloatingTextsOFFLoopInteger) from 1 to ShieldsIndexInteger, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Dying unit) Equal to ShieldsTrainedUnit[FloatingTextsOFFLoopInteger]
-
-
Then - Actions
-
Floating Text - Destroy ShieldsFloatingText[FloatingTextsOFFLoopInteger]
-
Floating Text - Destroy ShieldsArmourFloatingText[FloatingTextsOFFLoopInteger]
-
-------- Clean Up --------
-
Set ShieldsTrainedUnit[ShieldsUnitDamagedLoopInteger] = ShieldsTrainedUnit[ShieldsIndexInteger]
-
Set ShieldsTrainedUnit[FloatingTextsOFFLoopInteger] = ShieldsTrainedUnit[ShieldsIndexInteger]
-
Set ShieldsTrainedUnit[FloatingTextsLoopInteger] = ShieldsTrainedUnit[ShieldsIndexInteger]
-
Set ShieldsInitialValue[ShieldsUnitDamagedLoopInteger] = ShieldsInitialValue[ShieldsIndexInteger]
-
Set ShieldsInitialValue[ShieldsRegenerateLoopInteger] = ShieldsInitialValue[ShieldsIndexInteger]
-
Set ShieldsMaxValue[ShieldsUnitDamagedLoopInteger] = ShieldsMaxValue[ShieldsIndexInteger]
-
Set ShieldsMaxValue[ShieldsRegenerateLoopInteger] = ShieldsMaxValue[ShieldsIndexInteger]
-
Set ShieldsArmourValue[ShieldsUnitDamagedLoopInteger] = ShieldsArmourValue[ShieldsIndexInteger]
-
Set ShieldsArmourValue[ShieldsRegenerateLoopInteger] = ShieldsArmourValue[ShieldsIndexInteger]
-
Set DamageSourceUnits[ShieldsUnitDamagedLoopInteger] = DamageSourceUnits[ShieldsIndexInteger]
-
Set DamageTakenReals[ShieldsUnitDamagedLoopInteger] = DamageTakenReals[ShieldsIndexInteger]
-
Set LifesTaken[ShieldsUnitDamagedLoopInteger] = LifesTaken[ShieldsIndexInteger]
-
Set ShieldsFloatingText[ShieldsUnitDamagedLoopInteger] = ShieldsFloatingText[ShieldsIndexInteger]
-
Set ShieldsFloatingText[ShieldsRegenerateLoopInteger] = ShieldsFloatingText[ShieldsIndexInteger]
-
Set ShieldsFloatingText[FloatingTextsLoopInteger] = ShieldsFloatingText[ShieldsIndexInteger]
-
Set ShieldsFloatingText[FloatingTextsOFFLoopInteger] = ShieldsFloatingText[ShieldsIndexInteger]
-
Set ShieldsArmourFloatingText[ShieldsUnitDamagedLoopInteger] = ShieldsArmourFloatingText[ShieldsIndexInteger]
-
Set ShieldsArmourFloatingText[ShieldsRegenerateLoopInteger] = ShieldsArmourFloatingText[ShieldsIndexInteger]
-
Set ShieldsArmourFloatingText[FloatingTextsLoopInteger] = ShieldsArmourFloatingText[ShieldsIndexInteger]
-
Set ShieldsArmourFloatingText[FloatingTextsOFFLoopInteger] = ShieldsArmourFloatingText[ShieldsIndexInteger]
-
Set ShieldsIndexInteger = (ShieldsIndexInteger - 1)
-
Set FloatingTextsOFFLoopInteger = (FloatingTextsOFFLoopInteger - 1)
-
Set FloatingTextsLoopInteger = (FloatingTextsLoopInteger - 1)
-
Set ShieldsRegenerateLoopInteger = (ShieldsRegenerateLoopInteger - 1)
-
Set ShieldsUnitDamagedLoopInteger = (ShieldsUnitDamagedLoopInteger - 1)
-
-
Else - Actions
-
-
-
-
-
I've also attached the map file (patch 1.31.1).
I only want to use GUI so don't tell me about JASS (detection systems) please
The protoss shield setup is pretty much done. All it needs is to get around normal armour calculation of damage events and a means to make the shield visible on the map similar to the health and mana bars. File updated.
Direct help from: Uncle (post). Basically integrated Bribe's JASS damage detection system and unit indexer among others.
Indirect help from Devalut's Kinetic Barrier and Hermit's model edits (1 & 2).
PurgeandFire's Dynamic Indexing.
Link to .gif: post.
Much input from FeelsGoodMan regarding interceptor movement (post).
A lot of advice from Wrda regarding a MUI version (post).
Have to turn it to MUI.
Link to .gif: post.
Credits to Elvendan for his trigger here: Kill Nearest Unit
Still need help with the Carrier+Interceptors-like movement system.
post
Added a remade shield system based on unit get ability reals, mostly: post.
Remade it using real variables instead as advised by Uncle: post.
Attachments
Last edited: