Skip to content

Commit

Permalink
Last map script and attempt at fixing ending scene
Browse files Browse the repository at this point in the history
  • Loading branch information
knoxed committed Aug 16, 2024
1 parent fb3f13b commit 9b80ff3
Showing 1 changed file with 71 additions and 7 deletions.
78 changes: 71 additions & 7 deletions gamemode/gametypes/hl2ep2/mapscripts/ep2_outland_12a.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,84 @@ MAPSCRIPT.DefaultLoadout = {
HEV = true
}

MAPSCRIPT.InputFilters = {}
MAPSCRIPT.InputFilters = {
["door_silo_lab_3"] = {"Close"},
["door_launchbunker_exit_a"] = {"Close"}
}
MAPSCRIPT.EntityFilterByClass = {}
MAPSCRIPT.EntityFilterByName = {
["startitems"] = true,
["brush_launchbunker_exit_a"] = true,
}

MAPSCRIPT.GlobalStates = {
}

MAPSCRIPT.Checkpoints = {
}
MAPSCRIPT.GlobalStates = {}
MAPSCRIPT.Checkpoints = {}

function MAPSCRIPT:PostInit()
print("-- Incomplete mapscript --")

-- 1. elevator wait and parented checkpoint
local elev_cp = GAMEMODE:CreateCheckpoint(Vector(-376, -2180, -1559), Angle(0, 90, 0))
ents.WaitForEntityByName("tracktrain_elevator", function(ent)
elev_cp:SetParent(ent)
end)

ents.WaitForEntityByName("trigger_elevator_go_down", function(ent)
ent:SetKeyValue("teamwait", "1")
ent.OnTrigger = function(_, activator)
GAMEMODE:SetPlayerCheckpoint(elev_cp, activator)
end
end)

-- 2. elevator wait and parented checkpoint
local elev2_cp = GAMEMODE:CreateCheckpoint(Vector(1821, -2506, -1165), Angle(0, 0, 0))
ents.WaitForEntityByName("lift_1", function(ent)
elev2_cp:SetParent(ent)
end)

ents.WaitForEntityByName("trigger_start_lift_1", function(ent)
ent:SetKeyValue("teamwait", "1")
ent.OnTrigger = function(_, activator)
GAMEMODE:SetPlayerCheckpoint(elev2_cp, activator)
end
end)

-- TODO: Fix final cutscene .... lets try.... UNFINISHED
ents.WaitForEntityByName("cvehicle.hangar", function(ent)
for i = 1, game.MaxPlayers() do
local seat = ents.Create("prop_vehicle_choreo_generic")
seat:SetName("cvehicle.hangar_" .. tostring(i))
seat:SetPos(ent:GetPos())
seat:SetAngles(ent:GetAngles())
seat:SetParent(ent)
seat:SetKeyValue("vehiclescript", "scripts/vehicles/choreo_vehicle_ep2_hangar.txt")
seat:SetKeyValue("VehicleLocked", "1")
seat:SetModel(ent:GetModel())
seat:Spawn()
end
end)

local autoParent = ents.Create("logic_auto")
autoParent:Fire("AddOutput", "OnMapSpawn cvehicle.hangar,SetParentAttachment,vehicle_driver_eyes,0.1,-1")

local function GetNextVehicle()
local vehicles = ents.FindByName("cvehicle.hangar_*")
for _, v in pairs(vehicles) do
local driver = v:GetInternalVariable("m_hPlayer")
if IsValid(driver) == false then return v end
end
end

GAMEMODE:WaitForInput("cvehicle.hangar", "EnterVehicle", function(ent)
for k, v in pairs(player.GetAll()) do
if v:Alive() == false then continue end
local vehicle = GetNextVehicle()
if IsValid(vehicle) then
v:EnterVehicle(vehicle)
end
end

return true
end)
end

return MAPSCRIPT

0 comments on commit 9b80ff3

Please sign in to comment.