Cal1991
New Member
- Reaction score
- 7
I made a spell that is supposed to work as follows:
The hero gets 2 abilitys, one to place a power generator and one to place a tower.
A power generator can be placed anywere, but when you place one it gets rid of your old network of towers.
A tower can only be placed within linking distance of a generator or another tower. If a tower or a generator dies, the entire network of towers dies.
when a tower is placed, it creates a link to any towers or generators nearby. the link is like an electirc fence, anyone that touches it get zapped.
This is what I have so far:
(it is all done in GUI, I know how to use basic jass but GUI is 100x easier for me to work with)
Trigger1:
Trigger2:
Trigger3:
trigger4:
trigger5:
If anyone can help with this, I'll give +rep.... I'm not that great with triggers, and I can't understand why it screws up.
Edit:
It does work sometimes, just not always.
I can post the map if you need it.
The hero gets 2 abilitys, one to place a power generator and one to place a tower.
A power generator can be placed anywere, but when you place one it gets rid of your old network of towers.
A tower can only be placed within linking distance of a generator or another tower. If a tower or a generator dies, the entire network of towers dies.
when a tower is placed, it creates a link to any towers or generators nearby. the link is like an electirc fence, anyone that touches it get zapped.
This is what I have so far:
(it is all done in GUI, I know how to use basic jass but GUI is 100x easier for me to work with)
Trigger1:
Code:
Ability add
Events
Unit - A unit Learns a skill
Conditions
(Learned Hero Skill) Equal to Special Balnazzar - Rain Of Chaos
Actions
Unit - Add Create Power Generator (Neutral Hostile) to (Triggering unit)
Trigger2:
Code:
Power generator
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Create Power Generator (Neutral Hostile)
Actions
Set Point = (Target point of ability being cast)
Unit Group - Pick every unit in ChainTower[(Player number of (Owner of (Triggering unit)))] and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
Unit Group - Remove (Picked unit) from ChainTower[(Player number of (Owner of (Triggering unit)))]
Unit Group - Pick every unit in Lightnings[(Player number of (Owner of (Triggering unit)))] and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
Unit Group - Remove (Picked unit) from Lightnings[(Player number of (Owner of (Triggering unit)))]
Unit - Create 1 Power Generator for (Owner of (Triggering unit)) at Point facing Default building facing degrees
Unit Group - Add (Last created unit) to ChainTower[(Player number of (Owner of (Triggering unit)))]
Trigger3:
Code:
Chain tower start
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Chain-Link Towers (Balnazzar)
Actions
Set Point = (Target point of ability being cast)
Set Unitgroup = (Units within (500.00 + (100.00 x (Real((Level of Chain-Link Towers (Balnazzar) for (Casting unit)))))) of Point)
Set one = 0
Unit Group - Pick every unit in ChainTower[(Player number of (Owner of (Casting unit)))] and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in Unitgroup) Equal to True
Then - Actions
Set one = 1
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
one Equal to 0
Then - Actions
Set Point = (Position of (Triggering unit))
Unit - Order (Triggering unit) to Move To Point
Game - Display to (Player group((Owner of (Triggering unit)))) the text: Must connect to a P...
Else - Actions
Do nothing
trigger4:
Code:
Chain tower create
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Chain-Link Towers (Balnazzar)
Actions
Set Point = (Target point of ability being cast)
Unit - Create 1 Chain-Link Tower for (Owner of (Triggering unit)) at Point facing Default building facing degrees
Unit Group - Add (Last created unit) to ChainTower[(Player number of (Owner of (Triggering unit)))]
Set TempUnit = (Last created unit)
Set Unitgroup = (Units within (500.00 + (100.00 x (Real((Level of Chain-Link Towers (Balnazzar) for (Casting unit)))))) of Point)
Unit Group - Pick every unit in Unitgroup and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in ChainTower[(Player number of (Owner of (Triggering unit)))]) Equal to True
(Picked unit) Not equal to TempUnit
Then - Actions
Unit Group - Add (Picked unit) to TempGroup
Else - Actions
Do nothing
Unit Group - Pick every unit in TempGroup and do (Actions)
Loop - Actions
Set Point = (Position of TempUnit)
Set point2 = (Position of (Picked unit))
Set Real[1] = (Angle from Point to point2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between Point and point2) Greater than 949.00
Then - Actions
Set PointArray[1] = (Point offset by 105.00 towards Real[1] degrees)
Set PointArray[2] = (Point offset by 210.00 towards Real[1] degrees)
Set PointArray[3] = (Point offset by 315.00 towards Real[1] degrees)
Set PointArray[4] = (Point offset by 420.00 towards Real[1] degrees)
Set PointArray[5] = (Point offset by 525.00 towards Real[1] degrees)
Set PointArray[6] = (Point offset by 630.00 towards Real[1] degrees)
Set PointArray[7] = (Point offset by 735.00 towards Real[1] degrees)
Set PointArray[8] = (Point offset by 840.00 towards Real[1] degrees)
Set PointArray[9] = (Point offset by 945.00 towards Real[1] degrees)
For each (Integer A) from 1 to 9, do (Actions)
Loop - Actions
Unit - Create 1 Lightning Dummy for (Owner of TempUnit) at PointArray[(Integer A)] facing Default building facing degrees
Unit Group - Add (Last created unit) to Lightnings[(Player number of (Owner of TempUnit))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between Point and point2) Greater than 844.00
Then - Actions
Set PointArray[1] = (Point offset by 105.00 towards Real[1] degrees)
Set PointArray[2] = (Point offset by 210.00 towards Real[1] degrees)
Set PointArray[3] = (Point offset by 315.00 towards Real[1] degrees)
Set PointArray[4] = (Point offset by 420.00 towards Real[1] degrees)
Set PointArray[5] = (Point offset by 525.00 towards Real[1] degrees)
Set PointArray[6] = (Point offset by 630.00 towards Real[1] degrees)
Set PointArray[7] = (Point offset by 735.00 towards Real[1] degrees)
Set PointArray[8] = (Point offset by 840.00 towards Real[1] degrees)
For each (Integer A) from 1 to 8, do (Actions)
Loop - Actions
Unit - Create 1 Lightning Dummy for (Owner of TempUnit) at PointArray[(Integer A)] facing Default building facing degrees
Unit Group - Add (Last created unit) to Lightnings[(Player number of (Owner of TempUnit))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between Point and point2) Greater than 739.00
Then - Actions
Set PointArray[1] = (Point offset by 105.00 towards Real[1] degrees)
Set PointArray[2] = (Point offset by 210.00 towards Real[1] degrees)
Set PointArray[3] = (Point offset by 315.00 towards Real[1] degrees)
Set PointArray[4] = (Point offset by 420.00 towards Real[1] degrees)
Set PointArray[5] = (Point offset by 525.00 towards Real[1] degrees)
Set PointArray[6] = (Point offset by 630.00 towards Real[1] degrees)
Set PointArray[7] = (Point offset by 735.00 towards Real[1] degrees)
For each (Integer A) from 1 to 7, do (Actions)
Loop - Actions
Unit - Create 1 Lightning Dummy for (Owner of TempUnit) at PointArray[(Integer A)] facing Default building facing degrees
Unit Group - Add (Last created unit) to Lightnings[(Player number of (Owner of TempUnit))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between Point and point2) Greater than 634.00
Then - Actions
Set PointArray[1] = (Point offset by 105.00 towards Real[1] degrees)
Set PointArray[2] = (Point offset by 210.00 towards Real[1] degrees)
Set PointArray[3] = (Point offset by 315.00 towards Real[1] degrees)
Set PointArray[4] = (Point offset by 420.00 towards Real[1] degrees)
Set PointArray[5] = (Point offset by 525.00 towards Real[1] degrees)
Set PointArray[6] = (Point offset by 630.00 towards Real[1] degrees)
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
Unit - Create 1 Lightning Dummy for (Owner of TempUnit) at PointArray[(Integer A)] facing Default building facing degrees
Unit Group - Add (Last created unit) to Lightnings[(Player number of (Owner of TempUnit))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between Point and point2) Greater than 529.00
Then - Actions
Set PointArray[1] = (Point offset by 105.00 towards Real[1] degrees)
Set PointArray[2] = (Point offset by 210.00 towards Real[1] degrees)
Set PointArray[3] = (Point offset by 315.00 towards Real[1] degrees)
Set PointArray[4] = (Point offset by 420.00 towards Real[1] degrees)
Set PointArray[5] = (Point offset by 525.00 towards Real[1] degrees)
For each (Integer A) from 1 to 5, do (Actions)
Loop - Actions
Unit - Create 1 Lightning Dummy for (Owner of TempUnit) at PointArray[(Integer A)] facing Default building facing degrees
Unit Group - Add (Last created unit) to Lightnings[(Player number of (Owner of TempUnit))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between Point and point2) Greater than 424.00
Then - Actions
Set PointArray[1] = (Point offset by 105.00 towards Real[1] degrees)
Set PointArray[2] = (Point offset by 210.00 towards Real[1] degrees)
Set PointArray[3] = (Point offset by 315.00 towards Real[1] degrees)
Set PointArray[4] = (Point offset by 420.00 towards Real[1] degrees)
For each (Integer A) from 1 to 4, do (Actions)
Loop - Actions
Unit - Create 1 Lightning Dummy for (Owner of TempUnit) at PointArray[(Integer A)] facing Default building facing degrees
Unit Group - Add (Last created unit) to Lightnings[(Player number of (Owner of TempUnit))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between Point and point2) Greater than 319.00
Then - Actions
Set PointArray[1] = (Point offset by 105.00 towards Real[1] degrees)
Set PointArray[2] = (Point offset by 210.00 towards Real[1] degrees)
Set PointArray[3] = (Point offset by 315.00 towards Real[1] degrees)
For each (Integer A) from 1 to 3, do (Actions)
Loop - Actions
Unit - Create 1 Lightning Dummy for (Owner of TempUnit) at PointArray[(Integer A)] facing Default building facing degrees
Unit Group - Add (Last created unit) to Lightnings[(Player number of (Owner of TempUnit))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between Point and point2) Greater than 214.00
Then - Actions
Set PointArray[1] = (Point offset by 105.00 towards Real[1] degrees)
Set PointArray[2] = (Point offset by 210.00 towards Real[1] degrees)
For each (Integer A) from 1 to 2, do (Actions)
Loop - Actions
Unit - Create 1 Lightning Dummy for (Owner of TempUnit) at PointArray[(Integer A)] facing Default building facing degrees
Unit Group - Add (Last created unit) to Lightnings[(Player number of (Owner of TempUnit))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between Point and point2) Greater than 109.00
Then - Actions
Set PointArray[1] = (Point offset by 105.00 towards Real[1] degrees)
For each (Integer A) from 1 to 1, do (Actions)
Loop - Actions
Unit - Create 1 Lightning Dummy for (Owner of TempUnit) at PointArray[(Integer A)] facing Default building facing degrees
Unit Group - Add (Last created unit) to Lightnings[(Player number of (Owner of TempUnit))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between Point and point2) Greater than 39.00
Then - Actions
Set PointArray[1] = (Point offset by 20.00 towards Real[1] degrees)
For each (Integer A) from 1 to 1, do (Actions)
Loop - Actions
Unit - Create 1 Lightning Dummy for (Owner of TempUnit) at PointArray[(Integer A)] facing Default building facing degrees
Unit Group - Add (Last created unit) to Lightnings[(Player number of (Owner of TempUnit))]
Else - Actions
Do nothing
trigger5:
Code:
Chain tower death
Events
Unit - A unit Dies
Conditions
Actions
For each (Integer A) from 1 to 12, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Dying unit) is in ChainTower[(Integer A)]) Equal to True
Then - Actions
Unit Group - Pick every unit in ChainTower[(Player number of (Owner of (Triggering unit)))] and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
Unit Group - Remove (Picked unit) from ChainTower[(Player number of (Owner of (Triggering unit)))]
Unit Group - Pick every unit in Lightnings[(Player number of (Owner of (Triggering unit)))] and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
Unit Group - Remove (Picked unit) from Lightnings[(Player number of (Owner of (Triggering unit)))]
Else - Actions
Do nothing
If anyone can help with this, I'll give +rep.... I'm not that great with triggers, and I can't understand why it screws up.
Edit:
It does work sometimes, just not always.
I can post the map if you need it.