• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

NPCs system - Djinns

Blasphemy

Well-Known Member
Joined
Jan 5, 2012
Messages
387
Reaction score
71
Hello everyone I'm trying to perfectionate the Djinn War quest on OTX 7.72

For now I'm just having the next trouble:
I want Ubaid(Efreets) and Umar(Marids), to only answer if they get the word "djanni'hah", but if I say them "hi" they still answer, with the "GREET MESSAGE" and the quest one:
1583530042522.png
As you can see, he's taking the "djanni'hah" msg with only saying "hi"...​

If someone knows what's the way to make it work, by modifying npc libs or something, i will be grateful and I'll share my work here, because i'm making this just for fun and for helping this community :D!

Thanks
 

Attachments

Last edited:
Remove any of the following:
or msgcontains(msg:lower(),'hi') or msgcontains(msg:lower(),'hello') or msgcontains(msg:lower(),'greetings')
from lines 27, 37, 43 and 45 in ubaid.lua
 
Remove any of the following:
or msgcontains(msg:lower(),'hi') or msgcontains(msg:lower(),'hello') or msgcontains(msg:lower(),'greetings')
from lines 27, 37, 43 and 45 in ubaid.lua
I got the solution, by creating another function on lua...
BTW, if anyone want to knows the solution for this server, let me know by this thread or PM

:*
 
You should always post your solution, who knows when someone’s gonna need it. What if they PM you in 2 years lol
You're right here come's the solution:

NOTE: It is an example for Ubaid, the green djinn quest begining, you can use the same steps to make it work on Umar the blue djinn quest begining, also if you want the real lines the NPCs speak as real tibia, you can search for them on fan websites

The function I added is the next:

1° Add this lines on ubaid.lua (the file I added to the main post)
It will define the greet and the farewell msg he will say WITH THE MISSION DONE. (storagevalue 1023 for green faction in this case)
Code:
npcHandler:setMessage(MESSAGE_GREET, "Still alive, |PLAYERNAME|?")
npcHandler:setMessage(MESSAGE_FAREWELL, "Hail King Malor! See you on the battlefield, human worm.")

2° In the same file Ubaid.lua add the next function after any end of another function
This function will make the npc only GREET you if you have done the first mission and passed the door.


Code:
function GreenGreetCallback(cid)
    if getPlayerStorageValue(cid, 1023) ~= 1 then --this is the storagevalue that you want to allow you to say "hi" to this npc
        npcHandler:say("Shove off, little one! Humans are not welcome here.", cid)
        return false
    end
    return true
end

3° At last add this line at the end of the file
Code:
npcHandler:setCallback(CALLBACK_GREET, GreenGreetCallback)
But before this one:
Code:
npcHandler:addModule(FocusModule:new())

Something to consider:

"GreenGreetCallback" is the function we added and it must be deferent in all other scripts, or it will be called by the same NPC XD.
I.E, if you want to copy it for the blue djinn, call it BlueGreetCallBack. or "NpcNameGreetCallBack"

1583534036900.png1583534074064.png
without storagevalue 1023

1583534143350.png
with the storagevalue 1023​
 
Last edited:

Similar threads

Back
Top