Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local keywordHandler = KeywordHandler:new()
- local npcHandler = NpcHandler:new(keywordHandler)
- NpcSystem.parseParameters(npcHandler)
- 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
- local talkState = {}
- local off_spell = "Immortal"
- local deff_spell = "Reflection"
- local talk_storage = 215231
- local kill_monster_offensive = [T]Goku
- local kill_monster_deffensive = [T]C17
- function greetCallback(cid)
- if getPlayerStorageValie(cid, talk_storage) < 0 then
- npcHandler:setMessage(MESSAGE_GREET, "Hello "..getCreatureName(cid).." do you want to {learn} something new?")
- npcHandler:addFocus(cid)
- elseif getPlayerStorageValue(cid,talk_storage) == 0 then -- koniec
- if getPlayerStorageValue(cid, kill_monster_offensive) == 0 then
- npcHandler:say("You have to find and defeat: "..monster_off)
- end
- if getPlayerStorageValue(cid, kill_monster_deffensive) == 0 then
- npcHandler:say("You have to find and defeat: "..monster_def)
- end
- npcHandler:addFocus(cid)
- npcHandler:releaseFocus(cid)
- elseif getPlayerStorageValie(cid, talk_storage) == 1 then -- koniec
- npcHandler:setMessage(MESSAGE_GREET, "Okay, boya.. Did you kill this {monster}?")
- npcHandler:addFocus(cid)
- elseif getPlayerStorageValie(cid, talk_storage) == 2 then -- koniec
- npcHandler:say("I can not teach you anything more.")
- npcHandler:addFocus(cid)
- npcHandler:releaseFocus(cid)
- end
- if(not npcHandler:isFocused(cid)) then
- return false
- end
- return true
- end
- function creatureSayCallback(cid, type, msg)
- if(not npcHandler:isFocused(cid)) then
- return false
- end
- local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
- if(msgcontains(msg, 'learn')) and getPlayerStorageValue(cid,talk_storage) < 0 then
- selfSay("I create new techniques for cyborgs do you want to learn these ?{teach}.", cid)
- talkState[talkUser] = 1
- elseif(msgcontains(msg, 'teach')) and getPlayerStorageValue(cid,talk_storage) < 0 and talkState[talkUser] == 1 then
- selfSay("Okay soo.. you want to learn the {offensive}, {deffensive} technique?", cid)
- talkState[talkUser] = 2
- elseif(msgcontains(msg, 'offensive')) and getPlayerStorageValue(cid,talk_storage) < 0 and talkState[talkUser] == 2 then
- selfSay("text jakis tam... offensive", cid)
- setPlayerStorageValue(cid, kill_monster_offensive, 0)
- setPlayerStorageValue(cid,talk_storage, 0)
- --talkState[talkUser] = 2
- elseif(msgcontains(msg, 'deffensive')) and getPlayerStorageValue(cid,talk_storage) < 0 and talkState[talkUser] == 2 then
- selfSay("text jakis tam... deffensive", cid)
- setPlayerStorageValue(cid, kill_monster_deffensive, 0)
- setPlayerStorageValue(cid,talk_storage, 0)
- --talkState[talkUser] = 2
- elseif(msgcontains(msg, 'monster')) and getPlayerStorageValue(cid,talk_storage) == 1 then
- if getPlayerStorageValue(cid, kill_monster_offensive) == 1 then
- selfSay("Okay you are strong you kill "..monster_off".. so i can learn you this spell right now!", cid)
- doPlayerLearnInstantSpell(cid, off_spell)
- doPlayerSendTextMessage(cid, 22,"You have new spell: "..off_spell..".")
- setPlayerStorageValue(cid,talk_storage, 2)
- elseif getPlayerStorageValue(cid, kill_monster_deffensive) == 1 then
- selfSay("Okay you are strong you kill "..monster_def".. so i can learn you this spell right now!", cid)
- doPlayerLearnInstantSpell(cid, deff_spell)
- doPlayerSendTextMessage(cid, 22,"You have new spell: "..deff_spell..".")
- setPlayerStorageValue(cid,talk_storage, 2)
- else
- selfSay("You dont kill this monster!", cid)
- end
- end
- return true
- end
- npcHandler:setCallback(CALLBACK_GREET, greetCallback)
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement