Advertisement
Guest User

Horrible Script

a guest
May 27th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 18.73 KB | None | 0 0
  1. local Data = {} -- Holds all userdata stuff.
  2. Data.Ships = {} -- your ships!
  3. Data.Sector = function () -- Generates a table map of sectors!
  4.     local Sectors = {}
  5.     for x = -10, 10 do
  6.         for y = -10, 10 do
  7.             local Node = {}
  8.             Node.X = x;
  9.             Node.Y = y;
  10.             Node.SectorName = tostring( "Sector "..Node.X..","..Node.Y);
  11.             Node.Colonies = {};
  12.             Node.MaxColonies = math.random(1, 5);
  13.             Node.Armies = {};
  14.             Sectors[#Sectors + 1] = Node
  15.         end
  16.     end
  17.     return Sectors
  18. end
  19. Data.Profit = {0, 0}; -- [1] , min per cycle (30s) [2] is max per cycle. RATIO IS 10:0.3 (1 colony with 10 population produces 1 , 3
  20. Data.Balance = 10000e4;
  21. Data.tColonies = 0;
  22. Data.tShips = 0;
  23. math.randomseed(tick())
  24. local ScreenGui = script.Parent:WaitForChild("ScreenGui")
  25. local StatsBackDrop = ScreenGui:WaitForChild("StatsBD")
  26. local function ConvertIdToName (ID)
  27.     local IDDICTIONARY = {
  28.         [1] = "Bulldog MkI";
  29.         [2] = "Bulldog MkII";
  30.         [3] = "Bulldog MkIII";
  31.         [4] = "Bulldog MkIIII";
  32.         [5] = "Node MkI";
  33.         [6] = "Node MkII";
  34.         [7] = "Node MkIII";
  35.         [8] = "Node MkIIII";
  36.         [9] = "Harvester MkI";
  37.         [10] = "Harvester MkII";
  38.         [11] = "Harvester MkIII";
  39.         [12] = "Cyrogem";
  40.     }
  41.    
  42.     return IDDICTIONARY[ID] or "undefined"
  43.    
  44. end
  45. local Ships = {
  46.     --Bulldog
  47.     ['Bulldog MkI'] = {
  48.         ['Class'] = "Miner";
  49.         ['Price']  = 10000;
  50.         ['MiningPercent'] = 898; -- no bonus on rarer ores.
  51.         ['CargoHold'] = 15000; -- holds 50 ores,
  52.         ['Health'] = 20;
  53.         ['Shields'] = 0;
  54.         ['Attack'] = 0; -- Doesn't have defenses    
  55.     };
  56.     ['Bulldog MkII'] = {
  57.         ['Class'] = "Miner";
  58.         ['Price'] = 23500 * 2.20;
  59.         ['MiningPercent'] = 5; -- 15% bonus
  60.         ['CargoHold'] = 16;
  61.         ['Health'] = 45;
  62.         ['Shields'] = 0;
  63.         ['Attack']  = 0;
  64.     };
  65.     ['Bulldog MkIII'] = {
  66.         ['Class'] = "Miner";
  67.         ['Price'] = 800000 * 1.20;
  68.         ['MiningPercent'] = 70; -- 25% bonus
  69.         ['CargoHold'] = 19;
  70.         ['Health'] = 80;
  71.         ['Shields'] = 15; -- Regenerates 1 shield point every 7.5 seconds, 100 shields = 1 shield every second etc.
  72.         ['Attack'] = 1; -- Defends its self
  73.     };
  74.     ['Bulldog MkIIII'] = {
  75.         ['Class'] = "Miner";
  76.         ['Price'] = 1234000;
  77.         ['MiningPercent'] = 160; -- 60% bonus;
  78.         ['CargoHold'] = 30;
  79.         ['Health'] = 300;
  80.         ['Shields'] = 40;
  81.         ['Attack'] = 8;
  82.     };
  83.     --Node Fleet Assulters
  84.     ['Node MkI'] = {
  85.         ['Class'] = "Spawner_Fleet";
  86.         ['MaxFleetSize'] = 5;
  87.         ['Price'] = 4400000;
  88.         ['FleetDamageEach'] = 2;
  89.         ['FleetHealthEach'] = 10;
  90.         ['FleetShieldEach'] = 50;
  91.         ['Health'] = 100;
  92.         ['Shields'] = 200;
  93.         ['Attack'] = 20;
  94.     };
  95.     ['Node MkII'] = {
  96.         ['Class'] = "Spawner_Fleet";
  97.         ['MaxFleetSize'] = 8;
  98.         ['Price'] = 736000000;
  99.         ['FleetDamageEach'] = 5;
  100.         ['FleetHealthEach'] = 25;
  101.         ['FleetShieldEach'] = 75;
  102.         ['Health'] = 175;
  103.         ['Shields'] = 350;
  104.         ['Attack'] = 35;
  105.     };
  106.     ['Node MkIII'] = {
  107.         ['Class'] = "Spawner_Fleet";
  108.         ['MaxFleetSize'] = 9;
  109.         ['Price'] = 64500080000;
  110.         ['FleetDamageEach'] = 8;
  111.         ['FleetHealthEach'] = 45;
  112.         ['FleetShieldEach'] = 115;
  113.         ['Health'] = 250;
  114.         ['Shields'] = 400;
  115.         ['Attack'] = 70;
  116.     };
  117.     ['Node MkIIII'] = {
  118.         ['Class'] = "Spawner_Fleet";
  119.         ['MaxFleetSize'] = 9;
  120.         ['Price'] = 1.5e12;
  121.         ['FleetDamageEach'] = 8;
  122.         ['FleetHealthEach'] = 64;
  123.         ['FleetShieldEach'] = 128;
  124.         ['Health'] = 320;
  125.         ['Shields'] = 400;
  126.         ['Attack'] = 80;
  127.     };
  128.     --Harvesters
  129.     ['Harvester MkI'] = {
  130.         ['Class'] = {"Miner", "Harvester"};
  131.         ['CargoHold'] = 40;
  132.         ['MiningPercent'] = 250; --150% bonus;
  133.         ['IncomeGenerator'] = {"Percent", "Balance", "Single", 0.033}; -- provides 0.033% of current balance per each owned
  134.         ['Price'] = 1e9;
  135.         ['Health'] = 200;
  136.         ['Shields'] = 100;
  137.         ['Attack'] = 20;
  138.     };
  139.     ['Harvester MkII'] = {
  140.         ['Class'] = {"Miner", "Harvester"};
  141.         ['CargoHold'] = 50;
  142.         ['MiningPercent'] = 300; --200% bonus;
  143.         ['IncomeGenerator'] = {"Percent", "Balance", "Single", 0.099}; -- provides 0.099% of current balance per each owned
  144.         ['Price'] = 1e11;
  145.         ['Health'] = 800;
  146.         ['Shields'] = 0;
  147.         ['Attack'] = 35;
  148.     };
  149.     ['Harvester MkIII'] = {
  150.         ['Class'] = {"Miner", "Harvester"};
  151.         ['CargoHold'] = 60;
  152.         ['MiningPercent'] = 450; --350% bonus;
  153.         ['IncomeGenerator'] = {"Percent", "Balance", "Single", 0.217}; -- provides 0.217% of current balance per each owned
  154.         ['Price'] = 1.9e12;
  155.         ['Health'] = 1300;
  156.         ['Shields'] = 900;
  157.         ['Attack'] = 20;
  158.     };
  159.     ['Cyrogem'] = {
  160.         ['Class']  = "Lander";
  161.         ['Price'] = 100e3;
  162.         ['Health'] = 25;
  163.         ['Shields'] = 0;
  164.         ['Attack'] = 0;
  165.     };
  166. }
  167.  
  168. --Core Functions--
  169.  
  170. function Deduct (n)
  171.     Data.Balance = Data.Balance - n;
  172. end
  173.  
  174. function Increment (n)
  175.     Data.Balance = Data.Balance + n;
  176. end
  177.  
  178. function UpdateStatLabels ()
  179.     local Stats = StatsBackDrop:WaitForChild("Stats")
  180.     local Profit = Stats.Profit
  181.     local Spice = Stats.Spice
  182.     local TotalShips = Stats.TotalShips
  183.     local TotalColonies = Stats.TotalColonies;
  184.     Spice.Text = "Spice: "..tostring(Data.Balance);
  185.     Profit.Text = "+ "..tostring(Data.Profit[1].. " -> "..Data.Profit[2].." cycle (30s)")
  186. end
  187.  
  188. -- Intialize Sector Generation --
  189. Data.Sector = Data.Sector();
  190. ---------------------------------
  191.  
  192. local CoreGui = game:GetService("StarterGui");
  193. UpdateStatLabels()
  194. function ColonizeSector (SectorCoords, UniqueLanderId)
  195.     local function CheckIfUniqueIdClassIsLander ()
  196.         for i,v in pairs (Data.Ships) do
  197.             if v.UniqueId == UniqueLanderId then
  198.                 if v.ShipInformation.Class == "Lander" then
  199.                     MakeChatMessage("An error has occured; (this is a bug test)!", "System", Color3.fromRGB(255,255,255))
  200.                     return true;
  201.                 else
  202.                     MakeChatMessage("An error has occured (not read as 'LANDER'; (this is a bug test)!", "System", Color3.fromRGB(255,255,255))
  203.                     return false;
  204.                 end
  205.             end
  206.         end
  207.     end
  208.    
  209.     if CheckIfUniqueIdClassIsLander() then
  210.         MakeChatMessage("It went through!!", "System", Color3.fromRGB(255,255,255))
  211.         local ColonyFormat = {
  212.             Owner = game.Players.LocalPlayer;
  213.             Population = 0;
  214.             ConstructionSlots = {
  215.                 {-2, 2, Structure = nil;},{-1, 2, Structure = nil;}, {0, 2, Structure = nil;}, {1, 2, Structure = nil;}, {2, 2, Structure = nil;},
  216.                 {-2, 1, Structure = nil;},{-1, 1, Structure = nil;}, {0, 1, Structure = nil;}, {1, 1, Structure = nil;}, {2,1, Structure = nil;},
  217.                 {-2, 0, Structure = nil;},{-1, 0, Structure = nil;}, {0, 0, Structure = nil;}, {1, 0, Structure = nil;}, {2,0, Structure = nil;},
  218.                 {-2, -1, Structure = nil;},{-1, -1, Structure = nil;}, {0, -1, Structure = nil;}, {1, -1, Structure = nil;}, {2,-1, Structure = nil;},
  219.                 {-2, -2, Structure = nil;},{-1, -2, Structure = nil;}, {0, -2, Structure = nil;}, {1, -2, Structure = nil;}, {2,-2, Structure = nil;},
  220.             };
  221.         }
  222.         print(type(Data.Sector))
  223.         for i,v in pairs (Data.Sector) do
  224.             if v.X == SectorCoords[1] and v.Y == SectorCoords[2] then
  225.                 if #v.Colonies >= v.MaxColonies then
  226.                     MakeChatMessage("That sector is already maxed out of available colonies!",  "Warning");
  227.                     break;
  228.                 else
  229.                     v.Colonies[math.random(1, math.random(1000, 1000e4))] = ColonyFormat
  230.                     MakeChatMessage("A new colony is brought into the hands of your galactic empire!", "System", Color3.fromRGB(0,255,255))
  231.                     break;
  232.                 end
  233.                 MakeChatMessage("Current x:"..v.X.." y:"..v.Y, "System", Color3.fromRGB(255,255,255))
  234.             end
  235.         end
  236.     end
  237. end
  238.  
  239. function MakeChatMessage (ChatText, ChatType, CustomColor)
  240.     local CustomColorEnabled = {false};
  241.     if CustomColor  ~= nil and type(CustomColor) == "Color3" then
  242.         CustomColorEnabled[1] = true;
  243.     end
  244.     local ChatTypes = {
  245.         ['nil'] = {Prefix = "", Color = Color3.fromRGB(255,255,255)};
  246.         ['System'] = {Prefix = "[System]: ", Color =  Color3.fromRGB(188,188,178)};
  247.         ['Unsuccessful'] = {Prefix = "[Purchasing]: ", Color =  Color3.fromRGB(255,90,90)};
  248.         ['Successful'] = {Prefix = "[Purchasing]: ", Color =  Color3.fromRGB(90, 255, 90)};
  249.         ['Warn'] = {Prefix = "[WARNING]: ", Color =  Color3.fromRGB(188,188, 0)};
  250.     };
  251.    
  252.     local _CHATTYPE = ChatTypes[ChatType] or nil
  253.     if _CHATTYPE == nil then
  254.         _CHATTYPE = ChatTypes['nil'];
  255.     end
  256.    
  257.     CoreGui:SetCore("ChatMakeSystemMessage", {
  258.         Text = _CHATTYPE.Prefix..ChatText;
  259.         Color = CustomColor or _CHATTYPE.Color;
  260.         TextSize = 14;
  261.         --Font = "SourceSansBold";
  262.         TextFont = "SourceSansBold";
  263.         -- just seeing if this is how its done 
  264.     })
  265. end
  266.  
  267. local function GetPriceOfShip (ShipName)
  268.     for index, ship in pairs (Ships) do
  269.         if index == ShipName then
  270.             print(index)
  271.             local Price = ship.Price;
  272.             if Price ~= nil then
  273.                 return Price;
  274.             end
  275.         end
  276.     end
  277. end
  278.  
  279. local function GetClassOfShip (ShipName)
  280.     for index, ship in pairs (Ships) do
  281.         print(index)
  282.         if index == ShipName then
  283.             local Class = ship.Class;
  284.             if Class ~= nil then
  285.                 return Class;
  286.             end
  287.         end
  288.     end
  289. end
  290.  
  291. local function GetInfoOfShip (ShipName)
  292.     for index, ship in pairs (Ships) do
  293.         if index == ShipName then
  294.                 return ship
  295.         end
  296.     end
  297.     return {};
  298. end
  299.  
  300. local function GetActualShipFromUniqueId (UniqueId)
  301.     for i,v in pairs (Data.Ships) do
  302.         if v.UniqueId == UniqueId then
  303.             return i, v;
  304.         end
  305.     end
  306.     return nil
  307. end
  308.  
  309. local function PurchaseShip (ShipName, numBuy)
  310.     numBuy = tonumber(numBuy) or 1
  311.    
  312.    
  313.         for i = 0, numBuy-1  do
  314.             local Price = GetPriceOfShip(ShipName);
  315.             local Class = GetClassOfShip(ShipName);
  316.             print(Price)
  317.             print(Class)
  318.             if Price and Class and Data.Balance >= Price then
  319.                 Deduct(Price)
  320.                 UpdateStatLabels()
  321.                 MakeChatMessage(
  322.                     "You've successfully purchased an \""..ShipName.."\"! -"..tostring(Price).." spice!",
  323.                      "Successful")
  324.                 local NumberOfShips = function ()
  325.                     local num = 0;
  326.                         for i,v in pairs (Data.Ships) do
  327.                             if i:find(ShipName) then
  328.                                 num = num + 1
  329.                             end
  330.                         end
  331.                         return num
  332.                 end
  333.                 ShipInformation = GetInfoOfShip(ShipName);
  334.                 Owner = game.Players.LocalPlayer.Name;
  335.                 local SimpleCount = NumberOfShips()
  336.                 local UniqueId=tostring(math.random(1256)..math.random(1256)..math.random(1256)..math.random(1256))
  337.                 print(UniqueId)
  338.                 print(ShipInformation.Class)
  339.                 Data.Ships[ShipName..SimpleCount] = {ShipInformation = ShipInformation, UniqueId = UniqueId, SectorHousing = {0, 0}};
  340.                 return Data.Ships[ShipName..SimpleCount];
  341.                 else
  342.                         MakeChatMessage(
  343.                             "Failed to purchase an \""..ShipName.."\ x"..numBuy-1 .."\"! -"..tostring(Price * (numBuy - i)).." spice!",
  344.                                         "Unsuccessful")
  345.                         break
  346.             end
  347.         end
  348.    
  349. end
  350.  
  351.  
  352.  
  353. local function ListShips ()
  354.     local List = {};
  355.     for index, ship in pairs (Data.Ships) do
  356.         table.insert(List,  ship)
  357.         print(index.." UNIQUE ID:"..ship.UniqueId)
  358.     end
  359.     return List;
  360. end
  361.  
  362.  
  363.  function MineAll ()
  364.     local Ships = ListShips()
  365.    
  366.     local Ores = {"Stone", "Coal", "Iron", "Silver", "Copper", "Sulphur", "Iridium", "Diamond", "Oynx", "Ruby", "Sapphire", "Platinum", "Gold", "Ashley'sPussy'"};
  367.     local Values = {math.random(1, 95)/2, math.random(1, 190)/2, math.random(1, 380)/2, math.random(1, 760)/2, math.random(1, 1520)/2, math.random(1, 3040)/2, math.random(6080)/2, math.random(12160)/2, math.random(24320)/2, math.random(48640)/2, math.random(97280)/2, math.random(194560)/2, math.random(194560 * 2)/2, math.random(194560*4/2)};
  368.     local Chances = {12000, 300, 300, 300, 125, 75, 50, 50, 35, 35, 35, 25, 25, 15};
  369.     local ValueGain = 0;
  370.     local OresFound = {}
  371.     local CargoHold = 0;
  372.     MakeChatMessage("All Mining ships were launched to collect ores, waiting for their return!\nCommands temporarily disabled!", "System", Color3.fromRGB(255,255,0));
  373.     for i,v in pairs (Ships) do
  374.         wait()
  375.         if type(v.ShipInformation.Class) == "string" or type(v.ShipInformation.Class) == "table" then
  376.             local Classes = function ()
  377.                 if type(v.ShipInformation.Class) == "string" then
  378.                     return v.ShipInformation.Class else return v.ShipInformation.Class[1], v.ShipInformation.Class[2]
  379.                 end
  380.             end
  381.             local Class1, Class2 = Classes();
  382.            
  383.             if  Class1:find("Miner") or Class2 ~= nil and Class2:find("Harvester") then
  384.                 -- Don't worry about class 2 for now
  385.                
  386.                
  387.                 CargoHold = CargoHold + v.ShipInformation['CargoHold'];
  388.                 for cargo = 0, v.ShipInformation.CargoHold/2 do
  389.                     local OREFOUND = nil;
  390.                     repeat
  391.                     local OreToFind = math.random(1, #Ores)
  392.                     local Chance = Chances[OreToFind]
  393.                     if math.random(0, 15000 - (v.ShipInformation.MiningPercent*10)) <= Chance then
  394.                         OREFOUND = OreToFind
  395.                     end
  396.                     until OREFOUND ~= nil
  397.                     print(OREFOUND)
  398.                     table.insert(OresFound, Ores[OREFOUND]);
  399.                     --ValueGain = ValueGain + Values[OREFOUND];
  400.                     Increment(Values[OREFOUND]);
  401.                 end
  402.             end
  403.         end
  404.         UpdateStatLabels()
  405.     end
  406.    
  407.     --Increment(math.ceil(ValueGain))
  408.     MakeChatMessage("All Mining ships have returned and sold ores! Earned "..math.ceil(ValueGain).." spice!", "System", Color3.fromRGB(255,255,0));
  409.    
  410.    
  411. end
  412.  
  413. local function  MoveCommand (UniqueId, NewSector)
  414.     for i,v in pairs (Data.Ships) do
  415.         if v.UniqueId == UniqueId then
  416.             if NewSector ~= nil then
  417.                 if type(NewSector) == 'table' then
  418.                     if #NewSector == 2 then
  419.                         MakeChatMessage("Ship with UniqueId: \""..UniqueId.."\" is moving to Sector "..NewSector[1]..", "..NewSector[2], "System")
  420.                         local x = NewSector[1];
  421.                         local y = NewSector[2];
  422.                         local function DesignatedTime (x, y, ox, oy)
  423.                             return ((x / y) ^ (ox / oy)) * 7
  424.                         end
  425.                         local Time = DesignatedTime(x, y, v.SectorHousing[1], v.SectorHousing[2])
  426.                         local ConsumedTime = 0
  427.                         print(Time)
  428.                         repeat wait(0.1) ConsumedTime = ConsumedTime + 0.1 until ConsumedTime >= Time
  429.                         print("Consumed Enough Time command done")
  430.                         v.SectorHousing[1] = x;
  431.                         v.SectorHousing[2] = y;
  432.                     end
  433.                 end
  434.             end
  435.             break;
  436.         end
  437.     end
  438. end
  439.  
  440. function DestructShip (UniqueId)
  441.     for i,v in pairs (Data.Ships) do
  442.         if v.UniqueId == UniqueId then
  443.             v = nil
  444.         end
  445.     end
  446. end
  447.  
  448. function ShipBattle (Ship1, Ship2)
  449.     local Name, MyShip = GetActualShipFromUniqueId(Ship1)
  450.     local EnemyShip = Ship2;
  451.    
  452.     if MyShip ~= nil then
  453.         MakeChatMessage("Your ship \""..Name.."\" is under attack!", "Warning");
  454.        
  455.         local DoneFighting = false;
  456.        
  457.         local function DetermineWhoAttacksFirst ()
  458.             return math.random(2);
  459.         end
  460.        
  461.         local Result = DetermineWhoAttacksFirst()
  462.        
  463.         local function CheckForWinner(Health1, Health2)
  464.             print(Health1.." 1".." "..Health2.." 2")
  465.             if Health1 <= 0 then
  466.                 return false;
  467.             elseif Health2 <= 0 then
  468.                 return true;
  469.             end
  470.             return  nil
  471.         end
  472.        
  473.         local function afterBattle ()
  474.             --spawn(function()
  475.                 repeat wait(3)
  476.                     local WhoAttacks = math.random(2)
  477.                    
  478.                     if WhoAttacks == 1 then
  479.                         EnemyShip.Health = EnemyShip.Health - MyShip.ShipInformation.Attack
  480.                         MakeChatMessage("Your ship strikes the enemy dealing "..MyShip.ShipInformation.Attack.." DMG!", "System")
  481.                     else
  482.                         MyShip.ShipInformation.Health = MyShip.ShipInformation.Health - EnemyShip.Attack
  483.                         MakeChatMessage("Your ship takes a hit from the enemy strike, taking "..EnemyShip.Attack.." DMG!", "System")
  484.                     end
  485.                 until CheckForWinner(MyShip.ShipInformation.Health, EnemyShip.Health) ~= nil
  486.                
  487.                 if CheckForWinner(MyShip.ShipInformation.Health, EnemyShip.Health) == true then
  488.                     MakeChatMessage("You've won the battle and recieved cargo! (FUTURE NOT ACTUALLY REWARDED", "System");
  489.                 else
  490.                     MakeChatMessage("You've lost your ship in the battle, it explodes and a manly tear drops.", "Warning");
  491.                     DestructShip(MyShip.UniqueId);
  492.                 end
  493.             --end)
  494.         end
  495.        
  496.         if Result == 1 then
  497.             MakeChatMessage("Your ship attacks first!", "System");
  498.             EnemyShip.Health = EnemyShip.Health - MyShip.ShipInformation.Attack
  499.             if CheckForWinner(MyShip.ShipInformation.Health, EnemyShip.Health) == nil then
  500.                 afterBattle ()
  501.             end
  502.         else
  503.             MakeChatMessage("Your ship attacks second!", "System");
  504.             MyShip.ShipInformation.Health = MyShip.ShipInformation.Health - EnemyShip.Attack
  505.             if CheckForWinner(MyShip.ShipInformation.Health, EnemyShip.Health) == nil then
  506.                 afterBattle ()
  507.             end
  508.         end
  509.        
  510.     end
  511. end
  512. MineAll()
  513. --Cycle--
  514. local Action = false;
  515. game.Players.LocalPlayer.Chatted:Connect(function(Message)
  516.     print(Message)
  517.     if Action then
  518.         MakeChatMessage("You or your ships are currently performing an action!", 'Warning');
  519.         return
  520.     end
  521.     if Message:find("$") then
  522.  
  523.             if Message:lower() == "mine all" then
  524.                 Action = true;
  525.                 MineAll()
  526.             end
  527.            
  528.             if Message:sub(2, 4) == "buy" then
  529.                 local ship = ConvertIdToName(tonumber(Message:sub(5, Message:find(";")-1 or Message:len())))
  530.                 local numBuy = tonumber(Message:sub(Message:find(";") + 1 or Message:len()));
  531.                 if ship == "undefined" then
  532.                     MakeChatMessage(Message:sub(4, Message:find(";") or Message:len()).." isn't an valid id!", "Warning");
  533.                 else
  534.                    
  535.                     if numBuy and type(numBuy) == 'number' and numBuy > 1 then
  536.                        
  537.                             PurchaseShip(ship, numBuy)
  538.                        
  539.                     else
  540.                         PurchaseShip(ship, 1)
  541.                     end
  542.                 end
  543.             end
  544.     end
  545.     Action = false;
  546. end)
  547.  
  548. local TestLander = PurchaseShip("Cyrogem", 1);
  549. local TestId = TestLander.UniqueId
  550. --print(TestId)
  551. ColonizeSector({0, 0}, TestId)
  552. TestLander = PurchaseShip("Cyrogem", 1);
  553. TestId = TestLander.UniqueId
  554. ColonizeSector({0, -2}, TestId)
  555.         while wait(10) do
  556.             Increment(math.random(Data.Profit[1], Data.Profit[2]))
  557.            
  558.             local function SetMinProfit ()
  559.                 local MinProfit = 0;
  560.                 for index,sector in pairs (Data.Sector) do
  561.                     for _index, colony in pairs (sector.Colonies) do
  562.                         if colony.Owner == game.Players.LocalPlayer then
  563.                             local Population = colony.Population
  564.                             MinProfit = MinProfit + math.ceil(Population / 10);
  565.                         end
  566.                     end
  567.                 end
  568.                 Data.Profit[1] = MinProfit;
  569.             end
  570.            
  571.             local function SetMaxProfit ()
  572.                 local MaxProfit = 0;
  573.                 for index,sector in pairs (Data.Sector) do
  574.                     for _index, colony in pairs (sector.Colonies) do
  575.                         if colony.Owner == game.Players.LocalPlayer then
  576.                             local Population = colony.Population
  577.                             MaxProfit = MaxProfit + math.ceil(Population / 3);
  578.                         end
  579.                     end
  580.                 end
  581.                 Data.Profit[2] = MaxProfit;
  582.             end
  583.            
  584.            
  585.                 for _, sector in pairs (Data.Sector) do
  586.                     for _i, colony in pairs (sector.Colonies) do
  587.                         if colony.Owner == game.Players.LocalPlayer then
  588.                             local Population = colony.Population
  589.                             local IncreasePopulationOfKidsFromGirlsPussies = math.random(1, 25) + math.floor(
  590.                                     Population / 100
  591.                                 ) * 5 + math.floor (
  592.                                     Population / 1000
  593.                                 ) * 20
  594.                             colony.Population = colony.Population + IncreasePopulationOfKidsFromGirlsPussies;
  595.                         end
  596.                     end
  597.                 end
  598.            
  599.            
  600.             SetMinProfit()
  601.             SetMaxProfit()
  602.             --ShipBattle(ListShips()[1].UniqueId, {Health  = 100; Attack = 50;})
  603.             UpdateStatLabels()
  604.         end
  605.  
  606.  
  607. --MoveCommand(ListShips()[1].UniqueId, {20, 20})
  608. --MoveCommand(ListShips()[2].UniqueId, {20, 20})
  609. --[[
  610. MakeChatMessage("Example of NIL", nil, nil);
  611. MakeChatMessage("Example of WARN", "Warn", nil);
  612. MakeChatMessage("Example of PURCHASE-Unsuccessful", "Unsuccessful", nil);
  613. MakeChatMessage("Example of PURCHASE-successful", "Successful", nil);
  614. MakeChatMessage("Example of System", "System", nil)
  615. ]]--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement