• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Npc - chat window

Shake That Ass

I like to do something wi
Joined
Apr 8, 2010
Messages
171
Reaction score
3
Location
Poland/Rock Soid Mafia
Maybe there is someone who could help me in one thing ... I need a script to the NPC, "When you press the right mouse button npc it opens a chat window with him ... URGENT:)

POST IN DOWN \./

So instead of just pushing shares <hi> <Right Cursor> mouse and a chat window appears with the npc talking! And he says to me, only the NPC on the pressed
chattibia
 
Last edited:
When you press RMB on what .. anywhere or or NPC?
 
So if someone right click on an NPC you will get a chat with him? not NPC chat but a chat with that NPC only? I don't think that's possible ,p
 
So instead of just pushing shares <hi> <Right Cursor> mouse and a chat window appears with the npc talking! And he says to me, only the NPC on the pressed
chattibia
 
dunno, but in NPC_NAME.xml set attackable="1" and add this to your creaturescripts:
Code:
function onAttack(cid, target)
    if(isNpc(target))then return doCreatureSay(cid, "Hi!", TALKTYPE_SAY) and false end
end
 
on some OTS was system like that used for trade window before cip introduced their own xD
@up: not bad idea, but it should use some additional conditions like distance between player and npc and so on I guess
 
on some OTS was system like that used for trade window before cip introduced their own xD
@up: not bad idea, but it should use some additional conditions like distance between player and npc and so on I guess

It is just an example. Feel free to modify it as you want to.
 
creaturesripts.xml:
<event type="attack" name="NpcAttack" event="script" value="npc attack.lua"/>

scripts/login.lua
registerCreatureEvent(cid, "NpcAttack")
 
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Hilda" script="data/npc/scripts/default.lua" walkinterval="0" floorchange="0">
<set attackable="1"/>
<health now="185" max="185"/>
<look type="140" addons="0" head="57" body="115" legs="116" feet="76" corpse="2317"/>
<parameters>
<parameter key="message_greet" value="Welcome to what's going on?"/>
<parameter key="message_farewall" value="Bye bye..."/>
<parameter key="message_walkaway" value="Go on..."/>
</parameters>
</npc>
Npc look that


local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
end

local accountManager = getPlayerAccountManager(cid)
if(accountManager == MANAGER_NONE) then
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
elseif(accountManager == MANAGER_NAMELOCK) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
elseif(accountManager == MANAGER_ACCOUNT) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
end

if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end

registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "GuildMotd")
registerCreatureEvent(cid, "KillingInTheNameOf")

registerCreatureEvent(cid, "Idle")
if(config.useFragHandler) then
registerCreatureEvent(cid, "SkullCheck")
end

registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "AdvanceSave")
registerCreatureEvent(cid, "NpcAttack")
return true
end

Login look that

The rest look good
 
<npc name="Hilda" script="data/npc/scripts/default.lua" walkinterval="0" floorchange="0">
<set attackable="1"/>

=>

<npc name="Hilda" script="data/npc/scripts/default.lua" walkinterval="0" floorchange="0" attackable="1">
 
try to make it onLook and set it just for NPC, probably that will work better, because if you set NPC attackable then you will kill him and also it will set a battle icon, also players might just 'bomb' the NPC just for fun, so onLook can be the best bet, just hold shift+LMB.
 
Back
Top Bottom