Skrypty & Kody NPC Tibia 8.6

CunAus

Active User
Zarejestrowany
Dołączył
Wrzesień 30, 2015
Posty
74
Liczba reakcji
1
Witam potrzebuje takiego npc. : czy jest ktos wstanie mi pomoc !
Elfa ktory daje zadanie oraz teleportuje do "zlych reniferow" zeby je zabic 300 np. potem teleportuje Do miko?aja i trzeba zabic bossa " Miko?aja" a na koncu daje nagrode z sms shopa losowa ze 3 ?

Mam nadzieje ze mi pomozecie ! :D
 
Odp: NPC Tibia 8.6

Elf.xml
[xml]<?xml version="1.0" encoding="UTF-8"?>
<npc name="Elf" script="elf.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look type="2" head="20" body="39" legs="45" feet="7" addons="0"/>
</npc>[/xml]
elf.lua
[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

local storage = 5024
local pos = { x=1, y=1, z=7} -- pozycja z reniferami

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, "mission") then
if getPlayerStorageValue(cid, storage) == -1 then
selfSay("Zabijesz dla mnie 300 zlych reniferow?", cid)
talkState[talkUser] = 1
elseif getPlayerStorageValue(cid, storage) == 1 then
selfSay("Zabiles juz je?", cid)
talkState[talkUser] = 1
else
selfSay("Dziekuje jeszcze raz za pomoc.", cid)
end

elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, storage) == -1 then
selfSay("Dziekuje, wroc jesli je zabijesz.", cid)
addEvent(doTeleportThing, 2000, cid, pos)
setPlayerStorageValue(cid, storage, 1)
elseif getPlayerStorageValue(cid, storage) == 1 then
selfSay("Nie zabiles ich.", cid)
talkState[talkUser] = 1
end
talkState[talkUser] = 0
elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then
selfSay("Ok then.", cid)
talkState[talkUser] = 0
end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())[/lua]

creaturescripts/renifertask.lua
[lua]local config = {
['Renifer'] = {ilosc = 300, storage = 10000}
}
local pos = {x=1, y=1, z=7}
function onKill(cid, target)
local monster = config[getCreatureName(target):lower()]
if isPlayer(target) or not monster then
return true
end

if getPlayerStorageValue(cid, monster.storage) >= -1 and (getPlayerStorageValue(cid, monster.storage)+1) < monster.ilosc then
setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Task: '..(getPlayerStorageValue(cid, monster.storage)+1)..' z '..monster.ilosc..' '..getCreatureName(target)..' zabitych.')
end
if (getPlayerStorageValue(cid, monster.storage)+1) == monster.ilosc then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Zabiles '..(getPlayerStorageValue(cid, monster.storage)+1)..' '..getCreatureName(target))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Za 5 sekund zostaniesz przeteleportowany do mikolaja.")
setPlayerStorageValue(cid, 5024, 2)
addEvent(doTeleportThing, 5000, cid, pos)
setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage)+1)
end
return true
end[/lua]

creaturescripts/login.lua
[lua]registerCreatureEvent(cid, "renifertask")[/lua]
creaturescripts.xml
[xml]<event type="kill" name="renifertask" event="script" value="renifertask.lua"/>[/xml]
w skrypcie onKill ustawiasz pozycje mikolaja, na mapie dodasz skrzynki z nagrodami i jakos to bedzie.
 
Odp: NPC Tibia 8.6

Ciamciaj rep+ dzi?ki :) edit sprawdz? potem czy ?miga .
 
Back
Do góry