-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Greeting npc on left click #1150
Conversation
@@ -502,6 +502,10 @@ function onBattleButtonMouseRelease(self, mousePosition, mouseButton) | |||
if self.isTarget then | |||
g_game.cancelAttack() | |||
else | |||
if self.creature:isNpc() then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO this behaviour should also be configurable through a checkbox in options. There might be servers that allows attacking an NPC.
if creatureThing:getPosition().z == localPosition.z then | ||
if g_game.getAttackingCreature() ~= creatureThing then | ||
menu:addOption(tr('Attack'), function() g_game.attack(creatureThing) end, shortcut) | ||
if creatureThing:getPosition().z == localPosition.z then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spacing seems to be off.
checkMaxDistanceToGreetingNpc(player, creatureThing) | ||
return true | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not seem to be right. Won't this trigger greeting by clicking any mouse button on any NPC (different floor level [pos.z])?
This should probably be implemented at those branches in the above checks (classic/non-classic controls):
elseif creatureThing and creatureThing:getPosition().z == autoWalkPos.z
@@ -896,3 +911,11 @@ end | |||
function limitZoom() | |||
limitedZoom = true | |||
end | |||
|
|||
function checkMaxDistanceToGreetingNpc(creaturePlayer, creatureNpc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not really a check
when it triggers an action, is it? :)
Closing due to inactivity. |
Option to choose a max distance to talk him
maxDistanceToGreetingNpc = 3
Table with greetings words
focusGreetWords = {"hi", "hello"}
Random the words
g_game.talk(focusGreetWords[math.random(1, #focusGreetWords)])
Change a right click option on npc, attack option to talk option.
https://github.com/edubart/otclient/compare/master...alfuveam:greeting_npc_hi?expand=1#diff-1b975e904a1c9756dc22f83fbc9884012958e3c3f158bc081aaa6c49dfa2f585L557-R569