Hey, I've tried to make a simple npc script, but for some reason it only seems to work half the time....i can load the map and it will work....then literally close and re-open the console and it wont work anymore...then next time it might. It seems like it works about 20% of the time, can anyone tell me the reason for this? Just trying to make her walk at the 1st time on the map up to her point she will be at for the rest of the game and freeze the hero until she is there and has spoken her initial dialog, its the interaction bit at the end which seems to be failing i should mention
local map = ...
local game = map:get_game()
local hero = map:get_hero()
if game:get_value("open_walk") then
girl:set_visible(true)
fake_girl:set_visible(false)
else
girl:set_visible(false)
fake_girl:set_visible(true)
local npc_movement_2 = sol.movement.create("target")
npc_movement_2:set_speed(64)
-- npc_movement_2:set_smooth(true)
npc_movement_2:set_ignore_obstacles(true)
npc_movement_2:set_target(girl)
npc_movement_2:set_ignore_obstacles(true)
npc_movement_2:start(fake_girl, function()
girl:set_visible(true)
fake_girl:set_visible(false)
game:start_dialog("girl.down_here")
game:set_value("open_walk", true)
end)
end
function girl:on_interaction()
game:start_dialog("girl.hello")
end
I also wanted to make the hero freeze on map start until this quest but I haven't been able to make that function yet, i know its hero:freeze() then hero:unfreeze()
I moved the end at line 24 to 29 and that seemed to help a little but it's still failing about 60% of the time