• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] A cluster-rockets based spell does not work correctly

Status
Not open for further replies.
Level 13
Joined
Mar 29, 2012
Messages
530
Many bug....!!!!

I making spell named Cluster Rockets, the caster will fire a rocket, that rocket will split into several rockets when reach some distance and explode when reach the target point.

Bugs :
the first rocket is moving, but when it split into several rockets, only one rocket will move, badly when that rocket reach the target point that rocket not explode, also not deal damage.:ogre_rage:

Can't you help me guys fix it....:vw_unimpressed:

Here the triggers

[trigger=]CR Configuration
Events
Conditions
Actions
Set CR_Rocket_Speed[1] = 20.00
Set CR_Rocket_Speed[2] = 20.00
Set CR_Rocket_Speed[3] = 20.00
Set CR_Rocket_AoE[1] = 50.00
Set CR_Rocket_AoE[2] = 50.00
Set CR_Rocket_AoE[3] = 50.00
Set CR_Explosion_Damage[1] = 50.00
Set CR_Explosion_Damage[2] = 75.00
Set CR_Explosion_Damage[3] = 100.00
Set CR_Explosion_AoE[1] = 150.00
Set CR_Explosion_AoE[2] = 150.00
Set CR_Explosion_AoE[3] = 150.00
Set CR_Split_Rockets[1] = 3
Set CR_Split_Rockets[2] = 4
Set CR_Split_Rockets[3] = 5
Set CR_Split_Distance = 400.00
Set CR_Rocket_Height = 75.00
Set CR_Effect[1] = Abilities\Weapons\GlaiveMissile\GlaiveMissileTarget.mdl
Set CR_Effect[2] = Abilities\Spells\Other\Doom\DoomDeath.mdl
Set CR_Attack_Type = Siege
Set CR_Damage_Type = Demolition
[/trigger]
[trigger=]CR Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Cluster Rockets
Actions
Trigger - Run CR Configuration <gen> (ignoring conditions)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
Harvester Equal to No unit
(Harvester is dead) Equal to True
Then - Actions
Unit - Create 1 Peasant for Neutral Passive at (Position of (Triggering unit)) facing (Random angle) degrees
Set Harvester = (Last created unit)
Unit - Make Harvester Invulnerable
Unit - Hide Harvester
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
CR_Index_Listener Equal to 0
Then - Actions
Trigger - Turn on CR Loop <gen>
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
CR_Recycle_Size Greater than 0
Then - Actions
Set CR_Recycle_Size = (CR_Recycle_Size - 1)
Set CR_Current_Index = CR_Index_Container[CR_Recycle_Size]
Else - Actions
Set CR_Current_Index = CR_Index_Size
Set CR_Index_Size = (CR_Index_Size + 1)
Set CR_Caster[CR_Current_Index] = (Triggering unit)
Set CR_Player[CR_Current_Index] = (Owner of CR_Caster[CR_Current_Index])
Set CR_Target_Point[CR_Current_Index] = (Target point of ability being cast)
Set CR_Level = (Level of Cluster Rockets for CR_Caster[CR_Current_Index])
Set CR_Rocket_Speed[CR_Current_Index] = CR_Rocket_Speed[CR_Level]
Set CR_Rocket_AoE[CR_Current_Index] = CR_Rocket_AoE[CR_Level]
Set CR_Explosion_Damage[CR_Current_Index] = CR_Explosion_Damage[CR_Level]
Set CR_Explosion_AoE[CR_Current_Index] = CR_Explosion_AoE[CR_Level]
Set CR_Split_Rockets[CR_Current_Index] = CR_Split_Rockets[CR_Level]
Set Temp_Location[1] = (Position of CR_Caster[CR_Current_Index])
Set Temp_Location[2] = (Target point of ability being cast)
Set CR_Angle[CR_Current_Index] = (Angle from Temp_Location[1] to Temp_Location[2])
Set CR_Distance[CR_Current_Index] = (Distance between Temp_Location[1] and Temp_Location[2])
Custom script: set udg_CR_Splitted_Group[udg_CR_Current_Index] = CreateGroup()
Set CR_Splitted[CR_Current_Index] = False
Set CR_Reached[CR_Current_Index] = False
Unit - Create 1 Rocket Dummy for CR_Player[CR_Current_Index] at Temp_Location[1] facing CR_Angle[CR_Current_Index] degrees
Unit - Turn collision for (Last created unit) Off
Unit - Move (Last created unit) instantly to Temp_Location[1]
Animation - Change (Last created unit) flying height to CR_Rocket_Height at 0.00
Set CR_Rocket[CR_Current_Index] = (Last created unit)
Custom script: call RemoveLocation(udg_Temp_Location[1])
Custom script: call RemoveLocation(udg_Temp_Location[2])
Set CR_Index_Container[CR_Index_Listener] = CR_Current_Index
Set CR_Index_Listener = (CR_Index_Listener + 1)
[/trigger]
[trigger=]CR Loop
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
For each (Integer CR_Loop) from 0 to (CR_Index_Listener - 1), do (Actions)
Loop - Actions
Set CR_Current_Index = CR_Index_Container[CR_Loop]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
CR_Splitted[CR_Current_Index] Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in CR_Splitted_Group[CR_Current_Index]) Greater than 0
Then - Actions
Unit Group - Pick every unit in CR_Splitted_Group[CR_Current_Index] and do (Actions)
Loop - Actions
Set Temp_Location[3] = (Position of (Picked unit))
Set Temp_Real[1] = (Distance between Temp_Location[3] and CR_Target_Point[CR_Current_Index])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Temp_Real[1] Greater than 0.00
Then - Actions
Set Temp_Real[2] = (Facing of (Picked unit))
Set Temp_Location[4] = (Temp_Location[3] offset by CR_Rocket_Speed[CR_Current_Index] towards Temp_Real[2] degrees)
Unit - Move (Picked unit) instantly to Temp_Location[4], facing CR_Target_Point[CR_Current_Index]
Custom script: call RemoveLocation(udg_Temp_Location[4])
Else - Actions
Unit Group - Remove (Picked unit) from CR_Splitted_Group[CR_Current_Index]
Unit Group - Add (Picked unit) to Temp_Group[2]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(CR_Splitted_Group[CR_Current_Index] is empty) Equal to True
Then - Actions
Set CR_Reached[CR_Current_Index] = True
Else - Actions
Custom script: call RemoveLocation(udg_Temp_Location[3])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
CR_Reached[CR_Current_Index] Equal to True
Then - Actions
Custom script: call RemoveLocation(udg_CR_Target_Point[udg_CR_Current_Index])
Custom script: call DestroyGroup(udg_CR_Splitted_Group[udg_CR_Current_Index])
Set CR_Index_Listener = (CR_Index_Listener - 1)
Set CR_Index_Container[CR_Loop] = CR_Index_Container[CR_Index_Listener]
Set CR_Recycle_Container[CR_Recycle_Size] = CR_Current_Index
Set CR_Recycle_Size = (CR_Recycle_Size + 1)
Set CR_Loop = (CR_Loop - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
CR_Index_Listener Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Skip remaining actions
Else - Actions
Else - Actions
Set Temp_Real[1] = (CR_Angle[CR_Current_Index] - 70.00)
Set Temp_Real[2] = (CR_Angle[CR_Current_Index] + 70.00)
Set Temp_Real[3] = (Random real number between Temp_Real[1] and Temp_Real[2])
Set Temp_Location[3] = (Position of CR_Rocket[CR_Current_Index])
For each (Integer A) from 1 to CR_Split_Rockets[CR_Current_Index], do (Actions)
Loop - Actions
Unit - Create 1 Rocket Dummy for CR_Player[CR_Current_Index] at Temp_Location[3] facing Temp_Real[3] degrees
Unit - Turn collision for (Last created unit) Off
Unit - Move (Last created unit) instantly to Temp_Location[3]
Animation - Change (Last created unit) flying height to CR_Rocket_Height at 0.00
Unit Group - Add (Last created unit) to CR_Splitted_Group[CR_Current_Index]
Custom script: call RemoveLocation(udg_Temp_Location[3])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
CR_Distance[CR_Current_Index] Greater than CR_Split_Distance
Then - Actions
Set Temp_Location[3] = (Position of CR_Rocket[CR_Current_Index])
Set Temp_Location[4] = (Temp_Location[3] offset by CR_Rocket_Speed[CR_Current_Index] towards CR_Angle[CR_Current_Index] degrees)
Unit - Move CR_Rocket[CR_Current_Index] instantly to Temp_Location[4], facing CR_Angle[CR_Current_Index] degrees
Set Temp_Group[1] = (Units within CR_Rocket_AoE[CR_Current_Index] of Temp_Location[3] matching ((((Matching unit) belongs to an ally of CR_Player[CR_Current_Index]) Equal to False) and ((((Matching unit) is dead) Equal to False) and (((Matching unit) is A flying unit) Equal to F
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in Temp_Group[1]) Greater than 0
Then - Actions
Unit Group - Add CR_Rocket[CR_Current_Index] to Temp_Group[2]
Else - Actions
Custom script: call DestroyGroup(udg_Temp_Group[1])
Destructible - Pick every destructible within CR_Rocket_AoE[CR_Current_Index] of Temp_Location[3] 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
Unit Group - Add CR_Rocket[CR_Current_Index] to Temp_Group[2]
Else - Actions
Unit - Order Harvester to Stop
Set CR_Distance[CR_Current_Index] = (Distance between Temp_Location[3] and CR_Target_Point[CR_Current_Index])
Custom script: call RemoveLocation(udg_Temp_Location[3])
Custom script: call RemoveLocation(udg_Temp_Location[4])
Else - Actions
Set CR_Splitted[CR_Current_Index] = True
Custom script: set udg_Temp_Group[2] = CreateGroup()
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in Temp_Group[2]) Greater than 0
Then - Actions
Unit Group - Pick every unit in Temp_Group[2] and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Picked unit) Equal to CR_Rocket[CR_Current_Index]
Then - Actions
Special Effect - Create a special effect at (Position of (Picked unit)) using CR_Effect[1]
Special Effect - Destroy (Last created special effect)
Else - Actions
Special Effect - Create a special effect at (Position of (Picked unit)) using CR_Effect[2]
Special Effect - Destroy (Last created special effect)
Set Temp_Group[3] = (Units within CR_Explosion_AoE[CR_Current_Index] of (Position of (Picked unit)) matching ((((Matching unit) belongs to an ally of CR_Player[CR_Current_Index]) Equal to False) and ((((Matching unit) is dead) Equal to False) and (((Matching unit) is A flying un
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in Temp_Group[3]) Greater than 0
Then - Actions
Unit Group - Pick every unit in Temp_Group[3] and do (Actions)
Loop - Actions
Unit - Cause CR_Caster[CR_Current_Index] to damage (Picked unit), dealing CR_Explosion_Damage[CR_Current_Index] damage of attack type CR_Attack_Type and damage type CR_Damage_Type
Else - Actions
Custom script: call DestroyGroup(udg_Temp_Group[3])
Unit - Remove (Picked unit) from the game
Else - Actions
Custom script: call DestroyGroup(udg_Temp_Group[2])
[/trigger]
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I got confused with all these variables and stuff :S Using a hashtable would be so more... easy :$ Really... A LOT easier, and you would just require 1 hashtable, 1 unit group, and 2 triggers.

· Create "RocketGroup" (UnitGroup)
· When you cast the first rocket save the distance it should travel and in the loop, save distance-distance_traveled, also save the damage it should deal and the amount of rockets that should come out of it after distance has been reached etc...
· Do the same for the other rockets.

Since all the data is stored within each unit, you don't need to keep track of all those variables.
 
Level 13
Joined
Mar 29, 2012
Messages
530
I got confused with all these variables and stuff :S Using a hashtable would be so more... easy :$ Really... A LOT easier, and you would just require 1 hashtable, 1 unit group, and 2 triggers.

· Create "RocketGroup" (UnitGroup)
· When you cast the first rocket save the distance it should travel and in the loop, save distance-distance_traveled, also save the damage it should deal and the amount of rockets that should come out of it after distance has been reached etc...
· Do the same for the other rockets.

Since all the data is stored within each unit, you don't need to keep track of all those variables.

I never use hashtable before:vw_wtf:....but i will try....

thx for the help...!!!
 
Status
Not open for further replies.
Top