Ardenian
A
Ardenian
[System] Deindex gone wrong ?
Hello,
again I have problems with finding the mistake.
The problem is, if an indexed unit dies, then all units of a corresponding indexed unit group should be de-indexed, but instead every unit is de-indexed, seems like.
I added a bit of documentation, I hope you can help me, I spent desperate hours searching for solutions.
You can find a bit of information about the system here: http://www.hiveworkshop.com/forums/spells-569/system-powersystem-supply-mana-v1-1-a-269200/
The triggers above are in German, sorry. If someone would like to take a look on an English one, most parts are translated thanks to KILLLCIDE in the resource thread.
EDIT: I managed to find a problem with not de-indexing the group, but it still does not work.
It seems that all suppliedunits are de-indexed, instead of only the one from the right group, or to say:
Generator1 built -> indexed
Generator2 built -> indexed
Generator1 destroyed -> SuppliedGroup[1] only has one unit in it, although it is supposed to have two.
Hello,
again I have problems with finding the mistake.
The problem is, if an indexed unit dies, then all units of a corresponding indexed unit group should be de-indexed, but instead every unit is de-indexed, seems like.
I added a bit of documentation, I hope you can help me, I spent desperate hours searching for solutions.
You can find a bit of information about the system here: http://www.hiveworkshop.com/forums/spells-569/system-powersystem-supply-mana-v1-1-a-269200/
-
PS Configuration
-
Ereignisse
-
Map initialization
-
-
Bedingungen
-
Aktionen
-
Custom script: local integer i = 1
-
-------- --------
-
-------- Set generator unit types --------
-
-------- --------
-
Set PS_GeneratorUnitType[1] = Small Generator
-
Set PS_GeneratorUnitType[2] = Big Generator
-
-------- --------
-
-------- Set corresponding mana transfer amount per target --------
-
-------- --------
-
Set PS_ManaAmount[1] = 10.00
-
Set PS_ManaAmount[2] = 20.00
-
-------- --------
-
-------- Set corresponding maximum target amount --------
-
-------- --------
-
Set PS_MaxTargets[1] = 3.00
-
Set PS_MaxTargets[2] = 5.00
-
-------- --------
-
-------- Set the ability being used to add/remove supplied units --------
-
-------- --------
-
Set PS_Ability = Add/Remove Power Link
-
-------- --------
-
Hashtabelle - Create a hashtable
-
Set Hash_PowerSystem = (Last created hashtable)
-
-------- --------
-
Custom script: loop
-
Custom script: exitwhen udg_PS_GeneratorUnitType[i] == null
-
Custom script: set udg_PS_TempInteger = udg_PS_GeneratorUnitType[i]
-
Custom script: set udg_PS_TempInteger2 = i
-
Hashtabelle - Save PS_ManaAmount[PS_TempInteger2] as 0 of PS_TempInteger in Hash_PowerSystem
-
Hashtabelle - Save PS_MaxTargets[PS_TempInteger2] as 1 of PS_TempInteger in Hash_PowerSystem
-
Hashtabelle - Save True as 0 of PS_TempInteger in Hash_PowerSystem
-
Custom script: set i = i + 1
-
Custom script: endloop
-
-
-
Index Supplier
-
Ereignisse
-
Einheit - A unit Vollendet den Bau
-
-
Bedingungen
-
Aktionen
-
Set PS_TempUnit = (Constructed structure)
-
-------- Get the unit type of the constructed building --------
-
Custom script: set udg_PS_TempInteger = GetUnitTypeId(GetConstructedStructure())
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
'IF'-Bedingungen
-
(Load 0 of PS_TempInteger from Hash_PowerSystem) Gleich True
-
(PS_TempUnit is in PS_GeneratorGroup) Gleich False
-
-
'THEN'-Aktionen
-
-------- If the unit type was indexed in the map initialization, then index it now for the loop --------
-
Set PS_SupplierMaxIndex = (PS_SupplierMaxIndex + 1)
-
Set PS_Generator[PS_SupplierMaxIndex] = PS_TempUnit
-
Einheitengruppe - Add PS_TempUnit to PS_GeneratorGroup
-
Set PS_Counter[PS_SupplierMaxIndex] = 0
-
Set PS_CurrentTargets[PS_SupplierMaxIndex] = 0.00
-
Custom script: set udg_PS_SupplyGroup[udg_PS_SupplierMaxIndex] = CreateGroup()
-
Einheitengruppe - Add PS_Generator[PS_SupplierMaxIndex] to PS_SupplyGroup[PS_SupplierMaxIndex]
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
'IF'-Bedingungen
-
PS_SupplierMaxIndex Gleich 1
-
-
'THEN'-Aktionen
-
Auslöser - Turn on Loop <gen>
-
-
'ELSE'-Aktionen
-
-
-
'ELSE'-Aktionen
-
-
-
-
Add Remove Supplied Units
-
Ereignisse
-
Einheit - A unit Beginnt, eine Fähigkeit zu wirken
-
-
Bedingungen
-
(Ability being cast) Gleich PS_Ability
-
-
Aktionen
-
Set PS_TempUnit = (Target unit of ability being cast)
-
For each (Integer PS_TempInteger2) from 1 to PS_SupplierMaxIndex, do (Actions)
-
Schleifen - Aktionen
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
'IF'-Bedingungen
-
(Casting unit) Gleich PS_Generator[PS_TempInteger2]
-
-
'THEN'-Aktionen
-
Set PS_TempUnitType = (Unit-type of PS_Generator[PS_TempInteger2])
-
Custom script: set udg_PS_TempInteger = udg_PS_TempUnitType
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
'IF'-Bedingungen
-
(PS_TempUnit is in PS_SupplyGroup[PS_TempInteger2]) Gleich False
-
PS_CurrentTargets[PS_TempInteger2] Kleiner als (Load 1 of PS_TempInteger from Hash_PowerSystem)
-
-
'THEN'-Aktionen
-
-------- Actions if the unit is not in the supply group of the casting generator --------
-
-------- Adds the unit to the generator supply group --------
-
-------- Indexes the supplied target and its special effect dummies --------
-
Set PS_TargetMaxIndex = (PS_TargetMaxIndex + 1)
-
Set PS_Suppliedtarget[PS_TargetMaxIndex] = PS_TempUnit
-
Einheitengruppe - Add PS_Suppliedtarget[PS_TargetMaxIndex] to PS_SupplyGroup[PS_TempInteger2]
-
Set PS_TempLoc = (Position of PS_TempUnit)
-
Einheit - Create 1 PS_Dummy_Caster for (Owner of PS_TempUnit) at PS_TempLoc facing Vorgabe für Gebäude-Ausrichtung degrees
-
Custom script: call RemoveLocation(udg_PS_TempLoc)
-
Set PS_SpecialEffectCaster[PS_TargetMaxIndex] = (Last created unit)
-
Set PS_TempLoc = (Position of PS_Generator[PS_TempInteger2])
-
Einheit - Create 1 PS_Dummy_Aim for Neutral feindlich at PS_TempLoc facing Vorgabe für Gebäude-Ausrichtung degrees
-
Custom script: call RemoveLocation(udg_PS_TempLoc)
-
Set PS_SpecialEffectAim[PS_TargetMaxIndex] = (Last created unit)
-
Einheit - Set mana of PS_SpecialEffectAim[PS_TargetMaxIndex] to 100.00%
-
Einheit - Order PS_SpecialEffectCaster[PS_TargetMaxIndex] to Menschen-Blutmagier - 'Mana abziehen' PS_SpecialEffectAim[PS_TargetMaxIndex]
-
Set PS_CurrentTargets[PS_TempInteger2] = (PS_CurrentTargets[PS_TempInteger2] + 1.00)
-
-
'ELSE'-Aktionen
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
'IF'-Bedingungen
-
(PS_TempUnit is in PS_SupplyGroup[PS_TempInteger2]) Gleich True
-
PS_CurrentTargets[PS_TempInteger2] Kleiner gleich (Load 1 of PS_TempInteger from Hash_PowerSystem)
-
-
'THEN'-Aktionen
-
For each (Integer PS_TempInteger3) from 1 to PS_TargetMaxIndex, do (Actions)
-
Schleifen - Aktionen
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
'IF'-Bedingungen
-
PS_TempUnit Gleich PS_Suppliedtarget[PS_TempInteger3]
-
-
'THEN'-Aktionen
-
-------- Actions if the unit is in the supply group of the casting generator --------
-
-------- Remove the unit from the generator supply group --------
-
-------- De-indexes the supplied target and its special effect dummies --------
-
Set PS_CurrentTargets[PS_TempInteger2] = (PS_CurrentTargets[PS_TempInteger2] - 1.00)
-
Einheitengruppe - Remove PS_Suppliedtarget[PS_TempInteger3] from PS_SupplyGroup[PS_TempInteger2]
-
Einheit - Order PS_SpecialEffectCaster[PS_TempInteger3] to Stoppen
-
Einheit - Remove PS_SpecialEffectCaster[PS_TempInteger3] from the game
-
Einheit - Remove PS_SpecialEffectAim[PS_TempInteger3] from the game
-
Set PS_Suppliedtarget[PS_TempInteger3] = PS_Suppliedtarget[PS_TargetMaxIndex]
-
Set PS_SuppliedGroup[PS_TempInteger2] = PS_SuppliedGroup[PS_TargetMaxIndex]
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Set PS_SpecialEffectCaster[PS_TempInteger3] = PS_SpecialEffectCaster[PS_TargetMaxIndex]
-
Set PS_SpecialEffectAim[PS_TempInteger3] = PS_SpecialEffectAim[PS_TargetMaxIndex]
-
Set PS_TargetMaxIndex = (PS_TargetMaxIndex - 1)
-
Set PS_TempInteger3 = (PS_TempInteger3 - 1)
-
'ELSE'-Aktionen
-
'ELSE'-Aktionen
-
-------- Actions if the casting unit has rreached its maximum of supplied target amount --------
-
Quest - Display to (All players) the Warnung message: This unit cannot su...
-
-
'ELSE'-Aktionen
-
-
Deindex upon death
-
Ereignisse
-
Einheit - A unit Stirbt
-
-
Bedingungen
-
Aktionen
-
-------- De-index of the supplied group of the dying generator --------
-
Set PS_TempUnit = (Dying unit)
-
For each (Integer PS_TempInteger2) from 1 to PS_SupplierMaxIndex, do (Actions)
-
Schleifen - Aktionen
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
'IF'-Bedingungen
-
PS_TempUnit Gleich PS_Generator[PS_TempInteger2]
-
-
'THEN'-Aktionen
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
'IF'-Bedingungen
-
(PS_TempUnit is in PS_SupplyGroup[PS_TempInteger2]) Gleich True
-
-
'THEN'-Aktionen
-
For each (Integer PS_TempInteger3) from 1 to PS_TargetMaxIndex, do (Actions)
-
Schleifen - Aktionen
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
'IF'-Bedingungen
-
(PS_Suppliedtarget[PS_TempInteger3] is in PS_SupplyGroup[PS_TempInteger2]) Gleich True
-
-
'THEN'-Aktionen
-
Einheitengruppe - Remove PS_Suppliedtarget[PS_TempInteger3] from PS_SupplyGroup[PS_TempInteger2]
-
Einheit - Order PS_SpecialEffectCaster[PS_TempInteger3] to Stoppen
-
Einheit - Remove PS_SpecialEffectCaster[PS_TempInteger3] from the game
-
Einheit - Remove PS_SpecialEffectAim[PS_TempInteger3] from the game
-
Set PS_Suppliedtarget[PS_TempInteger3] = PS_Suppliedtarget[PS_TargetMaxIndex]
-
Set PS_SpecialEffectCaster[PS_TempInteger3] = PS_SpecialEffectCaster[PS_TargetMaxIndex]
-
Set PS_SpecialEffectAim[PS_TempInteger3] = PS_SpecialEffectAim[PS_TargetMaxIndex]
-
Set PS_TargetMaxIndex = (PS_TargetMaxIndex - 1)
-
Set PS_TempInteger3 = (PS_TempInteger3 - 1)
-
-
'ELSE'-Aktionen
-
-
-
-
-
'ELSE'-Aktionen
-
-
-
'ELSE'-Aktionen
-
-
-
-
-
-
Ereignisse
-
Zeit - Every 0.05 seconds of game time
-
The triggers above are in German, sorry. If someone would like to take a look on an English one, most parts are translated thanks to KILLLCIDE in the resource thread.
EDIT: I managed to find a problem with not de-indexing the group, but it still does not work.
It seems that all suppliedunits are de-indexed, instead of only the one from the right group, or to say:
Generator1 built -> indexed
Generator2 built -> indexed
Generator1 destroyed -> SuppliedGroup[1] only has one unit in it, although it is supposed to have two.
Last edited by a moderator: