xkubalis7 Posted August 2, 2022 Share Posted August 2, 2022 as above in the topic, I need a script so that my character will follow another player and when he sees the monster he targets him Link to comment Share on other sites More sharing options...
Jelon666 Posted March 29, 2023 Share Posted March 29, 2023 I made sth like that local friendName = "Player Name" local friendPos local creatureToAttack local creature local function findFriendAndCreatureToAttack() for _, friend in pairs(g_game.getCreatures()) do if friend:isPlayer() and friend:getName() == friendName then friendPos = friend:getPosition() break end end if friendPos then for _, creature in pairs(g_game.getCreatures()) do if not creature:isPlayer() and not creature:isNpc() and friendPos:isInRange(creature:getPosition(), 2, 2) and creature:getHealthPercent() < 99 then creatureToAttack = creature end end end end local function attackCreature() if not g_game.isAttacking() and creatureToAttack then g_game.attack(creatureToAttack) end end local function findAndFollowFriend() for _, potentialFriend in pairs(g_game.getCreatures()) do if potentialFriend:getName() == friendName and potentialFriend:isPlayer() then creature = potentialFriend break end end if not g_game.isAttacking() and not g_game.isFollowing() and creature then g_game.follow(creature) end end findFriendAndCreatureToAttack() attackCreature() findAndFollowFriend() auto(250, 350) Link to comment Share on other sites More sharing options...
Recommended Posts