I just need you to create a called by other action (anywhere you like) & rename it to
end_chase.
Inside of this called by other action create the following actions...
1. wait until character 'duck' stops.
2. character duck stop chasing current character.
Now add this revised script... (should do the trick for you).
local distance = 250 -- radius from current character in pixels @ 100%
local chaser = Characters["duck"]
local temp_distance -- empty (will be used to calculate new distance based on current characters scale value)
function quackers()
if game.CurrentCharacter.CharacterState == 3 and chaser.CharacterFollowCharacter ~= game.CurrentCharacter then
if ActiveActions["end_chase"] ~= nil then stopAction(ActiveActions["end_chase"]) end
chaser.CharacterFollowCharacter = game.CurrentCharacter; chaser.CharacterFollowReachDistance = 0
elseif game.CurrentCharacter.CharacterState ~= 3 and not chaser.CharacterFollowCharacter:isEmpty() then
temp_distance = math.floor( (chaser.CharacterSize / 100) * distance)
chaser.CharacterFollowReachDistance = temp_distance; startAction("Actions[end_chase]")
end
end
registerEventHandler("mainLoop", "quackers")
* edit #1: revised the script a little bit more. Having a follow distance radius means the chasing character will stop whenever character enters the radius area, so I've set it to 0 while walking to prevent chasing character from stopping, it's then reset back to the value you added to the distance variable on current character stop.
* edit #2: sorry re-revised the script. now added temp_distance variable which is used to calculate distance based on chaser characters current scale value - makes it a bit more dynamic than having it set chase distance to whatever regardless of size of the characters on the screen.