Boogiepop210 Posted April 4, 2023 Share Posted April 4, 2023 So, I've been trying to make a command that forces inst to teleport in spirals for a number seconds. But when I put it in consolecommands.lua, It crashes on starting Don't Starve Together. This is the current code. local angle = 0 local radius = 5 local function spiral_step(inst) local center = inst:GetPosition() local x = center.x + radius * math.cos(angle) local z = center.z + radius * math.sin(angle) inst.Transform:SetPosition(x, center.y, z) angle = angle + 0.1 radius = radius + 0.02 end function z_playerspiral(inst, time) inst.task = inst:DoPeriodicTask(0.1, function() spiral_step(inst) end) inst:DoTaskInTime(time or 10, function() inst.task:Cancel() end) end and for some reason it works in-game if you type it in console. Link to comment https://forums.kleientertainment.com/forums/topic/146889-need-help-with-a-console-command/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.