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

Summon Npc script

Dyker

New Member
Joined
Sep 12, 2008
Messages
97
Reaction score
1
Hi friends i need a summon npc.

He have to say that:
Player: Hi
Npc: Hello |PLAYERNAME| I can obtain you a trainer for 300 gold pieces.
Player: Yes

And then the npc summon a Training Monk next to player and take 300 gold pieces of the player, can it be posible?
 
Not sure but i tried:

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)                          npcHandler:onCreatureAppear(cid)                        end
function onCreatureDisappear(cid)                       npcHandler:onCreatureDisappear(cid)                     end
function onCreatureSay(cid, type, msg)                  npcHandler:onCreatureSay(cid, type, msg)                end
function onThink()                                      npcHandler:onThink()                                    end
function creatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	
local p = getPlayerPosition(cid)
local monster = "Trainer"

if(msgcontains(msg, 'hi') or msgcontains(msg, 'hello')) then
			npcHandler:say("Hello |PLAYERNAME| I can obtain you a trainer for 300 gold pieces.", cid)			
			talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if(doPlayerRemoveMoney(cid, 300)) == true then
		doSummonMonster(cid, monster, p) 
	else
		npcHandler:say("Sorry, You dont have 300 gold pieces dont try to steal from me.", cid)
			talkState[talkUser] = 0
			end
			return true
			end
 
Back
Top