Strack
Member
- Joined
- May 15, 2009
- Messages
- 199
- Reaction score
- 14
well i've done an npc, i'm not good on this, but I think its correct, and I dont know what it doesnt runs properly. When I say me: hi,
it says: hi 'name', are u rdy?,
me: yes
npc: well then in what side u will fight?
and when i respond it says nothing, but if I say 'yes' again it says again: well then in what side u will fight? what's wrong in the script?
script:
it says: hi 'name', are u rdy?,
me: yes
npc: well then in what side u will fight?
and when i respond it says nothing, but if I say 'yes' again it says again: well then in what side u will fight? what's wrong in the script?
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Trainer" script="script.lua" walkinterval="0" floorchange="0">
<health now="150" max="150"/>
<look type="371" head="114" body="119" legs="114" feet="114" corpse="2212"/>
<parameters>
<parameter key="module_travel" value="1"/>
<parameter key="message_greet" value="Hi |PLAYERNAME|. Are u rdy?"/>
</parameters>
</npc>
script:
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
--[[
REMEMBER TO SET YOUR STORAGE AS YOURSTORAGE!
]]--
local storage = 12101
local xxx = {x=1000, y=1000, z=7}
local xx = {x=1000, y=1000, z=7}
local x = {x=1448, y=928, z=7}
if(msgcontains(msg, 'si') or msgcontains(msg, 'yes')) then
if(getPlayerStorageValue(cid, storage) > 0) then
npcHandler:say("Que haces tu aqui?", cid)
talkState[talkUser] = 0
else
if getPlayerLevel(cid) >= 8 then
npcHandler:say("well then in what side u will fight?", cid)
talkState[talkUser] = 1
if(msgcontains(msg, 'XXXX') and talkState[talkUser] == 1) then
npcHandler:say("bla bla bla.", cid)
talkState[talkUser] = 1
if(msgcontains(msg, 'xxxxx')) then
npcHandler:say("Estas seguro?", cid)
if(msgcontains(msg, 'si') or msgcontains(msg, 'yes')) then
doPlayerSetVocation(cid, 1)
doTeleportThing(cid, xxx)
if getPlayerSex(cid) == 0 then
doCreatureChangeOutfit(cid, 423)
else
doCreatureChangeOutfit(cid, 424)
end
elseif msgcontains(msg, 'no') then
npcHandler:say("Vuelve cuando lo tengas decidido.", cid)
talkState[talkUser] = 0
end
elseif (msgcontains(msg, 'wevev')) then
npcHandler:say("Estas seguro?", cid)
if(msgcontains(msg, 'si') or msgcontains(msg, 'yes')) then
doPlayerSetVocation(cid, 2)
doTeleportThing(cid, xxx)
if getPlayerSex(cid) == 0 then
doCreatureChangeOutfit(cid, 425)
else
doCreatureChangeOutfit(cid, 391)
end
elseif msgcontains(msg, 'no') then
npcHandler:say("Vuelve cuando lo tengas decidido.", cid)
talkState[talkUser] = 0
end
elseif (msgcontains(msg, 'nvec')) then
npcHandler:say("Estas seguro?", cid)
if(msgcontains(msg, 'si') or msgcontains(msg, 'yes')) then
doPlayerSetVocation(cid, 3)
doTeleportThing(cid, xxx)
if getPlayerSex(cid) == 0 then
doCreatureChangeOutfit(cid, 429)
else
doCreatureChangeOutfit(cid, 406)
end
elseif msgcontains(msg, 'no') then
npcHandler:say("Vuelve cuando lo tengas decidido.", cid)
talkState[talkUser] = 0
end
elseif (msgcontains(msg, 'eeeeeeeeee')) then
npcHandler:say("Estas seguro?", cid)
if(msgcontains(msg, 'si') or msgcontains(msg, 'yes')) then
doPlayerSetVocation(cid, 4)
doTeleportThing(cid, xxx)
if getPlayerSex(cid) == 0 then
doCreatureChangeOutfit(cid, 426)
else
doCreatureChangeOutfit(cid, 393)
end
elseif msgcontains(msg, 'no') then
npcHandler:say("Vuelve cuando lo tengas decidido.", cid)
talkState[talkUser] = 0
end
elseif (msgcontains(msg, 'vrrrr')) then
npcHandler:say("Estas seguro?", cid)
if(msgcontains(msg, 'si') or msgcontains(msg, 'yes')) then
doPlayerSetVocation(cid, 5)
doTeleportThing(cid, xxx)
if getPlayerSex(cid) == 0 then
doCreatureChangeOutfit(cid, 428)
else
doCreatureChangeOutfit(cid, 404)
end
elseif msgcontains(msg, 'no') then
npcHandler:say("Vuelve cuando lo tengas decidido.", cid)
talkState[talkUser] = 0
end
elseif (msgcontains(msg, 'hvrrr')) then
npcHandler:say("Estas seguro?", cid)
if(msgcontains(msg, 'si') or msgcontains(msg, 'yes')) then
doPlayerSetVocation(cid, 6)
doTeleportThing(cid, xxx)
if getPlayerSex(cid) == 0 then
doCreatureChangeOutfit(cid, 399)
else
doCreatureChangeOutfit(cid, 394)
end
elseif msgcontains(msg, 'no') then
npcHandler:say("Vuelve cuando lo tengas decidido.", cid)
talkState[talkUser] = 0
end
elseif (msgcontains(msg, 'btrnber')) then
npcHandler:say("Estas seguro?", cid)
if(msgcontains(msg, 'si') or msgcontains(msg, 'yes')) then
doPlayerSetVocation(cid, 12)
doTeleportThing(cid, xxx)
if getPlayerSex(cid) == 0 then
doCreatureChangeOutfit(cid, 398)
else
doCreatureChangeOutfit(cid, 398)
end
elseif msgcontains(msg, 'no') then
npcHandler:say("Vuelve cuando lo tengas decidido.", cid)
talkState[talkUser] = 0
end
end
elseif (msgcontains(msg, 'brtert')) then
npcHandler:say("bla bla bla.", cid)
talkState[talkUser] = 1
if(msgcontains(msg, 'sddddu')) then
npcHandler:say("Estas seguro?", cid)
if(msgcontains(msg, 'si') or msgcontains(msg, 'yes')) then
doPlayerSetVocation(cid, 7)
doTeleportThing(cid, xx)
if getPlayerSex(cid) == 0 then
doCreatureChangeOutfit(cid, 431)
else
doCreatureChangeOutfit(cid, 395)
end
elseif msgcontains(msg, 'no') then
npcHandler:say("Vuelve cuando lo tengas decidido.", cid)
talkState[talkUser] = 0
end
elseif (msgcontains(msg, 'pvdser')) then
npcHandler:say("Estas seguro?", cid)
if(msgcontains(msg, 'si') or msgcontains(msg, 'yes')) then
doPlayerSetVocation(cid, 8)
doTeleportThing(cid, xx)
if getPlayerSex(cid) == 0 then
doCreatureChangeOutfit(cid, 434)
else
doCreatureChangeOutfit(cid, 396)
end
elseif msgcontains(msg, 'no') then
npcHandler:say("Vuelve cuando lo tengas decidido.", cid)
talkState[talkUser] = 0
end
elseif (msgcontains(msg, 'wivsser')) then
npcHandler:say("Estas seguro?", cid)
if(msgcontains(msg, 'si') or msgcontains(msg, 'yes')) then
doPlayerSetVocation(cid, 9)
doTeleportThing(cid, xx)
if getPlayerSex(cid) == 0 then
doCreatureChangeOutfit(cid, 402)
else
doCreatureChangeOutfit(cid, 435)
end
elseif msgcontains(msg, 'no') then
npcHandler:say("Vuelve cuando lo tengas decidido.", cid)
talkState[talkUser] = 0
end
end
elseif (msgcontains(msg, 'ddt')) then
npcHandler:say("bla bla bla", cid)
talkState[talkUser] = 1
if(msgcontains(msg, 'nda')) then
npcHandler:say("Estas seguro?", cid)
if(msgcontains(msg, 'si') or msgcontains(msg, 'yes')) then
doPlayerSetVocation(cid, 10)
doTeleportThing(cid, x)
if getPlayerSex(cid) == 0 then
doCreatureChangeOutfit(cid, 433)
else
doCreatureChangeOutfit(cid, 432)
end
elseif msgcontains(msg, 'no') then
npcHandler:say("Vuelve cuando lo tengas decidido.", cid)
talkState[talkUser] = 0
end
elseif (msgcontains(msg, 'kasa')) then
npcHandler:say("Estas seguro?", cid)
if(msgcontains(msg, 'si') or msgcontains(msg, 'yes')) then
doPlayerSetVocation(cid, 11)
doTeleportThing(cid, x)
if getPlayerSex(cid) == 0 then
doCreatureChangeOutfit(cid, 430)
else
doCreatureChangeOutfit(cid, 430)
end
elseif msgcontains(msg, 'no') then
npcHandler:say("Vuelve cuando lo tengas decidido.", cid)
talkState[talkUser] = 0
end
end
end
else
npcHandler:say("Aun no estas preparado.", cid)
talkState[talkUser] = 0
end
end
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())