Need suggestions for conversion.

Vulcansurge

Ultra Cool Member
Reaction score
27
These are the triggers im currently using in my map MOTHERSHIPS, to make small ships and make the fly around you main Mothership (its meant to be sorta like passive locust swarm...). I've decided to either convert it to JASS, and im not sure ever where to start. Im new to JASS as of about a month ago, but im sure you'll be able to throw most ideas at me with me understanding.

I dont expect you to read all of this, but try if you can. There is a breif description at the bottom of each one.

Code:
ShipAquire
    Events
        Unit - A unit Acquires an item
    Conditions
    Actions
        -------- -------------------------------------------------------------------------------------------------------------------------- --------
        -------- Basically creates the ships whenever unit aquires the items.                              --------
        -------- -------------------------------------------------------------------------------------------------------------------------- --------
        -------- Creates variables for the ships so they can fly around the mothership.               --------
        -------- Variables are player number multiplied by integer A, so Player One gets:            --------
        -------- 11, 21, 31, 41, 51, 61, 71, 81, 91 and 101 (player 2 gets 12, 22, 32...)              --------
        -------- There is a maximum of 10 units per squad, to eliminate lag.                               --------
        -------- -------------------------------------------------------------------------------------------------------------------------- --------
        -------- Cannot have more than one of the same squad because of this.                       --------
        -------- -------------------------------------------------------------------------------------------------------------------------- --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to A-Wing Squad
            Then - Actions
                For each (Integer A) from 1 to 10, do (Actions)
                    Loop - Actions
                        Set tempPoint[0] = (Position of (Hero manipulating item))
                        Unit - Create 1 A-Wing Fighter for (Owner of (Hero manipulating item)) at tempPoint[0] facing Default building facing degrees
                        Unit - Set (Last created unit) movement speed to 800.00
                        Set UnitAWing[(((Integer A) x 10) + (Player number of (Owner of (Hero manipulating item))))] = (Last created unit)
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                Set UnitAWingMothership[(Player number of (Owner of (Hero manipulating item)))] = (Hero manipulating item)
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to B-Wing Squad
            Then - Actions
                For each (Integer A) from 1 to 10, do (Actions)
                    Loop - Actions
                        Set tempPoint[0] = (Position of (Hero manipulating item))
                        Unit - Create 1 B-Wing Fighter for (Owner of (Hero manipulating item)) at tempPoint[0] facing Default building facing degrees
                        Unit - Set (Last created unit) movement speed to 800.00
                        Set UnitBWing[(((Integer A) x 10) + (Player number of (Owner of (Hero manipulating item))))] = (Last created unit)
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                Set UnitBWingMothership[(Player number of (Owner of (Hero manipulating item)))] = (Hero manipulating item)
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to ARC-170 Squad
            Then - Actions
                For each (Integer A) from 1 to 8, do (Actions)
                    Loop - Actions
                        Set tempPoint[0] = (Position of (Hero manipulating item))
                        Unit - Create 1 ARC-170 Fighter-Bomber for (Owner of (Hero manipulating item)) at tempPoint[0] facing Default building facing degrees
                        Unit - Set (Last created unit) movement speed to 800.00
                        Set UnitARC170[(((Integer A) x 10) + (Player number of (Owner of (Hero manipulating item))))] = (Last created unit)
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                Set UnitARC170Mothership[(Player number of (Owner of (Hero manipulating item)))] = (Hero manipulating item)
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to Jedi Interceptor Squad
            Then - Actions
                For each (Integer A) from 1 to 6, do (Actions)
                    Loop - Actions
                        Set tempPoint[0] = (Position of (Hero manipulating item))
                        Unit - Create 1 Jedi Interceptor for (Owner of (Hero manipulating item)) at tempPoint[0] facing Default building facing degrees
                        Unit - Set (Last created unit) movement speed to 800.00
                        Set UnitJedi[(((Integer A) x 10) + (Player number of (Owner of (Hero manipulating item))))] = (Last created unit)
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                Set UnitJediMothership[(Player number of (Owner of (Hero manipulating item)))] = (Hero manipulating item)
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to Y-Wing Squad
            Then - Actions
                For each (Integer A) from 1 to 5, do (Actions)
                    Loop - Actions
                        Set tempPoint[0] = (Position of (Hero manipulating item))
                        Unit - Create 1 Y-Wing Bomber for (Owner of (Hero manipulating item)) at tempPoint[0] facing Default building facing degrees
                        Unit - Set (Last created unit) movement speed to 800.00
                        Set UnitYWing[(((Integer A) x 10) + (Player number of (Owner of (Hero manipulating item))))] = (Last created unit)
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                Set UnitYWingMothership[(Player number of (Owner of (Hero manipulating item)))] = (Hero manipulating item)
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to T-Wing Squad
            Then - Actions
                For each (Integer A) from 1 to 3, do (Actions)
                    Loop - Actions
                        Set tempPoint[0] = (Position of (Hero manipulating item))
                        Unit - Create 1 T-Wing Bomber for (Owner of (Hero manipulating item)) at tempPoint[0] facing Default building facing degrees
                        Unit - Set (Last created unit) movement speed to 800.00
                        Set UnitTWing[(((Integer A) x 10) + (Player number of (Owner of (Hero manipulating item))))] = (Last created unit)
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                Set UnitTWingMothership[(Player number of (Owner of (Hero manipulating item)))] = (Hero manipulating item)
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to Millennium Falcon
            Then - Actions
                For each (Integer A) from 1 to 1, do (Actions)
                    Loop - Actions
                        Set tempPoint[0] = (Position of (Hero manipulating item))
                        Unit - Create 1 YT-1300 Millennium Falcon for (Owner of (Hero manipulating item)) at tempPoint[0] facing Default building facing degrees
                        Unit - Set (Last created unit) movement speed to 800.00
                        Set UnitFalcon[(((Integer A) x 10) + (Player number of (Owner of (Hero manipulating item))))] = (Last created unit)
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                Set UnitFalconMothership[(Player number of (Owner of (Hero manipulating item)))] = (Hero manipulating item)
            Else - Actions
                Do nothing
