All pastes #73926 Raw Edit

Miscellany

public lua v1 · immutable
#73926 ·published 2006-06-28 13:26 UTC
rendered paste body
-- Collective_Command.luafunction CCommand_OnProduce(veh, pl, menu)  -- Refine Minerals  if (menu == 1) then    local count = pl:inventory_count("Eljaycium Ore");        if (count == 0) then      return true;    end        pl:inventory_remove("Eljaycium Ore");    pl:team_get():inventory_add("Build Point", count * 50);    pl:score_add(count * 10);        return true;    -- Purchase Defense Drone (50 BP)  elseif (menu == 2) then    if (pl:score_get() < 10) then      pl:status("You do not have enough score to purchase a Collective Defense Drone");      return true;    end        if (pl:team_get():inventory_count("Build Point") < 50) then      pl:status("Your team does not have enough Build Points to purchase a Collective Defense Drone");      return true;    end        pl:score_sub(10);    pl:team_get():inventory_remove("Build Point", 50);    pl:inventory_add("Collective Defense Drone", 1);        return true;    -- Return Defense Drone  elseif (menu == 3) then    if (pl:inventory_count("Collective Defense Drone") < 1) then      pl:status("You do not have a Collective Defense Drone");      return true;    end        pl:score_add(10);    pl:team_get():inventory_add("Build Point", 50);    pl:inventory_remove("Collective Defense Drone", 1);        return true;    -- Purchase Collective GUNSAT (55 BP)  elseif (menu == 4) then    if (pl:score_get() < 11) then      pl:status("You do not have enough score to purchase a Collective GUNSAT");      return true;    end        if (pl:team_get():inventory_count("Build Point") < 55) then      pl:status("Your team does not have enough Build Points to purchase a Collective GUNSAT");      return true;    end        pl:score_sub(11);    pl:team_get():inventory_remove("Build Point", 55);    pl:inventory_add("Collective GUNSAT", 1);        return true;    -- Return GUNSAT  elseif (menu == 5) then    if (pl:inventory_count("Collective GUNSAT") < 1) then      pl:status("You do not have a Collective GUNSAT");      return true;    end        pl:score_add(11);    pl:team_get():inventory_add("Build Point", 55);    pl:inventory_remove("Collective GUNSAT", 1);        return true;  end    -- Purchase SupplySat (500 BP)  elseif (menu == 6) then    if (pl:score_get() < 100) then      pl:status("You do not have enough score to purchase a Collective SupplySat");      return true;    end        if (pl:team_get():inventory_count("Build Point") < 500) then      pl:status("Your team does not have enough Build Points to purchase a Collective SupplySat");      return true;    end        pl:score_sub(100);    pl:team_get():inventory_remove("Build Point", 500);    pl:inventory_add("Collective SupplySat", 1);        pl:team_get():message(pl.m_name .. " purchased a SupplySat");        return true;    -- Return SupplySat  elseif (menu == 7) then    if (pl:inventory_count("Collective SupplySat") < 1) then      pl:status("You do not have a Collective SupplySat");      return true;    end        pl:score_add(100);    pl:team_get():inventory_add("Build Point", 500);    pl:inventory_remove("Collective SupplySat", 1);        pl:team_get():message(pl.m_name .. " returned a SupplySat");        return true;    -- Load 5 WarShrike Missiles  elseif (menu == 8) then    -- Let server handle it    return false;  end    return false;end-- Titan_Command.luafunction TCommand_OnProduce(veh, pl, menu)  -- Refine Minerals  if (menu == 1) then    local count = pl:inventory_count("Eljaycium Ore");        if (count == 0) then      return true;    end        pl:inventory_remove("Eljaycium Ore");    pl:team_get():inventory_add("Build Point", count * 50);    pl:score_add(count * 10);        return true;    -- Purchase Defense Drone (50 BP)  elseif (menu == 2) then    if (pl:score_get() < 10) then      pl:status("You do not have enough score to purchase a Titan Defense Drone");      return true;    end        if (pl:team_get():inventory_count("Build Point") < 50) then      pl:status("Your team does not have enough Build Points to purchase a Titan Defense Drone");      return true;    end        pl:score_sub(10);    pl:team_get():inventory_remove("Build Point", 50);    pl:inventory_add("Titan Defense Drone", 1);        return true;    -- Return Defense Drone  elseif (menu == 3) then    if (pl:inventory_count("Titan Defense Drone") < 1) then      pl:status("You do not have a Titan Defense Drone");      return true;    end        pl:score_add(10);    pl:team_get():inventory_add("Build Point", 50);    pl:inventory_remove("Titan Defense Drone", 1);        return true;    -- Purchase Titan GUNSAT (55 BP)  elseif (menu == 4) then    if (pl:score_get() < 11) then      pl:status("You do not have enough score to purchase a Titan GUNSAT");      return true;    end        if (pl:team_get():inventory_count("Build Point") < 55) then      pl:status("Your team does not have enough Build Points to purchase a Titan GUNSAT");      return true;    end        pl:score_sub(11);    pl:team_get():inventory_remove("Build Point", 55);    pl:inventory_add("Titan GUNSAT", 1);        return true;    -- Return GUNSAT  elseif (menu == 5) then    if (pl:inventory_count("Titan GUNSAT") < 1) then      pl:status("You do not have a Titan GUNSAT");      return true;    end        pl:score_add(11);    pl:team_get():inventory_add("Build Point", 55);    pl:inventory_remove("Titan GUNSAT", 1);        return true;  end    -- Purchase SupplySat (500 BP)  elseif (menu == 6) then    if (pl:score_get() < 100) then      pl:status("You do not have enough score to purchase a Titan SupplySat");      return true;    end        if (pl:team_get():inventory_count("Build Point") < 500) then      pl:status("Your team does not have enough Build Points to purchase a Titan SupplySat");      return true;    end        pl:score_sub(100);    pl:team_get():inventory_remove("Build Point", 500);    pl:inventory_add("Titan SupplySat", 1);        pl:team_get():message(pl.m_name .. " purchased a SupplySat");        return true;    -- Return SupplySat  elseif (menu == 7) then    if (pl:inventory_count("Titan SupplySat") < 1) then      pl:status("You do not have a Titan SupplySat");      return true;    end        pl:score_add(100);    pl:team_get():inventory_add("Build Point", 500);    pl:inventory_remove("Titan SupplySat", 1);        pl:team_get():message(pl.m_name .. " returned a SupplySat");        return true;    -- Load 5 WarShrike Missiles  elseif (menu == 8) then    -- Let server handle it    return false;  end    return false;end-- Fleeties.lua-- Fleetiesdofile("Scripts/Collective_Command.lua");dofile("Scripts/Titan_Command.lua");g_arena = nil;function Arena_OnCreate(arena)  g_arena = arena;endfunction Arena_OnGameStart()  g_arena:team_get(0):inventory_add("Build Point", 2500);  g_arena:team_get(1):inventory_add("Build Point", 2500);endfunction Vehicle_OnProduce(veh, pl, menu)  -- Collective Command  if (veh.type == 401) then    return CCommand_OnProduce(veh, pl, menu);    -- Titan Command  elseif (veh.type == 411) then    return TCommand_OnProduce(veh, pl, menu);  end    return false;end