Repository navigation
Randomized Vehicle Stories
Пупсич edited this page Jun 16, 2026
·
2 revisions
local ISRVSBase = require("YAPZLib/RVSBase")
SimpleBlockade = ISRVSBase:derive("SimpleBlockade")
SimpleBlockade.name = "Simple Blockade"
SimpleBlockade.chance = 110 -- actually weight of road story
SimpleBlockade.minZoneWidth = 8 -- minimal road width
SimpleBlockade.minZoneHeight = 8 -- minimal road length
SimpleBlockade.minDays = 5 -- amount of days of apocalypse after which road story starts spawning (can be nil, then story will spawn from first day)
SimpleBlockade.maxDays = 30 -- amount of days of apocalypse after which road story stop spawning (can be nil, then story will spawn always)
-- tables type of ISRVSBase also will have self.spawnPoint and self.direction so they can be used too
SimpleBlockade.spawn = function(self) -- main function, without it road story will not spawn
local spriteName = "carpentry_02_13" -- sandbag facing north/south
if self.direction == IsoDirections.E or self.direction == IsoDirections.W then
spriteName = "carpentry_02_12" -- sandbag facing west/east
end
self:addTileObjectBySpriteName(-2, 2, self.spawnPoint.z, spriteName, false, false) -- placing sandbag 1
self:addTileObjectBySpriteName(1, 2, self.spawnPoint.z, spriteName, false, false) -- placing sandbag 2
local vehicle1 = self:addVehicle(ISRVSBase.getVehicleFromZone("bad", nil, true), -1.5, 1, 90, nil, "bad", false) -- spawning car 1 with name from VehicleZoneDistribution.bad.vehicles
if vehicle1 then
vehicle1:setAlarmed(false)
vehicle1:setGeneralPartCondition(ZombRandFloat(0.2, 0.7), ZombRand(40, 71))
self:addZombiesOnVehicle(vehicle1, ZombRand(2, 4), "Bandit", 20) -- spawning zombies near car
end
local vehicle2 = self:addVehicle(ISRVSBase.getVehicleFromZone("medium", nil, true), 1.5, -1, -90, nil, "medium", false) -- car 2
if vehicle2 then
vehicle2:setAlarmed(false)
vehicle2:setGeneralPartCondition(ZombRandFloat(0.2, 0.7), ZombRand(40, 71))
self:addZombiesOnVehicle(vehicle2, ZombRand(3, 5), "Bandit", 20)
end
for offsetX = -2, 2 do
for offsetY = -2, 2 do
self:addBloodSplat(offsetX, offsetY, self.spawnPoint.z, ZombRand(2, 8)) -- adding some blood :)
end
end
end