- Joined
- Nov 10, 2008
- Messages
- 2,023
Hi everybody.
Im currently working on a system of mine. The buff engine.
The problem is that its just not MUI.
I'll give you the code. The system contains 3 example triggers and the loop.
It seems to be something with the loop.
When casting a buff on several units, they will have infinity duration.
When casting two buffs different buffs on units, all of them will have the latest casted buff in inifity time. I hope you can help me.
~x-omg-x
[Update]
- Allright, i have found out that my system isnt indexing right, but i dont know how to fix it. Could anyone help me?
- The problem is that it in the loop, is replacing the old values with the new ones.
Im currently working on a system of mine. The buff engine.
The problem is that its just not MUI.
I'll give you the code. The system contains 3 example triggers and the loop.
It seems to be something with the loop.
When casting a buff on several units, they will have infinity duration.
When casting two buffs different buffs on units, all of them will have the latest casted buff in inifity time. I hope you can help me.
~x-omg-x
-
Example 1
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Buff [Example1]
-
-
Actions
-
-------- --------
-
-------- Indexing --------
-
-------- --------
-
Set Buff_IndexMax = 50
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Buff_IndexSize Less than Buff_IndexMax
-
-
Then - Actions
-
Set Buff_IndexSize = (Buff_IndexSize + 1)
-
-
Else - Actions
-
Set Buff_IndexSize = 0
-
-
-
Set Buff_Index = Buff_IndexSize
-
-------- --------
-
-------- Settings --------
-
-------- --------
-
Set Buff_Caster[Buff_Index] = (Triggering unit)
-
Set Buff_SpecialEffect[Buff_Index] = Abilities\Spells\Items\AIre\AIreTarget.mdl
-
Set Buff_Position[Buff_Index] = (Position of Buff_Caster[Buff_Index])
-
Set Buff_Movementspeed[Buff_Index] = (500.00 + (100.00 x (Real((Level of Buff [Example1] for Buff_Caster[Buff_Index])))))
-
Set Buff_Heal[Buff_Index] = 0.00
-
Set Buff_Damage[Buff_Index] = 25.00
-
Set Buff_Duration[Buff_Index] = 5.00
-
-------- --------
-
-------- Starting Up --------
-
-------- --------
-
Unit - Set the custom value of Buff_Caster[Buff_Index] to (Integer(Buff_Duration[Buff_Index]))
-
Unit Group - Add Buff_Caster[Buff_Index] to Buff_Group
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Buff Engine <gen> is on) Equal to True
-
-
Then - Actions
-
Else - Actions
-
Trigger - Turn on Buff Engine <gen>
-
-
-
Custom script: call RemoveLocation(udg_Buff_Position[udg_Buff_Index])
-
-
-
Example 2
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Buff [Example2]
-
-
Actions
-
-------- --------
-
-------- Indexing --------
-
-------- --------
-
Set Buff_IndexMax = 50
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Buff_IndexSize Less than Buff_IndexMax
-
-
Then - Actions
-
Set Buff_IndexSize = (Buff_IndexSize + 1)
-
-
Else - Actions
-
Set Buff_IndexSize = 0
-
-
-
Set Buff_Index = Buff_IndexSize
-
-------- --------
-
-------- Settings --------
-
-------- --------
-
Set Buff_Caster[Buff_Index] = (Triggering unit)
-
Set Buff_SpecialEffect[Buff_Index] = Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
-
Set Buff_Position[Buff_Index] = (Position of Buff_Caster[Buff_Index])
-
Set Buff_Movementspeed[Buff_Index] = 0.00
-
Set Buff_Heal[Buff_Index] = 20.00
-
Set Buff_Damage[Buff_Index] = 0.00
-
Set Buff_Duration[Buff_Index] = (5.00 + (5.00 x (Real((Level of Buff [Example2] for Buff_Caster[Buff_Index])))))
-
-------- --------
-
-------- Starting Up --------
-
-------- --------
-
Unit - Set the custom value of Buff_Caster[Buff_Index] to (Integer(Buff_Duration[Buff_Index]))
-
Unit Group - Add Buff_Caster[Buff_Index] to Buff_Group
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Buff Engine <gen> is on) Equal to True
-
-
Then - Actions
-
Else - Actions
-
Trigger - Turn on Buff Engine <gen>
-
-
-
Custom script: call RemoveLocation(udg_Buff_Position[udg_Buff_Index])
-
-
-
Example 3
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Buff [Example3]
-
-
Actions
-
-------- --------
-
-------- Indexing --------
-
-------- --------
-
Set Buff_IndexMax = 50
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Buff_IndexSize Less than Buff_IndexMax
-
-
Then - Actions
-
Set Buff_IndexSize = (Buff_IndexSize + 1)
-
-
Else - Actions
-
Set Buff_IndexSize = 0
-
-
-
Set Buff_Index = Buff_IndexSize
-
-------- --------
-
-------- Settings --------
-
-------- --------
-
Set Buff_Caster[Buff_Index] = (Target unit of ability being cast)
-
Set Buff_SpecialEffect[Buff_Index] = Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
-
Set Buff_Position[Buff_Index] = (Position of Buff_Caster[Buff_Index])
-
Set Buff_Movementspeed[Buff_Index] = 300.00
-
Set Buff_Heal[Buff_Index] = 0.00
-
Set Buff_Damage[Buff_Index] = (5.00 + (5.00 + (Real((Level of Buff [Example3] for Buff_Caster[Buff_Index])))))
-
Set Buff_Duration[Buff_Index] = 5.00
-
-------- --------
-
-------- Starting Up --------
-
-------- --------
-
Unit - Set the custom value of Buff_Caster[Buff_Index] to (Integer(Buff_Duration[Buff_Index]))
-
Unit Group - Add Buff_Caster[Buff_Index] to Buff_Group
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Buff Engine <gen> is on) Equal to True
-
-
Then - Actions
-
Else - Actions
-
Trigger - Turn on Buff Engine <gen>
-
-
-
Custom script: call RemoveLocation(udg_Buff_Position[udg_Buff_Index])
-
-
-
Buff Engine
-
Events
-
Time - Every 1.00 seconds of game time
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in Buff_Group and do (Actions)
-
Loop - Actions
-
Set Buff_Position[Buff_Index] = (Position of (Picked unit))
-
Set Buff_CustomValue[Buff_Index] = (Custom value of (Picked unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
Buff_CustomValue[Buff_Index] Less than or equal to 0
-
((Picked unit) is alive) Equal to False
-
-
-
-
Then - Actions
-
Unit - Set (Picked unit) movement speed to (Default movement speed of (Picked unit))
-
Unit Group - Remove (Picked unit) from Buff_Group
-
-
Else - Actions
-
Set Buff_Duration[Buff_Index] = (Buff_Duration[Buff_Index] - 1.00)
-
Unit - Set the custom value of Buff_Caster[Buff_Index] to (Integer(Buff_Duration[Buff_Index]))
-
Special Effect - Create a special effect at Buff_Position[Buff_Index] using Buff_SpecialEffect[Buff_Index]
-
Special Effect - Destroy (Last created special effect)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Buff_Damage[Buff_Index] Greater than 0.00
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Life of (Picked unit)) Greater than Buff_Damage[Buff_Index]
-
-
Then - Actions
-
Unit - Cause (Picked unit) to damage (Picked unit), dealing Buff_Damage[Buff_Index] damage of attack type Spells and damage type Normal
-
-
Else - Actions
-
Unit - Set life of (Picked unit) to 1.00
-
-
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Buff_Heal[Buff_Index] Greater than 0.00
-
-
Then - Actions
-
Unit - Cause (Picked unit) to damage (Picked unit), dealing (0.00 - Buff_Heal[Buff_Index]) damage of attack type Spells and damage type Normal
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Buff_Movementspeed[Buff_Index] Greater than 0.00
-
-
Then - Actions
-
Unit - Set (Picked unit) movement speed to ((Default movement speed of (Picked unit)) + Buff_Movementspeed[Buff_Index])
-
-
Else - Actions
-
-
-
-
Custom script: call RemoveLocation(udg_Buff_Position[udg_Buff_Index])
-
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in Buff_Group) Equal to 0
-
-
Then - Actions
-
Trigger - Turn off (This trigger)
-
-
Else - Actions
-
-
-
- Allright, i have found out that my system isnt indexing right, but i dont know how to fix it. Could anyone help me?
- The problem is that it in the loop, is replacing the old values with the new ones.
Last edited: