• 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!

npc problem dont open npc window

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
OTX Server Version: (2.52 - 1557)


Aparently this problem has relation with the not opening npc windows chat when i talk to them

hello guys, i have this weird error i dont know why :S

The npc when you say hi to him, it says tge Bienvenido and your name, but that's it, is not saying the next line :S

Code:
function onCreatureSay(cid, type, msg)
       if((msg == "hi") and not (isFocused(cid))) then
          selfSay("Bienvenido, ".. getCreatureName(cid) ..".", cid, true)
          selfSay("I can {rebirth} you!", cid)
          addFocus(cid)
          status = 1
       elseif((isFocused(cid)) and (msg == "rebirth") and (status == 1)) then




thanks in advance!!! D:
 
Last edited:
hello guys, i have this weird error i dont know why :S

The npc when you say hi to him, it says tge Bienvenido and your name, but that's it, is not saying the next line :S

Code:
function onCreatureSay(cid, type, msg)
       if((msg == "hi") and not (isFocused(cid))) then
          selfSay("Bienvenido, ".. getCreatureName(cid) ..".", cid, true)
          selfSay("I can {rebirth} you!", cid)
          addFocus(cid)
          status = 1
       elseif((isFocused(cid)) and (msg == "rebirth") and (status == 1)) then




thanks in advance!!! D:
i know nothing about npcs but there's a true as the last argument in the first selfSay
maybe try adding it to the second??
Code:
selfSay("I can {rebirth} you!", cid, true)
 
i know nothing about npcs but there's a true as the last argument in the first selfSay
maybe try adding it to the second??
Code:
selfSay("I can {rebirth} you!", cid, true)

now it show the two messages on a road
a8La2qt.png


but i just noticed that no npc window is open :S i believe is because of that
no npc opens npc window chat, any ideas? D:

ok yes, none npc opens the npc window chat, does any of you guys know why is this happening?
looks like all the problem is because of this
 
Last edited:
looking at selfSay in the source
//selfSay(words[, target[, type]])
so your third parameter should not be true, it should be a MessageClasses enum or it should be nothing. If it's true, it will not work. Try just doing selfSay(words, target), and if that doesn't work, try words, target and MSG_NPC_FROM
Code:
MSG_NONE = 0,
MSG_SPEAK_SAY = 1,
MSG_SPEAK_WHISPER = 2,
MSG_SPEAK_YELL = 3,
MSG_NPC_TO = 4,
MSG_NPC_FROM = 5,
MSG_PRIVATE = 6,
MSG_CHANNEL = 7,
MSG_CHANNEL_MANAGEMENT = 8,
MSG_GAMEMASTER_BROADCAST = 9,
MSG_GAMEMASTER_CHANNEL = 10,
MSG_GAMEMASTER_PRIVATE = 11,
MSG_CHANNEL_HIGHLIGHT = 12,
MSG_SPEAK_MONSTER_SAY = 13,
MSG_SPEAK_MONSTER_YELL = 14,

this is the sourcecode for selfSay
Code:
int32_t NpcScript::luaActionSay(lua_State* L)
{
//selfSay(words[, target[, type]])
int32_t params = lua_gettop(L), target = 0;
MessageClasses type = MSG_NONE;
if(params > 2)
type = (MessageClasses)popNumber(L);
if(params > 1)
target = popNumber(L);
ScriptEnviroment* env = getEnv();
Npc* npc = env->getNpc();
if(!npc)
return 0;
Player* player = env->getPlayerByUID(target);
if(type == MSG_NONE)
{
if(player)
type = MSG_NPC_FROM;
else
type = MSG_SPEAK_SAY;
}
npc->doSay(popString(L), (MessageClasses)type, player);
return 0;
}
 
looking at selfSay in the source
//selfSay(words[, target[, type]])
so your third parameter should not be true, it should be a MessageClasses enum or it should be nothing. If it's true, it will not work. Try just doing selfSay(words, target), and if that doesn't work, try words, target and MSG_NPC_FROM
Code:
MSG_NONE = 0,
MSG_SPEAK_SAY = 1,
MSG_SPEAK_WHISPER = 2,
MSG_SPEAK_YELL = 3,
MSG_NPC_TO = 4,
MSG_NPC_FROM = 5,
MSG_PRIVATE = 6,
MSG_CHANNEL = 7,
MSG_CHANNEL_MANAGEMENT = 8,
MSG_GAMEMASTER_BROADCAST = 9,
MSG_GAMEMASTER_CHANNEL = 10,
MSG_GAMEMASTER_PRIVATE = 11,
MSG_CHANNEL_HIGHLIGHT = 12,
MSG_SPEAK_MONSTER_SAY = 13,
MSG_SPEAK_MONSTER_YELL = 14,

this is the sourcecode for selfSay
Code:
int32_t NpcScript::luaActionSay(lua_State* L)
{
//selfSay(words[, target[, type]])
int32_t params = lua_gettop(L), target = 0;
MessageClasses type = MSG_NONE;
if(params > 2)
type = (MessageClasses)popNumber(L);
if(params > 1)
target = popNumber(L);
ScriptEnviroment* env = getEnv();
Npc* npc = env->getNpc();
if(!npc)
return 0;
Player* player = env->getPlayerByUID(target);
if(type == MSG_NONE)
{
if(player)
type = MSG_NPC_FROM;
else
type = MSG_SPEAK_SAY;
}
npc->doSay(popString(L), (MessageClasses)type, player);
return 0;
}

