Remove unused effect 'Peds Raining Cats And Dogs' and update player invincibility logic; add new effects: 'Teleport Everything Away' and 'Back To Black' with respective functionalities.
This commit is contained in:
@@ -1,45 +0,0 @@
|
|||||||
EffectInfo = {
|
|
||||||
Name = "Its Raining Cats And Dogs",
|
|
||||||
EffectId = "peds_rainingcatsanddogs",
|
|
||||||
TimedType = "Normal",
|
|
||||||
EffectGroup = "_group_spawngeneric",
|
|
||||||
EffectCategory = "None"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function OnStart()
|
|
||||||
DisplayHelpText("No animals were harmed in this effect.", 8)
|
|
||||||
test = {"g", "y"}
|
|
||||||
spawned_animals = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
function OnStop()
|
|
||||||
end
|
|
||||||
|
|
||||||
function OnTick()
|
|
||||||
animals = {"a_c_cat_01", "a_c_chop", "a_c_husky", "a_c_poodle", "a_c_pug", "a_c_rottweiler_02", "a_c_retriever", "a_c_westy", "a_c_shepherd", "a_c_rottweiler"}
|
|
||||||
animalModel = GET_HASH_KEY(random_choice(animals))
|
|
||||||
playerPed = PLAYER_PED_ID()
|
|
||||||
heading = GET_ENTITY_HEADING(playerPed)
|
|
||||||
coords = GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, math.random(75), math.random(75), math.random(75))
|
|
||||||
animal = CreatePoolPed(0, animalModel, coords.x, coords.y, coords.z, heading)
|
|
||||||
SET_ENTITY_INVINCIBLE(animal, true)
|
|
||||||
TASK_REACT_AND_FLEE_PED(animal, playerPed)
|
|
||||||
SET_BLOCKING_OF_NON_TEMPORARY_EVENTS(animal, true)
|
|
||||||
table.insert(spawned_animals, animal)
|
|
||||||
WAIT(math.random(1500, 6000))
|
|
||||||
if #spawned_animals > 50 then
|
|
||||||
for animal in spawned_animals do
|
|
||||||
if DOES_ENTITY_EXIST(animal) then
|
|
||||||
DELETE_ENTITY(Holder(animal))
|
|
||||||
table.remove(spawned_animals, animal)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function random_choice(p1)
|
|
||||||
choice = p1[math.random(#p1)]
|
|
||||||
return choice
|
|
||||||
end
|
|
||||||
@@ -13,13 +13,10 @@ end
|
|||||||
|
|
||||||
function OnStop()
|
function OnStop()
|
||||||
SET_MAX_WANTED_LEVEL(5)
|
SET_MAX_WANTED_LEVEL(5)
|
||||||
SET_PLAYER_INVINCIBLE(0, false)
|
SET_PLAYER_INVINCIBLE(GET_PLAYER_INDEX(), false)
|
||||||
end
|
end
|
||||||
|
|
||||||
function OnTick()
|
function OnTick()
|
||||||
playerPed = PLAYER_PED_ID()
|
|
||||||
if DOES_ENTITY_EXIST(playerPed) and not IS_PED_DEAD_OR_DYING(playerPed,0) then
|
|
||||||
SET_MAX_WANTED_LEVEL(0)
|
SET_MAX_WANTED_LEVEL(0)
|
||||||
SET_PLAYER_INVINCIBLE(0, true)
|
SET_PLAYER_INVINCIBLE(GET_PLAYER_INDEX(), true)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
63
Player/PlayerTPEverythingAway.lua
Normal file
63
Player/PlayerTPEverythingAway.lua
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
-- Short coherent template for a Chaos Mod effect.
|
||||||
|
-- Edit the fields below to describe the effect and adjust timing/weighting.
|
||||||
|
-- Full reference: https://github.com/gta-chaos-mod/ChaosModV/wiki/Lua-Scripting
|
||||||
|
|
||||||
|
EffectInfo = { -- ScriptInfo for mod version < 2.0
|
||||||
|
Name = "Teleport Everything Away", -- Display name of the effect
|
||||||
|
EffectId = "player_tpallaway", -- ScriptId for mod version < 2.0, must be unique
|
||||||
|
Description = "Teleports all nearby vehicles and peds away from the player.", -- Short description of the effect
|
||||||
|
TimedType = "None", -- None, Normal, Short, Permanent, or "Custom"
|
||||||
|
-- CustomTime = 10, -- (seconds) only if TimedType = "Custom"
|
||||||
|
WeightMultiplier = 1, -- Relative probability of being chosen
|
||||||
|
HideRealNameOnStart = false, -- true to hide the effect's real name when it starts
|
||||||
|
EffectCategory = "None", -- Optional category
|
||||||
|
EffectGroup = "", -- Optional grouping (leave empty if unused)
|
||||||
|
IncompatibleIds = {
|
||||||
|
-- Example: "other_effect_id", -- add EffectIds that cannot run simultaneously
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Called once when the effect starts
|
||||||
|
function OnStart()
|
||||||
|
print("[effect_template] OnStart: " .. ((EffectInfo and EffectInfo.Name) or "unknown"))
|
||||||
|
EnableScriptThreadBlock()
|
||||||
|
-- Initialize effect state here (e.g. set timers, spawn helpers)
|
||||||
|
playerPed = PLAYER_PED_ID()
|
||||||
|
playerPos = GET_ENTITY_COORDS(playerPed, true)
|
||||||
|
for _, vehicle in ipairs(GetAllVehicles()) do
|
||||||
|
vehiclePos = GET_ENTITY_COORDS(vehicle, true)
|
||||||
|
distance = VDIST2(playerPos.x, playerPos.y, playerPos.z, vehiclePos.x, vehiclePos.y, vehiclePos.z)
|
||||||
|
if distance < 1000000 then -- 1000 units squared
|
||||||
|
newX = vehiclePos.x + math.random(-500, 500)
|
||||||
|
newY = vehiclePos.y + math.random(-500, 500)
|
||||||
|
newZ = vehiclePos.z + 50 -- teleport above ground to avoid collisions
|
||||||
|
SET_ENTITY_COORDS(vehicle, newX, newY, newZ, false, false, false, true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for _, ped in ipairs(GetAllPeds()) do
|
||||||
|
if ped ~= playerPed then
|
||||||
|
pedPos = GET_ENTITY_COORDS(ped, true)
|
||||||
|
distance = VDIST2(playerPos.x, playerPos.y, playerPos.z, pedPos.x, pedPos.y, pedPos.z)
|
||||||
|
if distance < 1000000 then -- 1000 units squared
|
||||||
|
newX = pedPos.x + math.random(-500, 500)
|
||||||
|
newY = pedPos.y + math.random(-500, 500)
|
||||||
|
newZ = pedPos.z + 50 -- teleport above ground to avoid collisions
|
||||||
|
SET_ENTITY_COORDS(ped, newX, newY, newZ, false, false, false, true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DisableScriptThreadBlock()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Called once when the effect stops/ends
|
||||||
|
function OnStop()
|
||||||
|
print("[effect_template] OnStop: " .. ((EffectInfo and EffectInfo.Name) or "unknown"))
|
||||||
|
-- Cleanup state here (e.g. remove entities, clear timers)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Called every game tick while the effect is active
|
||||||
|
function OnTick()
|
||||||
|
-- Keep this lightweight. Use this for per-frame checks or gradual changes.
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add custom helper functions below.
|
||||||
56
Screen/ScreenBackToBlack.lua
Normal file
56
Screen/ScreenBackToBlack.lua
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
-- Short coherent template for a Chaos Mod effect.
|
||||||
|
-- Edit the fields below to describe the effect and adjust timing/weighting.
|
||||||
|
-- Full reference: https://github.com/gta-chaos-mod/ChaosModV/wiki/Lua-Scripting
|
||||||
|
|
||||||
|
EffectInfo = { -- ScriptInfo for mod version < 2.0
|
||||||
|
Name = "Back To Black", -- Display name of the effect
|
||||||
|
EffectId = "screen_backtoblack", -- ScriptId for mod version < 2.0, must be unique
|
||||||
|
Description = "A short one-line description of what this effect does.",
|
||||||
|
TimedType = "Custom", -- None, Normal, Short, Permanent, or "Custom"
|
||||||
|
CustomTime = 340, -- (seconds) only if TimedType = "Custom"
|
||||||
|
WeightMultiplier = 1, -- Relative probability of being chosen
|
||||||
|
HideRealNameOnStart = false, -- true to hide the effect's real name when it starts
|
||||||
|
EffectCategory = "Shader", -- Optional category
|
||||||
|
EffectGroup = "_group_shader", -- Optional grouping (leave empty if unused)
|
||||||
|
IncompatibleIds = {
|
||||||
|
"screen_blindness",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Called once when the effect starts
|
||||||
|
function OnStart()
|
||||||
|
print("[effect_template] OnStart: " .. ((EffectInfo and EffectInfo.Name) or "unknown"))
|
||||||
|
-- Initialize effect state here (e.g. set timers, spawn helpers)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Called once when the effect stops/ends
|
||||||
|
function OnStop()
|
||||||
|
print("[effect_template] OnStop: " .. ((EffectInfo and EffectInfo.Name) or "unknown"))
|
||||||
|
-- Cleanup state here (e.g. remove entities, clear timers)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Called every game tick while the effect is active
|
||||||
|
darkness_value = 0.0
|
||||||
|
function OnTick()
|
||||||
|
playerPed = PLAYER_PED_ID()
|
||||||
|
if not DOES_ENTITY_EXIST(playerPed) or IS_PLAYER_SWITCH_IN_PROGRESS() or IS_PED_DEAD_OR_DYING(playerPed,0) then return end
|
||||||
|
DRAW_RECT(0.5, 0.5, 1.0, 1.0, 0, 0, 0, darkness_value)
|
||||||
|
darkness_value = darkness_value + 1
|
||||||
|
if darkness_value > 255.0 then
|
||||||
|
darkness_value = 255.0
|
||||||
|
end
|
||||||
|
WAIT(750)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add custom helper functions below.
|
||||||
|
|
||||||
|
function random_choice(p1)
|
||||||
|
if type(p1) ~= "table" or #p1 == 0 then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local choice = p1[math.random(#p1)]
|
||||||
|
return choice
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3,7 +3,7 @@ EffectInfo = {
|
|||||||
EffectId = "vehs_derailtrains",
|
EffectId = "vehs_derailtrains",
|
||||||
TimedType = "Normal",
|
TimedType = "Normal",
|
||||||
EffectGroup = "_group_trafficspawner",
|
EffectGroup = "_group_trafficspawner",
|
||||||
EffectCategory = "None"
|
EffectCategory = "None",
|
||||||
IncompatibleIds = {
|
IncompatibleIds = {
|
||||||
"vehs_expresstrains",
|
"vehs_expresstrains",
|
||||||
}
|
}
|
||||||
@@ -28,4 +28,5 @@ function OnTick()
|
|||||||
SET_RENDER_TRAIN_AS_DERAILED(vehicle, true)
|
SET_RENDER_TRAIN_AS_DERAILED(vehicle, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
WAIT(750)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,4 +20,6 @@ function OnTick()
|
|||||||
SET_TRAIN_SPEED(vehicle, 9999.0)
|
SET_TRAIN_SPEED(vehicle, 9999.0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
WAIT(750)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user