Skip to content

Commit

Permalink
Merge pull request #256 from dounai2333/d2-coast-03-mapscript
Browse files Browse the repository at this point in the history
Update mapscript of d2_coast_03
  • Loading branch information
ZehMatt authored Dec 25, 2023
2 parents 3ddab34 + 8b7276a commit 11ddf27
Show file tree
Hide file tree
Showing 2 changed files with 149 additions and 21 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
0.9.20 (in development)
- Improved: When "Friendly Fire" and "Player Collision" both disabled, bullet can pass through other players.
- Improved: Lambda no longer override the localization already existing in the game.
- Improved: d2_coast_03: Give more supplies, hope this can help player fight with multiple gunships better.
- Improved: d2_coast_03: Mission critical NPCs now have protection to prevent dying from a car accident.
- Fixed: Pickup SMG grenade showing wrong icon.
- Fixed: d2_coast_03: G-Man and Oddssa stay in the balcony forever.
- Fixed: d2_coast_03: Blocked a exploit where player can use it to skip the final scene.

0.9.19
- Fixed: SWEPs that use custom CalcView not working correctly.
Expand Down
166 changes: 145 additions & 21 deletions gamemode/gametypes/hl2/mapscripts/d2_coast_03.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ MAPSCRIPT.DefaultLoadout = {
HEV = true
}

MAPSCRIPT.InputFilters = {}
MAPSCRIPT.InputFilters = {
["fog"] = {"SetStartDist"}
}

MAPSCRIPT.EntityFilterByClass = {}

