otclient icon indicating copy to clipboard operation
otclient copied to clipboard

Saying hi to NPC on left click

Open alfuveam opened this issue 4 years ago • 4 comments

With this feature, is possible say hi on left click.

alt text

index fa9d4799..77ab43c2 100644
--- a/modules/game_interface/gameinterface.lua
+++ b/modules/game_interface/gameinterface.lua
@@ -714,6 +714,12 @@ function processMouseAction(menuPosition, mouseButton, autoWalkPos, lookThing, u
     end
   end
 
+  if creatureThing then
+    if creatureThing:isNpc() then
+      g_game.talk("hi")
+      return true
+    end
+  end
 
   local player = g_game.getLocalPlayer()
   player:stopAutoWalk()

alfuveam avatar Apr 24 '21 09:04 alfuveam

Why not open a PR with proposed patch then? :)

In Tibia, the character will say "hi" only when it's in NPC talk radius (3 sqm). I suggest to include that check in your code.

marmichalski avatar Apr 26 '21 18:04 marmichalski

@marmichalski Have other question, this is enable/disable in Options checkbox "Classic control"?. You are correct about talk radius, going check this.

alfuveam avatar May 03 '21 16:05 alfuveam

If you are asking if this should be tied with Classic control checkbox functionality, then I'd say say, as this is how it is implemented in Tibia, something they call smart click. There is also Talk option available in context menu, which will also make the character say hi. When you select it from too far (> 3 sqm), there will be cancel message displayed in the game window saying You are too far away.

Screenshot 2021-05-03 at 19 05 09Screenshot 2021-05-03 at 19 07 37

marmichalski avatar May 03 '21 17:05 marmichalski

#1150

alfuveam avatar May 17 '21 21:05 alfuveam