Hello,
I want to use this : http://www.solarus-games.org/doc/latest/lua_api_path_finding_movement.html (http://www.solarus-games.org/doc/latest/lua_api_path_finding_movement.html) so i do this :
myInterrupt.on_activated = function()
game:start_dialog('myDialog')
local m = sol.movement.create('path_finding')
m:set_target(map:get_entity("hero"))
m:set_speed(64)
m:start(myNPC)
end
but myNPC have a random movement.
What i fail ?
I don't see any mistakes in this code but as I have not so much experience, I might have overlooked something. However, I know that the path finding movement sometimes does strange things ;D Maybe you would be fine with the target movement?
The NPC will do a random movement if no path is found, or if it is too far from the hero.
How far is too far?
If the manhattan distance is > 200 pixels.
The distance is between the NPC and the button : http://puu.sh/ipSKa/faa099e917.png
Its under 200 px :(
That doesn't look as if there was a path...
when i speak with the NPC the bloc is set disabled
Is the NPC on the same layer as the hero?
Does it work if you try a movement of type "target" insted of "path_finding"?
Does it work if there is no block at all? (If yes, then there is a bug with disabled blocks.)
They are on the same layer.
Without block it dose not work
i will try with target but it's a labyrinth so i guss Path finding is better ...
Hi there!
I think Yruama is right. I have tested the following code and I have the same problem:
local map = ...
function switch:on_activated()
local m
m = sol.movement.create("path_finding")
--m = sol.movement.create("target")
m:set_target(map:get_entity("hero"))
m:set_speed(64)
m:start(NPC)
end
The NPC is on the same layer as the hero. The problem persists if I set other entity as the target. The entities are really close, so this is not a problem of distance. However, the movement works correctly if I use a movement of type "target".
Ok, I reported the bug on github since it is confirmed. Thanks Diarandor