MAPSCRIPT.EntityFilterByName = {
Expand All @@ -42,18 +45,124 @@ function MAPSCRIPT:PostInit()
-- Combine and their binoculars... it just fucks your game up, nothing else.
ents.WaitForEntityByName("telescope", function(ent)
ent:SetKeyValue("wait", "20")
ent:SetKeyValue("spawnflags", "4")
ent:SetKeyValue("spawnflags", "20")
end)

ents.WaitForEntityByName("citizen_b_regular_original", function(ent)
ent:SetHealth(100)
-- Bug fixes, exist in base HL2: The cleanup relay got triggered before first time use binocular.
-- This bug can result player seeing G-Man face to face and duplicated citizens.
-- Remove the cutscene related entities about using binocular. Player no longer see cutscene but better safe than sorry.
ents.WaitForEntityByName("gman_template", function(ent)
ent:Remove()
end)

ents.WaitForEntityByName("rocketman", function(ent)
ent:SetHealth(100)
ents.WaitForEntityByName("citizen_spawn_relay", function(ent)
ent:Remove()
end)

ents.WaitForEntityByName("gatekeeper", function(ent)
ents.WaitForEntityByName("binoccit_1", function(ent)
ent:Remove()
end)

ents.WaitForEntityByName("binoccit_2", function(ent)
ent:Remove()
end)

ents.WaitForEntityByName("antlion_ragdoll", function(ent)
ent:Remove()
end)

ents.WaitForEntityByName("lr_binoc_scene", function(ent)
ent:Remove()
end)

ents.WaitForEntityByName("gman_walk", function(ent)
ent:Remove()
end)

ents.WaitForEntityByName("odessa_walk", function(ent)
ent:Remove()
end)

-- Spawn more supplies
local crate_rpg1 = ents.Create("item_ammo_crate")
crate_rpg1:SetKeyValue("AmmoType", "3")
crate_rpg1:SetPos(Vector(6550, 4186, 276))
crate_rpg1:SetAngles(Angle(0, 90, 0))
crate_rpg1:Spawn()

local crate_rpg2 = ents.Create("item_ammo_crate")
crate_rpg2:SetKeyValue("AmmoType", "3")
crate_rpg2:SetPos(Vector(8998, 4490, 272))
crate_rpg2:SetAngles(Angle(0, 180, 0))
crate_rpg2:Spawn()

local medkits =
{
{7025, 3475, 340},
{7000, 3485, 350},
{6530, 4355, 280},
{7920, 3520, 325},
{7895, 3520, 325},
{6735, 4790, 330},
{6720, 4810, 330},
{8365, 4350, 440},
{8330, 4330, 440},
{8295, 4325, 440},
{8870, 4450, 535},
{8865, 4425, 535}
}

for _, v in ipairs(medkits) do
local medkit = ents.Create("item_healthkit")
medkit:SetPos(Vector(v[1], v[2], v[3]))
medkit:Spawn()
end

local batteries =
{
{8685, 4185, 305},
{8665, 4175, 305},
{8810, 4205, 405},
{8415, 4340, 545},
{8410, 4345, 545},
{6480, 4370, 285}
}

for _, v in ipairs(batteries) do
local battery = ents.Create("item_battery")
battery:SetPos(Vector(v[1], v[2], v[3]))
battery:Spawn()
end

-- Block the road to prevent player skipping the whole scene.
-- These are 'func_vehicleclip' and it only do collision with vehicle, force it to collide with player.
for _, v in ipairs(ents.FindByModel("*145")) do
v:SetCollisionGroup(COLLISION_GROUP_PLAYER)
v:SetName("road_exploit_block")
end

for _, v in ipairs(ents.FindByModel("*146")) do
v:SetCollisionGroup(COLLISION_GROUP_PLAYER)
v:SetName("road_exploit_block")
end

for _, v in ipairs(ents.FindByModel("*154")) do
v:SetCollisionGroup(COLLISION_GROUP_PLAYER)
v:SetName("road_exploit_block")
end

-- Only the player can pass this filter.
-- Prevent vehicle crushing the critical NPCs in accident!
local filter_player = ents.Create("filter_activator_class")
filter_player:SetName("filter_player")
filter_player:SetKeyValue("filterclass", "player")

ents.WaitForEntityByName("greeter_maker", function(ent)
ent:Fire("AddOutput", "OnEntitySpawned citizen_b_regular_original,AddOutput,health 100,0.1,-1")
ent:Fire("AddOutput", "OnEntitySpawned citizen_b_regular_original,SetDamageFilter,filter_player,0.1,-1")
end)

ents.WaitForEntityByName("rocketman", function(ent)
ent:SetHealth(100)
end)

Expand All @@ -78,6 +187,34 @@ function MAPSCRIPT:PostInit()
return true -- Suppress
end)

GAMEMODE:WaitForInput("gunship_spawner_2", "Spawn", function(ent)
ent:RemoveTemplateData("OnDeath")
ent:AddTemplateData("squadname", "lambda_gunships")
ent:SetKeyValue("SpawnFrequency", "10")
ent:Enable()

ent.OnAllSpawnedDead = function(e)
TriggerOutputs({{"ag_siren", "StopSound", 0.0, ""}, {"lr_radioloop", "Disable", 0.0, ""}, {"citizen_standoff", "Kill", 0.0, ""}, {"aigf_combat", "Kill", 0.0, ""}, {"aisc_odessapostgunship", "Enable", 0.0, ""}, {"lr_squad_follow_*", "Kill", 0.0, ""}, {"post_gunship_jeep_relay*", "Enable", 0.0, ""}, {"aigf_odessapostgunship*", "Activate", 0.10, ""}, {"ss_post**", "BeginSequence", 2.00, ""}, {"gunshipdown_music*", "PlaySound", 3.00, ""}})
end

return true
end)

ents.WaitForEntityByName("gatekeeper", function(ent)
ent:SetHealth(100)
ent:Fire("SetDamageFilter", "filter_player")
end)

GAMEMODE:WaitForInput("village_gate", "Open", function(gate_ent)
ents.WaitForEntityByName("gatekeeper", function(ent)
GAMEMODE:UnregisterMissionCriticalNPC(ent)
end)

ents.WaitForEntityByName("road_exploit_block", function(ent)
ent:SetCollisionGroup(COLLISION_GROUP_VEHICLE_CLIP)
end)
end)

local checkpoint1 = GAMEMODE:CreateCheckpoint(Vector(-5971.663574, 3534.091064, 269.338867), Angle(4.653, 55.612, 0.000))

GAMEMODE:WaitForInput("spypost_template", "ForceSpawn", function(ent)
Expand All @@ -92,24 +229,11 @@ function MAPSCRIPT:PostInit()
GAMEMODE:SetPlayerCheckpoint(checkpoint2)
GAMEMODE:SetVehicleCheckpoint(Vector(6610.592285, 4405.477539, 264.207794), Angle(0.091, -121.466, 0.363))
end)

GAMEMODE:WaitForInput("gunship_spawner_2", "Spawn", function(ent)
ent:RemoveTemplateData("OnDeath")
ent:AddTemplateData("squadname", "lambda_gunships")
ent:SetKeyValue("SpawnFrequency", "10")
ent:Enable()

ent.OnAllSpawnedDead = function(e)
TriggerOutputs({{"ag_siren", "StopSound", 0.0, ""}, {"lr_radioloop", "Disable", 0.0, ""}, {"citizen_standoff", "Kill", 0.0, ""}, {"aigf_combat", "Kill", 0.0, ""}, {"aisc_odessapostgunship", "Enable", 0.0, ""}, {"lr_squad_follow_*", "Kill", 0.0, ""}, {"post_gunship_jeep_relay*", "Enable", 0.0, ""}, {"aigf_odessapostgunship*", "Activate", 0.10, ""}, {"ss_post**", "BeginSequence", 2.00, ""}, {"gunshipdown_music*", "PlaySound", 3.00, ""}})
end

return true
end)
end
end

function MAPSCRIPT:PostPlayerSpawn(ply)
--DbgPrint("PostPlayerSpawn")
end

return MAPSCRIPT
return MAPSCRIPT

0 comments on commit 11ddf27

Please sign in to comment.