Otfan125
Well-Known Member
Hello guys,
As you may have noticed I do have a few posts on the Support thread, however I hope I'm not breaking any rules as I believe my questions may help those who are interested (and of course, me)
So what I'm trying to do, or been trying to do is, to somehow go around the idea that a player should say "Hi" to gain a NPC's attention. I've been using the search tool here in the forums, and I found something: https://otland.net/threads/npc-chat-window.85762/
So while I'm learning lua and the way the server works as a whole, a possible solution to this, I believe, is to create a CreatureScript that activates when the player logins and that when a player tries to "attack" a NPC, it disable's the attack, and acts as an attention getter on the NPC, and runs the .lua script for the NPC
I have this .lua script on my Creaturescript that i believe should work, but doesn't:
I've added this to my creaturescripts.xml (as you can tell I got it from the thread link above)
and I added this to the login.lua, removing the registerCreatureEvent and replacing it with registerEvent (i did this because if i kept registerEvent, i could login to my character, and registerCreatureEvent didn't allow me)
As I spend more time here in the forums and scripting, I'm thankful for everyone who has helped me so far, and the fast replies that this forum offers
As you may have noticed I do have a few posts on the Support thread, however I hope I'm not breaking any rules as I believe my questions may help those who are interested (and of course, me)
So what I'm trying to do, or been trying to do is, to somehow go around the idea that a player should say "Hi" to gain a NPC's attention. I've been using the search tool here in the forums, and I found something: https://otland.net/threads/npc-chat-window.85762/
So while I'm learning lua and the way the server works as a whole, a possible solution to this, I believe, is to create a CreatureScript that activates when the player logins and that when a player tries to "attack" a NPC, it disable's the attack, and acts as an attention getter on the NPC, and runs the .lua script for the NPC
I have this .lua script on my Creaturescript that i believe should work, but doesn't:
Code:
function onUse(cid, target)
if(isNpc(target))then return doCreatureSay(cid, "Hi!", TALKTYPE_SAY) and false end
end
I've added this to my creaturescripts.xml (as you can tell I got it from the thread link above)
Code:
<event type="login" name="NpcAttack" event="script" value="npcattack.lua"/>
and I added this to the login.lua, removing the registerCreatureEvent and replacing it with registerEvent (i did this because if i kept registerEvent, i could login to my character, and registerCreatureEvent didn't allow me)
Code:
player:registerEvent("NpcAttack")
As I spend more time here in the forums and scripting, I'm thankful for everyone who has helped me so far, and the fast replies that this forum offers