Chain-Linked towers spells glitchy, need help

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:
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.
 

Cal1991

New Member
Reaction score
7
>It does work sometimes, just not always.

Then it leaks...? :rolleyes:

I am aware it leaks, that has nothing to do with my problem, though.
Leaks just make more lag, when they do anything.

The problems that sometimes acur are as follows:
-When you place a tower, it doesn't link to anything.
-When you place a tower, it only links to a few of the towers close enough, instead of all of them like it should.
-When you place a tower, it try to link to dead towers, even though they should be removed from the link group apon dying.
-When you place a tower, it trys to link to a tower that is too far away, and the plasma beam only reaches 3/4th of the way to the other tower.
 

Cal1991

New Member
Reaction score
7
Still flummoxed

I have been working on this spell for like a week myself, without managing to get it entirely working.

If no one has an idea why my way of triggering it is so buggy, can they suggest a better way?

Shall I upload the map for people to look at the spell?

I Need halp :confused:
 

Cal1991

New Member
Reaction score
7
Upload the map and I'll take a look at it.

Okay, thanks. I deleted all the custom models so it would be small enough to attach.

Oh, I almost forgot... I've been using the Newgen pack

I'm not sure how well you will be able to edit the map if you don't have newgen. If you don't have it, I would suggest trying it out. It's very reliable and helpful.
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
What on earth did you do to make the map totally unplayable? I can't play it at all.

Edit: Can't open it either.
 

Cal1991

New Member
Reaction score
7
What on earth did you do to make the map totally unplayable? I can't play it at all.

Edit: Can't open it either.

Oh, I almost forgot... I've been using the Newgen pack

I'm not sure how well you will be able to edit the map if you don't have newgen. If you don't have it, I would suggest trying it out. It's very reliable and helpful.

..


Anyway, it will work fine if you open it and test it without saving even if you don't have newgen. It's only if you save it that it screws up.

I can't think of any reason to not use newgen... but if you don't want to, I can remake the spell in a different map in normal editor.
 

Terrabull

Veteran Member (Done that)
Reaction score
38
I might be able to help you, but I'm to tired to make sense of your triggers tonight. Are all the triggers the same as up there? And is that add-on map still correct?
 

Cal1991

New Member
Reaction score
7
I might be able to help you, but I'm to tired to make sense of your triggers tonight. Are all the triggers the same as up there? And is that add-on map still correct?

Yes, and yes. Just download the add-on map and look at it, if you're willing to help. Thanks in advance.

Btw, nice icon. I had a bunch of little plastic guys that looked like that.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top