This code creates the ships and sets them to a variable. Player one will get <ship name> [11], <ship name> [21], <ship name> [31]...

Code:
ShipDrop
    Events
        Unit - A unit Loses an item
    Conditions
    Actions
        -------- -------------------------------------------------------------------------------------------------------------------------- --------
        -------- Destroys ships when the hero drops the item.                                                     --------
        -------- -------------------------------------------------------------------------------------------------------------------------- --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to A-Wing Squad
            Then - Actions
                Trigger - Turn off ShipKilled <gen>
                Unit - Kill UnitAWing[((1 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitAWing[((2 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitAWing[((3 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitAWing[((4 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitAWing[((5 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitAWing[((6 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitAWing[((7 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitAWing[((8 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitAWing[((9 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitAWing[((10 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Trigger - Turn on ShipKilled <gen>
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to B-Wing Squad
            Then - Actions
                Trigger - Turn off ShipKilled <gen>
                Unit - Kill UnitBWing[((1 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitBWing[((2 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitBWing[((3 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitBWing[((4 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitBWing[((5 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitBWing[((6 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitBWing[((7 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitBWing[((8 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitBWing[((9 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitBWing[((10 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Trigger - Turn on ShipKilled <gen>
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to ARC-170 Squad
            Then - Actions
                Trigger - Turn off ShipKilled <gen>
                Unit - Kill UnitARC170[((1 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitARC170[((2 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitARC170[((3 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitARC170[((4 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitARC170[((5 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitARC170[((6 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitARC170[((7 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitARC170[((8 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Trigger - Turn on ShipKilled <gen>
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to Jedi Interceptor Squad
            Then - Actions
                Trigger - Turn off ShipKilled <gen>
                Unit - Kill UnitJedi[((1 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitJedi[((2 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitJedi[((3 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitJedi[((4 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitJedi[((5 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitJedi[((6 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Trigger - Turn on ShipKilled <gen>
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to Y-Wing Squad
            Then - Actions
                Trigger - Turn off ShipKilled <gen>
                Unit - Kill UnitYWing[((1 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitYWing[((2 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitYWing[((3 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitYWing[((4 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitYWing[((5 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Trigger - Turn on ShipKilled <gen>
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to T-Wing Squad
            Then - Actions
                Trigger - Turn off ShipKilled <gen>
                Unit - Kill UnitTWing[((1 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitTWing[((2 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Unit - Kill UnitTWing[((3 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Trigger - Turn on ShipKilled <gen>
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to Millennium Falcon
            Then - Actions
                Trigger - Turn off ShipKilled <gen>
                Unit - Kill UnitFalcon[((1 x 10) + (Player number of (Owner of (Hero manipulating item))))]
                Trigger - Turn on ShipKilled <gen>
            Else - Actions
                Do nothing
This trigger kills all the ships when the corresponding item drops.

Code:
ShipKilled
    Events
        Unit - A unit Dies
    Conditions
    Actions
        -------- -------------------------------------------------------------------------------------------------------------------------- --------
        -------- When a ship dies it is respawned at the position of its mothership,                     --------
        -------- and starts flying around again.                                                                            --------
        -------- -------------------------------------------------------------------------------------------------------------------------- --------
        -------- There is an If/Then/Else for each ship type because the code is hard to make --------
        -------- without doing this. It tends to make slow computers sluggish in 4v4 or 5v5.       --------
        -------- This is because each If/Then/Else repeats upto 110 times.                              --------
        -------- -------------------------------------------------------------------------------------------------------------------------- --------
        For each (Integer A) from 1 to 110, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Dying unit) Equal to UnitAWing[(Integer A)]
                    Then - Actions
                        Set tempPoint[0] = (Position of UnitAWingMothership[(Player number of (Owner of (Dying unit)))])
                        Unit - Create 1 A-Wing Fighter for (Owner of (Dying unit)) at tempPoint[0] facing tempPoint[0]
                        Set UnitAWing[(Integer A)] = (Last created unit)
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                    Else - Actions
                        Do nothing
        For each (Integer A) from 1 to 110, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Dying unit) Equal to UnitBWing[(Integer A)]
                    Then - Actions
                        Set tempPoint[0] = (Position of UnitBWingMothership[(Player number of (Owner of (Dying unit)))])
                        Unit - Create 1 B-Wing Fighter for (Owner of (Dying unit)) at tempPoint[0] facing tempPoint[0]
                        Set UnitBWing[(Integer A)] = (Last created unit)
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                    Else - Actions
                        Do nothing
        For each (Integer A) from 1 to 110, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Dying unit) Equal to UnitARC170[(Integer A)]
                    Then - Actions
                        Set tempPoint[0] = (Position of UnitARC170Mothership[(Player number of (Owner of (Dying unit)))])
                        Unit - Create 1 ARC-170 Fighter-Bomber for (Owner of (Dying unit)) at tempPoint[0] facing tempPoint[0]
                        Set UnitARC170[(Integer A)] = (Last created unit)
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                    Else - Actions
                        Do nothing
        For each (Integer A) from 1 to 110, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Dying unit) Equal to UnitJedi[(Integer A)]
                    Then - Actions
                        Set tempPoint[0] = (Position of UnitJediMothership[(Player number of (Owner of (Dying unit)))])
                        Unit - Create 1 Jedi Interceptor for (Owner of (Dying unit)) at tempPoint[0] facing tempPoint[0]
                        Set UnitJedi[(Integer A)] = (Last created unit)
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                    Else - Actions
                        Do nothing
        For each (Integer A) from 1 to 110, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Dying unit) Equal to UnitYWing[(Integer A)]
                    Then - Actions
                        Set tempPoint[0] = (Position of UnitYWingMothership[(Player number of (Owner of (Dying unit)))])
                        Unit - Create 1 Y-Wing Bomber for (Owner of (Dying unit)) at tempPoint[0] facing tempPoint[0]
                        Set UnitYWing[(Integer A)] = (Last created unit)
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                    Else - Actions
                        Do nothing
        For each (Integer A) from 1 to 110, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Dying unit) Equal to UnitTWing[(Integer A)]
                    Then - Actions
                        Set tempPoint[0] = (Position of UnitTWingMothership[(Player number of (Owner of (Dying unit)))])
                        Unit - Create 1 T-Wing Bomber for (Owner of (Dying unit)) at tempPoint[0] facing tempPoint[0]
                        Set UnitTWing[(Integer A)] = (Last created unit)
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                    Else - Actions
                        Do nothing
        For each (Integer A) from 1 to 110, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Dying unit) Equal to UnitFalcon[(Integer A)]
                    Then - Actions
                        Set tempPoint[0] = (Position of UnitFalconMothership[(Player number of (Owner of (Dying unit)))])
                        Unit - Create 1 YT-1300 Millennium Falcon for (Owner of (Dying unit)) at tempPoint[0] facing tempPoint[0]
                        Set UnitFalcon[(Integer A)] = (Last created unit)
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                    Else - Actions
                        Do nothing
This replaces each ship as it dies.

Code:
ShipFly
    Events
        Time - Every 1.50 seconds of game time
    Conditions
    Actions
        -------- -------------------------------------------------------------------------------------------------------------------------- --------
        -------- Makes the fighter ships fly.                                                                                 --------
        -------- This is a monster code and may have bugs or leaks, use at own risk.               --------
        -------- -------------------------------------------------------------------------------------------------------------------------- --------
        For each (Integer A) from 1 to 110, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (UnitAWingMothership[(Player number of (Owner of UnitAWing[(Integer A)]))] is alive) Equal to True
                    Then - Actions
                        Set tempPoint[0] = (Position of UnitAWingMothership[(Player number of (Owner of UnitAWing[(Integer A)]))])
                        Set tempPoint[1] = (Random point in (Region centered at tempPoint[0] with size (2000.00, 2000.00)))
                        Unit - Order UnitAWing[(Integer A)] to Move To tempPoint[1]
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                        Custom script:   call RemoveLocation(udg_tempPoint[1])
                    Else - Actions
                        Unit - Move UnitAWing[(Integer A)] instantly to (Center of RegionSpawn[(Player number of (Owner of UnitAWing[(Integer A)]))])
        For each (Integer A) from 1 to 110, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (UnitBWingMothership[(Player number of (Owner of UnitBWing[(Integer A)]))] is alive) Equal to True
                    Then - Actions
                        Set tempPoint[0] = (Position of UnitBWingMothership[(Player number of (Owner of UnitBWing[(Integer A)]))])
                        Set tempPoint[1] = (Random point in (Region centered at tempPoint[0] with size (2000.00, 2000.00)))
                        Unit - Order UnitBWing[(Integer A)] to Move To tempPoint[1]
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                        Custom script:   call RemoveLocation(udg_tempPoint[1])
                    Else - Actions
                        Unit - Move UnitBWing[(Integer A)] instantly to (Center of RegionSpawn[(Player number of (Owner of UnitBWing[(Integer A)]))])
        For each (Integer A) from 1 to 110, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (UnitARC170Mothership[(Player number of (Owner of UnitARC170[(Integer A)]))] is alive) Equal to True
                    Then - Actions
                        Set tempPoint[0] = (Position of UnitARC170Mothership[(Player number of (Owner of UnitARC170[(Integer A)]))])
                        Set tempPoint[1] = (Random point in (Region centered at tempPoint[0] with size (3000.00, 3000.00)))
                        Unit - Order UnitARC170[(Integer A)] to Move To tempPoint[1]
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                        Custom script:   call RemoveLocation(udg_tempPoint[1])
                    Else - Actions
                        Unit - Move UnitARC170[(Integer A)] instantly to (Center of RegionSpawn[(Player number of (Owner of UnitARC170[(Integer A)]))])
        For each (Integer A) from 1 to 110, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (UnitJediMothership[(Player number of (Owner of UnitJedi[(Integer A)]))] is alive) Equal to True
                    Then - Actions
                        Set tempPoint[0] = (Position of UnitJediMothership[(Player number of (Owner of UnitJedi[(Integer A)]))])
                        Set tempPoint[1] = (Random point in (Region centered at tempPoint[0] with size (3000.00, 3000.00)))
                        Unit - Order UnitJedi[(Integer A)] to Move To tempPoint[1]
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                        Custom script:   call RemoveLocation(udg_tempPoint[1])
                    Else - Actions
                        Unit - Move UnitJedi[(Integer A)] instantly to (Center of RegionSpawn[(Player number of (Owner of UnitJedi[(Integer A)]))])
        For each (Integer A) from 1 to 110, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (UnitYWingMothership[(Player number of (Owner of UnitYWing[(Integer A)]))] is alive) Equal to True
                    Then - Actions
                        Set tempPoint[0] = (Position of UnitYWingMothership[(Player number of (Owner of UnitYWing[(Integer A)]))])
                        Set tempPoint[1] = (Random point in (Region centered at tempPoint[0] with size (3000.00, 3000.00)))
                        Unit - Order UnitYWing[(Integer A)] to Move To tempPoint[1]
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                        Custom script:   call RemoveLocation(udg_tempPoint[1])
                    Else - Actions
                        Unit - Move UnitYWing[(Integer A)] instantly to (Center of RegionSpawn[(Player number of (Owner of UnitYWing[(Integer A)]))])
        For each (Integer A) from 1 to 110, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (UnitTWingMothership[(Player number of (Owner of UnitTWing[(Integer A)]))] is alive) Equal to True
                    Then - Actions
                        Set tempPoint[0] = (Position of UnitTWingMothership[(Player number of (Owner of UnitTWing[(Integer A)]))])
                        Set tempPoint[1] = (Random point in (Region centered at tempPoint[0] with size (3000.00, 3000.00)))
                        Unit - Order UnitTWing[(Integer A)] to Move To tempPoint[1]
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                        Custom script:   call RemoveLocation(udg_tempPoint[1])
                    Else - Actions
                        Unit - Move UnitTWing[(Integer A)] instantly to (Center of RegionSpawn[(Player number of (Owner of UnitTWing[(Integer A)]))])
        For each (Integer A) from 1 to 110, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (UnitFalconMothership[(Player number of (Owner of UnitFalcon[(Integer A)]))] is alive) Equal to True
                    Then - Actions
                        Set tempPoint[0] = (Position of UnitFalconMothership[(Player number of (Owner of UnitFalcon[(Integer A)]))])
                        Set tempPoint[1] = (Random point in (Region centered at tempPoint[0] with size (3000.00, 3000.00)))
                        Unit - Order UnitFalcon[(Integer A)] to Move To tempPoint[1]
                        Custom script:   call RemoveLocation(udg_tempPoint[0])
                        Custom script:   call RemoveLocation(udg_tempPoint[1])
                    Else - Actions
                        Unit - Move UnitFalcon[(Integer A)] instantly to (Center of RegionSpawn[(Player number of (Owner of UnitTWing[(Integer A)]))])
This moves each ship to random locations around the main ship.

Thanks in advance if you can help. Im sure if you read even half of this you've earnt my +rep. :D
 
I

IKilledKEnny

Guest
Don't attempt to do it until you are good in JASS, wait and do it alone, if people would do it for you and they'll have mistakes it would ruin your map. I heard more then once about someone who attempted to covert GUI to JASS when he had no knowledge of JASS and becuase of that his map was destroyed.
 
I

IKilledKEnny

Guest
Mind giving details? Try to do it yourself and when you are done post the finished work.
 

Vulcansurge

Ultra Cool Member
Reaction score
27
Sigh...

OK im doing it myself. Ive already had attempt but it didnt work well. If anyone has any ideas about how to convert it here are deatails:

- I want the ability to be MUI, so local variables might be required.
- I want to condese it down to a single trigger.
- I want to be able to control the movement with an ability in a seperate trigger. (spread out, attack enemies, retreat - these only need to use movement and hide triggers).
- It would be good if the ships flew realisticly like they do in locust swarm.
 

Sooda

Diversity enchants
Reaction score
318
> I dont expect you to read all of this, but try if you can.

Chocobo did a JASS version of Locust Swarm, use search and you will find it. Then change it to your needs.
 

elmstfreddie

The Finglonger
Reaction score
203
Well actually I just thought of a way to do it.
You do all the events n conditions (well you'll need a separate set of triggers for my idea, one for each item) then you have local item = item being manipulated, and local unit (the unit that acquired it), and a local unit array that is undefined. THEN you create 1 xwing, make that one unit[1], then make another, unit[2], etc.
Then you run a function you made that takes the amount of xwings. So, function Xwing_Fly takes XWing1 unit, XWing2 unit, XWing3 unit, etc. It should also take the item being manipulated, and the unit that acquired the item. Then, it runs a loop that exits when the unit that acquired the item doesn't have the specified item anymore. But inside the loop it has a wait, then it orders the different XWings (1-10, a loop inside the loop if you wish) to move to a random place around the hero.

I think that would work.
Sorry if I confused you, I could quickly make it if I did.
Actually, I'll make it anyways. I'll edit this post when I'm done.

Edit > Ok, this is only the actions, but the event should just be a unit acquires an item.
WARNING: Untested
No syntax errors, but may not work as I intended :p
JASS:
function RandomPositionX takes real CurrentX returns real
    return (CurrentX + (GetRandomReal(1.00,100.00)) * Cos((GetRandomReal(0.00,360.00)) * 180.00/3.14159))
endfunction

function RandomPositionY takes real CurrentY returns real
    return (CurrentY + (GetRandomReal(1.00,100.00)) * Sin((GetRandomReal(0.00,360.00)) * 180.00/3.14159))
endfunction     

function XWing_Fly takes unit XWing1, unit XWing2, unit XWing3, unit XWing4, unit XWing5, unit XWing6, unit XWing7, unit XWing8, unit XWing9, unit XWing10, unit Owner, item XWingItem  returns nothing
    loop
        exitwhen (IsItemOwned(XWingItem) == false)
        call TriggerSleepAction(1.00)
        call IssuePointOrder(XWing1,&quot;walk&quot;,RandomPositionX(GetUnitX(Owner)),RandomPositionY(GetUnitY(Owner)))
        call IssuePointOrder(XWing2,&quot;walk&quot;,RandomPositionX(GetUnitX(Owner)),RandomPositionY(GetUnitY(Owner)))        
        call IssuePointOrder(XWing3,&quot;walk&quot;,RandomPositionX(GetUnitX(Owner)),RandomPositionY(GetUnitY(Owner)))        
        call IssuePointOrder(XWing4,&quot;walk&quot;,RandomPositionX(GetUnitX(Owner)),RandomPositionY(GetUnitY(Owner)))        
        call IssuePointOrder(XWing5,&quot;walk&quot;,RandomPositionX(GetUnitX(Owner)),RandomPositionY(GetUnitY(Owner)))
        call IssuePointOrder(XWing6,&quot;walk&quot;,RandomPositionX(GetUnitX(Owner)),RandomPositionY(GetUnitY(Owner)))        
        call IssuePointOrder(XWing7,&quot;walk&quot;,RandomPositionX(GetUnitX(Owner)),RandomPositionY(GetUnitY(Owner)))        
        call IssuePointOrder(XWing8,&quot;walk&quot;,RandomPositionX(GetUnitX(Owner)),RandomPositionY(GetUnitY(Owner)))        
        call IssuePointOrder(XWing9,&quot;walk&quot;,RandomPositionX(GetUnitX(Owner)),RandomPositionY(GetUnitY(Owner)))        
        call IssuePointOrder(XWing10,&quot;walk&quot;,RandomPositionX(GetUnitX(Owner)),RandomPositionY(GetUnitY(Owner)))
    endloop
    call RemoveUnit(XWing1)        
    call RemoveUnit(XWing2)        
    call RemoveUnit(XWing3)
    call RemoveUnit(XWing4)
    call RemoveUnit(XWing5)
    call RemoveUnit(XWing6)
    call RemoveUnit(XWing7)
    call RemoveUnit(XWing8)
    call RemoveUnit(XWing9)
    call RemoveUnit(XWing10)
endfunction

function XWingAcquire_Actions takes nothing returns nothing
    local unit Owner = GetTriggerUnit()
    local item XWingItem = GetManipulatedItem()
    local unit array XWings
    local integer l = 1
    loop
        exitwhen l &gt; 10
        set XWings[l] = CreateUnit(GetOwningPlayer(Owner),&#039;asdf&#039;,GetUnitX(Owner),GetUnitY(Owner),270.00)
    endloop
    call XWing_Fly(XWings[1],XWings[2],XWings[3],XWings[4],XWings[5],XWings[6],XWings[7],XWings[8],XWings[9],XWings[10],Owner,XWingItem)
endfunction


Oh, I just put asdf where you should enter the raw data integer for your XWing unit.

Edit > Forgot to null things, but I'm sure you could do that.
 

Vulcansurge

Ultra Cool Member
Reaction score
27
Chocobo did a JASS version of Locust Swarm, use search and you will find it. Then change it to your needs.

Its GUI. I need JASS becuase of the sheer number of units flying around. :(

Well actually I just thought of a way to do it.

Its nice elmst. Great constant functions. Looks like its MUI too, awesome :p What are the actions you're using for it? [edit] I got the actions. Same as the one I was using before...

It crashes in game... Unfortunate. [edit] I fixed it. Now they dont seem to move to random spots.

[edit] I got it running. Ive made a few adjustments but I need to know what to change to allow the ships to move over a greater area.

[edit] Is there also anyway I might be able to make it more realistic like locust swarm in that they are constantly moving instead of in intervals of 1sec... I wonder if I could use a spell to make them come out and go in too... Maybe even attack.

[edit] Does this leak? Im pretty sure I might have to set the point it moves to before the unit goes there wont I?
 

elmstfreddie

The Finglonger
Reaction score
203
Ok to edit the distance it flies to
JASS:
(CurrentX + (GetRandomReal(1.00,100.00)) * Cos((GetRandomReal(0.00,360.00)) * 180.00/3.14159))
endfunction

Edit the GetRandomReal(1.00,100.00). That is the distance.

To make them constantly moving, just reduce the trigger wait OR have another trigger that if a unit stops, and the unit is one of the flying things, order them to move to a random spot around their player's mothership.
Does this leak? Im pretty sure I might have to set the point it moves to before the unit goes there wont I?
I forgot to null everything, that's all you need to do I'm pretty sure.
Null Owner, XWingItem, and XWings.
Oh, and yeah, it's MUI. So you can have more than 1 type of ship per mothership.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top