im sorry, could you explain this to me in a different way? i didnt understand what i should do D:,
imagine i'm 5 years old because i dont know much about coding :c
 
Try just doing selfSay(words, target), and if that doesn't work, try words, target and MSG_NPC_FROM
as for the second part, if the first doesn't work, try
Code:
selfSay(words, target, MSG_NPC_FROM)

also try using the npcHandler and see if it works any different
replace any selfSay lines with
Code:
npcHandler:say(text, cid)
like for example, change
Code:
selfSay("I can {rebirth} you!", cid, true)
to
Code:
npcHandler:say("I can {rebirth} you!", cid)
 
as for the second part, if the first doesn't work, try
Code:
selfSay(words, target, MSG_NPC_FROM)

also try using the npcHandler and see if it works any different
replace any selfSay lines with
Code:
npcHandler:say(text, cid)
like for example, change
Code:
selfSay("I can {rebirth} you!", cid, true)
to
Code:
npcHandler:say("I can {rebirth} you!", cid)


nU2KmcO.png


i changed to that and now the npc says nothing :( and i get this at console
RNUyu7N.png
 
Last edited:
looking at selfSay in the source
//selfSay(words[, target[, type]])
so your third parameter should not be true, it should be a MessageClasses enum or it should be nothing. If it's true, it will not work. Try just doing selfSay(words, target), and if that doesn't work, try words, target and MSG_NPC_FROM
Code:
MSG_NONE = 0,
MSG_SPEAK_SAY = 1,
MSG_SPEAK_WHISPER = 2,
MSG_SPEAK_YELL = 3,
MSG_NPC_TO = 4,
MSG_NPC_FROM = 5,
MSG_PRIVATE = 6,
MSG_CHANNEL = 7,
MSG_CHANNEL_MANAGEMENT = 8,
MSG_GAMEMASTER_BROADCAST = 9,
MSG_GAMEMASTER_CHANNEL = 10,
MSG_GAMEMASTER_PRIVATE = 11,
MSG_CHANNEL_HIGHLIGHT = 12,
MSG_SPEAK_MONSTER_SAY = 13,
MSG_SPEAK_MONSTER_YELL = 14,

this is the sourcecode for selfSay
Code:
int32_t NpcScript::luaActionSay(lua_State* L)
{
//selfSay(words[, target[, type]])
int32_t params = lua_gettop(L), target = 0;
MessageClasses type = MSG_NONE;
if(params > 2)
type = (MessageClasses)popNumber(L);
if(params > 1)
target = popNumber(L);
ScriptEnviroment* env = getEnv();
Npc* npc = env->getNpc();
if(!npc)
return 0;
Player* player = env->getPlayerByUID(target);
if(type == MSG_NONE)
{
if(player)
type = MSG_NPC_FROM;
else
type = MSG_SPEAK_SAY;
}
npc->doSay(popString(L), (MessageClasses)type, player);
return 0;
}
you mean like this??
E1njdl.png
 
what do you mean? could you help me there? plz

looking at selfSay in the source
//selfSay(words[, target[, type]])
so your third parameter should not be true, it should be a MessageClasses enum or it should be nothing. If it's true, it will not work. Try just doing selfSay(words, target), and if that doesn't work, try words, target and MSG_NPC_FROM
Code:
MSG_NONE = 0,
MSG_SPEAK_SAY = 1,
MSG_SPEAK_WHISPER = 2,
MSG_SPEAK_YELL = 3,
MSG_NPC_TO = 4,
MSG_NPC_FROM = 5,
MSG_PRIVATE = 6,
MSG_CHANNEL = 7,
MSG_CHANNEL_MANAGEMENT = 8,
MSG_GAMEMASTER_BROADCAST = 9,
MSG_GAMEMASTER_CHANNEL = 10,
MSG_GAMEMASTER_PRIVATE = 11,
MSG_CHANNEL_HIGHLIGHT = 12,
MSG_SPEAK_MONSTER_SAY = 13,
MSG_SPEAK_MONSTER_YELL = 14,
this is the sourcecode for selfSay
Code:
int32_t NpcScript::luaActionSay(lua_State* L)
{
//selfSay(words[, target[, type]])
int32_t params = lua_gettop(L), target = 0;
MessageClasses type = MSG_NONE;
if(params > 2)
type = (MessageClasses)popNumber(L);
if(params > 1)
target = popNumber(L);
ScriptEnviroment* env = getEnv();
Npc* npc = env->getNpc();
if(!npc)
return 0;
Player* player = env->getPlayerByUID(target);
if(type == MSG_NONE)
{
if(player)
type = MSG_NPC_FROM;
else
type = MSG_SPEAK_SAY;
}
npc->doSay(popString(L), (MessageClasses)type, player);
return 0;
}
 
so, like this?
GERApso.png


because that didnt work either...idk i cant be fixing one by one all my npcs, has to be something global :(
zHprLPN.png
 
Back
Top