Now that this path is being found as needed, the last crucial step is to actually carry it out.
Open the file character/init.lua
, which includes specific actions and features used by both computer- and human-controlled players.
The step
function is in fact very similar to the network functions from TranslationBuddy, and that's what we're going to model it on:
function presence.step(target) local origin = getfenv(2).location() local self = coroutine.running() local function resume(event) event.target:removeEventListener('Moved', resume) coroutine.resume(self, 'finished') end local motion = origin.map:Move(character, getfenv(2).world, target.x - origin.x, target.y - origin.y) if motion then motion:addEventListener('Moved', resume) repeat local outcome = coroutine.yield() until outcome == 'finished' return true end end
3.145.75.217