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.
 
>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.
 
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:
 
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.
 
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.
 
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.
 
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?
 
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.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top