ToNiO55 Posted May 8, 2017 Share Posted May 8, 2017 Hi all, someone know how start frog rain with commands on don't starve together? thx you very much for your help Link to comment Share on other sites More sharing options...
DarkXero Posted May 9, 2017 Share Posted May 9, 2017 You will have to make a custom frog rain command within a mod, or customcommands.lua file, or edit the frog rain component directly and add something else (because the game checks if it is spring, how wet the place is and so on). Example: local function GetSpawnPoint(pt) local function TestSpawnPoint(offset) local spawnpoint = pt + offset return GLOBAL.TheWorld.Map:IsPassableAtPoint(spawnpoint:Get()) end local theta = math.random() * 2 * GLOBAL.PI local radius = math.random() * 15 local resultoffset = GLOBAL.FindValidPositionByFan(theta, radius, 12, TestSpawnPoint) if resultoffset ~= nil then return pt + resultoffset end end local function OnTargetSleep(frog) frog:DoTaskInTime(0, frog.Remove) end local function SpawnFrog(player) local pt = player:GetPosition() local spawn_point = GetSpawnPoint(pt) local frog = GLOBAL.SpawnPrefab("frog") frog.persists = false if math.random() < 0.5 then frog.Transform:SetRotation(180) end frog.sg:GoToState("fall") frog.Physics:Teleport(spawn_point.x, 35, spawn_point.z) frog.persists = false frog:ListenForEvent("entitysleep", OnTargetSleep) end local timings = {1, 2, 2.5, 3, 4, 4.3, 5, 5.2, 6, 7, 7.2, 7.4, 7.6} local function SpawnFrogsForPlayer(player) for i, v in ipairs(timings) do player:DoTaskInTime(v, SpawnFrog) end end AddPlayerPostInit(function(inst) inst.SpawnFrogsForPlayer = SpawnFrogsForPlayer end) -- to enable ThePlayer:SpawnFrogsForPlayer() in console I stripped the spawning out of the component and made it an accessible single liner for console. Link to comment Share on other sites More sharing options...
ToNiO55 Posted May 11, 2017 Author Share Posted May 11, 2017 Thx you very much @DarkXero Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now