• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Indexing System ?

Status
Not open for further replies.
Level 13
Joined
Mar 29, 2012
Messages
542
I don't know whats wrong about this spell (Quicksands) !!

Spell Description :
Slam the ground, summoning a magical sands that will move to targeted point. The sands will suck nearby enemy ground unit when reach the targeted point for a seconds and damaging them per second. After sucking, the sands will explode and causing damage to nearby enemy ground unit in AoE.
Level 1 - 5 sucking damage, 50 explosion damage, 400 AoE.
Level 2 - 7 sucking damage, 75 explosion damage, 425 AoE.
Level 3 - 10 sucking damage, 100 explosion damage, 450 AoE.

Problem :
If the spell casted more than the ability level, the sands will not suck, it just explode.

This is the triggers
[trigger=]Q Configuration
Events
Map initialization
Conditions
Actions
Set Temp_Point = (Center of (Playable map area))
Unit - Create 1 Peasant for Neutral Passive at Temp_Point facing (Random angle) degrees
Custom script: call RemoveLocation(udg_Temp_Point)
Set Harvester = (Last created unit)
Unit - Make Harvester Invulnerable
Unit - Hide Harvester
-------- CONFIGURABLE --------
Set Q_Ability = Quicksands
Set Q_Sands_Speed[1] = 30.00
Set Q_Sands_Speed[2] = 30.00
Set Q_Sands_Speed[3] = 30.00
Set Q_Sucking_Speed[1] = 10.00
Set Q_Sucking_Speed[2] = 10.00
Set Q_Sucking_Speed[3] = 10.00
Set Q_Explosion_Sands_Speed[1] = 30.00
Set Q_Explosion_Sands_Speed[2] = 30.00
Set Q_Explosion_Sands_Speed[3] = 30.00
Set Q_Sucking_Damage[1] = 5.00
Set Q_Sucking_Damage[2] = 7.00
Set Q_Sucking_Damage[3] = 10.00
Set Q_Explosion_Damage[1] = 50.00
Set Q_Explosion_Damage[2] = 75.00
Set Q_Explosion_Damage[3] = 100.00
Set Q_Sucking_AoE[1] = 400.00
Set Q_Sucking_AoE[2] = 425.00
Set Q_Sucking_AoE[3] = 450.00
Set Q_Explosion_Sands_AoE[1] = 100.00
Set Q_Explosion_Sands_AoE[2] = 100.00
Set Q_Explosion_Sands_AoE[3] = 100.00
Set Q_Explosion_AoE[1] = 400.00
Set Q_Explosion_AoE[2] = 425.00
Set Q_Explosion_AoE[3] = 450.00
Set Q_Sucking_Duration[1] = 5.00
Set Q_Sucking_Duration[2] = 6.00
Set Q_Sucking_Duration[3] = 7.00
Set Q_Effect[1] = Abilities\Spells\NightElf\BattleRoar\RoarCaster.mdl
Set Q_Effect[2] = Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
Set Q_Effect[3] = Abilities\Spells\Other\Volcano\VolcanoDeath.mdl
Set Q_Effect[4] = Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
Set Q_Effect[5] = Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
Set Q_Destroy_Tree = True
Set Q_Attack_Type = Chaos
Set Q_Damage_Type = Normal
[/trigger]
[trigger=]Q Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Q_Ability
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Q_Index_Size Equal to 0
Then - Actions
Trigger - Turn on Q Loop <gen>
Else - Actions
Set Q_Index_Size = (Q_Index_Size + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Q_Index_Size Greater than Q_Max_Index
Then - Actions
Set Q_Index[Q_Index_Size] = Q_Index_Size
Set Q_Max_Index = Q_Index_Size
Else - Actions
Set Q_Current_Index = Q_Index[Q_Index_Size]
Set Q_Caster[Q_Current_Index] = (Triggering unit)
Set Q_Player[Q_Current_Index] = (Owner of Q_Caster[Q_Current_Index])
Set Q_Level = (Level of (Ability being cast) for Q_Caster[Q_Current_Index])
Set Q_Sands_Speed[Q_Current_Index] = Q_Sands_Speed[Q_Level]
Set Q_Sucking_Speed[Q_Current_Index] = Q_Sucking_Speed[Q_Level]
Set Q_Explosion_Sands_Speed[Q_Current_Index] = Q_Explosion_Sands_Speed[Q_Level]
Set Q_Sucking_Damage[Q_Current_Index] = Q_Sucking_Damage[Q_Level]
Set Q_Explosion_Damage[Q_Current_Index] = Q_Explosion_Damage[Q_Level]
Set Q_Sucking_AoE[Q_Current_Index] = Q_Sucking_AoE[Q_Level]
Set Q_Explosion_Sands_AoE[Q_Current_Index] = Q_Explosion_Sands_AoE[Q_Level]
Set Q_Explosion_AoE[Q_Current_Index] = Q_Explosion_AoE[Q_Level]
Set Q_Sucking_Duration[Q_Current_Index] = Q_Sucking_Duration[Q_Level]
Custom script: set udg_Q_Sands_Group[udg_Q_Current_Index] = CreateGroup()
Custom script: set udg_Q_Damaged_Group[udg_Q_Current_Index] = CreateGroup()
Set Q_Sucking[Q_Current_Index] = False
Set Q_Explode[Q_Current_Index] = False
Set Q_Effect_Delay[Q_Current_Index] = 0.00
Set Q_Damage_Delay[Q_Current_Index] = 0.00
Set Temp_Point = (Position of Q_Caster[Q_Current_Index])
Set Temp_Point2 = (Target point of ability being cast)
Set Q_Distance[Q_Current_Index] = (Distance between Temp_Point and Temp_Point2)
Set Q_Angle[Q_Current_Index] = (Angle from Temp_Point to Temp_Point2)
Custom script: call RemoveLocation(udg_Temp_Point2)
Special Effect - Create a special effect at Temp_Point using Q_Effect[1]
Special Effect - Destroy (Last created special effect)
Unit - Create 1 Missile Dummy for Q_Player[Q_Current_Index] at Temp_Point facing (Random angle) degrees
Set Q_Sands[Q_Current_Index] = (Last created unit)
Unit - Turn collision for Q_Sands[Q_Current_Index] Off
Unit - Move Q_Sands[Q_Current_Index] instantly to Temp_Point
Custom script: call RemoveLocation(udg_Temp_Point)
[/trigger]
[trigger=]Q Loop
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
For each (Integer Q_Loop) from 1 to Q_Index_Size, do (Actions)
Loop - Actions
Set Q_Current_Index = Q_Index[Q_Loop]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Q_Sucking[Q_Current_Index] Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Q_Explode[Q_Current_Index] Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Q_Sands_Group[Q_Current_Index] is empty) Equal to True
Then - Actions
Unit Group - Remove all units from Q_Sands_Group[Q_Current_Index]
Unit Group - Remove all units from Q_Damaged_Group[Q_Current_Index]
Custom script: call DestroyGroup(udg_Q_Sands_Group[udg_Q_Current_Index])
Custom script: call DestroyGroup(udg_Q_Damaged_Group[udg_Q_Current_Index])
Set Q_Index[Q_Loop] = Q_Index[Q_Index_Size]
Set Q_Index[Q_Index_Size] = Q_Current_Index
Set Q_Index_Size = (Q_Index_Size - 1)
Set Q_Loop = (Q_Loop - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Q_Index_Size Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
Else - Actions
Unit Group - Pick every unit in Q_Sands_Group[Q_Current_Index] and do (Actions)
Loop - Actions
Set Temp_Point = (Position of (Picked unit))
Set Temp_Point2 = (Temp_Point offset by Q_Explosion_Sands_Speed[Q_Current_Index] towards (Facing of (Picked unit)) degrees)
Custom script: call RemoveLocation(udg_Temp_Point)
Unit - Move (Picked unit) instantly to Temp_Point2
Special Effect - Create a special effect at Temp_Point2 using Q_Effect[5]
Special Effect - Destroy (Last created special effect)
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units within Q_Explosion_Sands_AoE[Q_Current_Index] of Temp_Point2 matching ((((Matching unit) belongs to an ally of Q_Player[Q_Current_Index]) Equal to False) and ((((Matching unit) is dead) Equal to False) and ((((Matching unit) is A flying unit) Equal to and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in Q_Damaged_Group[Q_Current_Index]) Equal to True
Then - Actions
Else - Actions
Unit - Cause Q_Caster[Q_Current_Index] to damage (Picked unit), dealing Q_Explosion_Damage[Q_Current_Index] damage of attack type Q_Attack_Type and damage type Q_Damage_Type
Unit Group - Add (Picked unit) to Q_Damaged_Group[Q_Current_Index]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Q_Destroy_Tree Equal to True
Then - Actions
Destructible - Pick every destructible within Q_Explosion_Sands_AoE[Q_Current_Index] of Temp_Point2 and do (Actions)
Loop - Actions
Unit - Order Harvester to Harvest (Picked destructible)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Current order of Harvester) Equal to (Order(harvest))
Then - Actions
Destructible - Kill (Picked destructible)
Else - Actions
Unit - Order Harvester to Stop
Else - Actions
Custom script: call RemoveLocation(udg_Temp_Point2)
Set Q_Explosion_AoE[Q_Current_Index] = (Q_Explosion_AoE[Q_Current_Index] - Q_Explosion_Sands_Speed[Q_Current_Index])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Q_Explosion_AoE[Q_Current_Index] Less than or equal to 0.00
Then - Actions
Unit Group - Pick every unit in Q_Sands_Group[Q_Current_Index] and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Q_Sucking_Duration[Q_Current_Index] Greater than 0.00
Then - Actions
Set Temp_Point = (Position of Q_Sands[Q_Current_Index])
Set Temp_Point2 = (Temp_Point offset by (Random real number between 0.00 and Q_Sucking_AoE[Q_Current_Index]) towards (Random angle) degrees)
Special Effect - Create a special effect at Temp_Point2 using Q_Effect[4]
Special Effect - Destroy (Last created special effect)
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units within Q_Sucking_AoE[Q_Current_Index] of Temp_Point2 matching ((((Matching unit) belongs to an ally of Q_Player[Q_Current_Index]) Equal to False) and ((((Matching unit) is dead) Equal to False) and ((((Matching unit) is A structure) Equal to False) and and do (Actions)
Loop - Actions
Set Q_Sucking_Unit = (Picked unit)
Set Temp_Point3 = (Position of Q_Sucking_Unit)
Set Q_Suck_Angle = (Angle from Temp_Point3 to Temp_Point)
Set Temp_Point4 = (Temp_Point3 offset by Q_Sucking_Speed[Q_Current_Index] towards Q_Suck_Angle degrees)
Custom script: call RemoveLocation(udg_Temp_Point3)
Set Q_Point_X = (X of Temp_Point4)
Set Q_Point_Y = (Y of Temp_Point4)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Terrain pathing at Temp_Point4 of type Walkability is off) Equal to True
Then - Actions
Else - Actions
Custom script: call SetUnitX(udg_Q_Sucking_Unit, udg_Q_Point_X)
Custom script: call SetUnitY(udg_Q_Sucking_Unit, udg_Q_Point_Y)
Custom script: call RemoveLocation(udg_Temp_Point4)
Custom script: call RemoveLocation(udg_Temp_Point)
Set Q_Damage_Delay[Q_Current_Index] = (Q_Damage_Delay[Q_Current_Index] + 0.03)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Q_Damage_Delay[Q_Current_Index] Greater than or equal to 1.00
Then - Actions
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units within Q_Sucking_AoE[Q_Current_Index] of Temp_Point2 matching ((((Matching unit) belongs to an ally of Q_Player[Q_Current_Index]) Equal to False) and ((((Matching unit) is dead) Equal to False) and ((((Matching unit) is A structure) Equal to False) and and do (Actions)
Loop - Actions
Unit - Cause Q_Caster[Q_Current_Index] to damage (Picked unit), dealing Q_Sucking_Damage[Q_Current_Index] damage of attack type Q_Attack_Type and damage type Q_Damage_Type
Set Q_Damage_Delay[Q_Current_Index] = 0.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Q_Destroy_Tree Equal to True
Then - Actions
Destructible - Pick every destructible within Q_Sucking_AoE[Q_Current_Index] of Temp_Point2 and do (Actions)
Loop - Actions
Unit - Order Harvester to Harvest (Picked destructible)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Current order of Harvester) Equal to (Order(harvest))
Then - Actions
Destructible - Kill (Picked destructible)
Else - Actions
Unit - Order Harvester to Stop
Else - Actions
Custom script: call RemoveLocation(udg_Temp_Point2)
Set Q_Sucking_Duration[Q_Current_Index] = (Q_Sucking_Duration[Q_Current_Index] - 0.03)
Else - Actions
Set Q_Explosion_Angle = (Random angle)
Set Temp_Point = (Position of Q_Sands[Q_Current_Index])
For each (Integer Q_Loop2) from 1 to 5, do (Actions)
Loop - Actions
Set Q_Explosion_Angle = (Q_Explosion_Angle + (360.00 / (Real(5))))
Unit - Create 1 Missile Dummy for Q_Player[Q_Current_Index] at Temp_Point facing Q_Explosion_Angle degrees
Unit - Turn collision for (Last created unit) Off
Unit - Move (Last created unit) instantly to Temp_Point
Unit Group - Add (Last created unit) to Q_Sands_Group[Q_Current_Index]
Custom script: call RemoveLocation(udg_Temp_Point)
Unit - Kill Q_Sands[Q_Current_Index]
Set Q_Explode[Q_Current_Index] = True
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Q_Distance[Q_Current_Index] Greater than 0.00
Then - Actions
Set Temp_Point = (Position of Q_Sands[Q_Current_Index])
Set Temp_Point2 = (Temp_Point offset by Q_Sands_Speed[Q_Current_Index] towards Q_Angle[Q_Current_Index] degrees)
Custom script: call RemoveLocation(udg_Temp_Point)
Unit - Move Q_Sands[Q_Current_Index] instantly to Temp_Point2
Set Q_Effect_Delay[Q_Current_Index] = (Q_Effect_Delay[Q_Current_Index] + 0.03)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Q_Effect_Delay[Q_Current_Index] Greater than or equal to 0.09
Then - Actions
Special Effect - Create a special effect at Temp_Point2 using Q_Effect[2]
Special Effect - Destroy (Last created special effect)
Set Q_Effect_Delay[Q_Current_Index] = 0.00
Else - Actions
Custom script: call RemoveLocation(udg_Temp_Point2)
Set Q_Distance[Q_Current_Index] = (Q_Distance[Q_Current_Index] - Q_Sands_Speed[Q_Current_Index])
Else - Actions
Special Effect - Create a special effect at Temp_Point2 using Q_Effect[3]
Special Effect - Destroy (Last created special effect)
Set Q_Sucking[Q_Current_Index] = True
[/trigger]


[highlight]+1 Reputation[/code] to who can help me !!

Email : [email protected]
Facebook : Ofel Rondonuwu
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
Never been a great coder, but these triggers look, redundant.
I'm not sure you need to set so many variables, wouldn't it waste memory?
And that periodically running trigger looks laggy (lot of processing per second there).

Sorry I can't help fix it though :/
 
Status
Not open for further replies.
Top