Moders and coders I have a conundrum(video of results),
trying make a node move(code below) code works, well minus a few caveats, 1 - once you leave the world and go back in the code doesn't re-run, 2 - if the set_node's X Y Z is in your view the set_node with in the timer doesn't set the node. Anyone have a better way to do this???
https://youtu.be/cZIQwbYsVos
on_timer = function(pos, elapsed)
minetest.set_node(pos, { name = "air", param2 = minetest.get_node(pos).param2 })
minetest.set_node({x=174, y=1, z=347}, { name = "neontraffic:cara", param2 = minetest.get_node(pos).param2 })
end,
on_construct = function(pos, self, staticdata)
timer = minetest.get_node_timer(pos)
timer:start(10)
minetest.after(.2,
function(self)
minetest.set_node(pos, { name = "air", param2 = minetest.get_node(pos).param2 })
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name = "neontraffic:cara" })
end,
self)
end,
Moving Node - code help
Re: Moving Node - code help
Sure there's a better way - use entities. Nodes aren't so great for moving stuff.
Re: Moving Node - code help
Thanks, for pointing me in the right direction! Unfortunately it still utilizes a node and timer to spawn the car...any way around that??
\/ cyber car as entity
https://youtu.be/0o2AhAim3xA
\/ cyber car as entity
https://youtu.be/0o2AhAim3xA
Re: Moving Node - code help
Well, there are countless ways to spawn, depending on what you want to achieve, it's as simple as calling add_entity().
If you want the car to be spawned always in the same spot then a node timer seems a valid method. You could also use an LBM if you want it to be immediately spawned every time a player comes within range.
If you want the car to be spawned always in the same spot then a node timer seems a valid method. You could also use an LBM if you want it to be immediately spawned every time a player comes within range.
Who is online
Users browsing this forum: No registered users and 15 guests