What's new

Grizzly Adams - RL wersja. - By Oskar

Status
Not open for further replies.

Sassin

Forum friend
Joined
Jun 13, 2009
Messages
1,281
Reaction score
107
Cze??! ?eby?cie nie musieli szuka?, wklejam Wam skrypt Oskar'a, kt?ry "przez przypadek" zosta? usuni?ty. http://tibia.net.pl/npc/338799-grizzly-adams-rl-wersja.html

~Creatureevents/scripts:

PHP:
tasks_system.lua

PHP:
function onKill(cid, target) 
local config = {     
    ["troll"] = {storage = 9999, begin_storage_value = 1, finished_storage_value = 2, count = 300}, 
    ["swamp troll"] = {storage = 9999, begin_storage_value = 1, finished_storage_value = 2, count = 300}, 
    ["lizard high guard"] = {storage = 9998, begin_storage_value = 3, finished_storage_value = 4, count = 500}, 
    ["lizard dragon priest"] = {storage = 9998, begin_storage_value = 3, finished_storage_value = 4, count = 500}, 
    ["lizard chosen"] = {storage = 9998, begin_storage_value = 3, finished_storage_value = 4, count = 500}, 
    ["witch"] = {storage = 9997, begin_storage_value = 5, finished_storage_value = 6, count = 450}, 
    ["dragon"] = {storage = 9996, begin_storage_value = 7, finished_storage_value = 8, count = 150}, 
    ["dragon lord"] = {storage = 9996, begin_storage_value = 7, finished_storage_value = 8, count = 150}, 
    ["frost dragon"] = {storage = 9996, begin_storage_value = 7, finished_storage_value = 8, count = 150}, 
    ["undead dragon"] = {storage = 9995, begin_storage_value = 9, finished_storage_value = 10, count = 300}, 
    ["ghastly dragon"] = {storage = 9995, begin_storage_value = 9, finished_storage_value = 10, count = 300}, 
    --bosses-- 
    ["trolls boss"] = {storage = 19999, begin_storage_value = 1, finished_storage_value = 2, count = 1}, 
    ["lizards boss"] = {storage = 19998, begin_storage_value = 3, finished_storage_value = 4, count = 1}, 
    ["dragons boss"] = {storage = 19997, begin_storage_value = 7, finished_storage_value = 8, count = 1} 
    } 
local mob = config[string.lower(getCreatureName(target))] 
if(not mob) then 
    return true 
end 
local main_storage = 10001 
local bosses_storage = 10002 
if(isPlayer(target) ~= TRUE) then 
local count_monsters = getPlayerStorageValue(cid, mob.storage) 
    if getPlayerStorageValue(cid, main_storage) == mob.begin_storage_value and count_monsters <= mob.count then 
        doPlayerSetStorageValue(cid, mob.storage, count_monsters + 1) 
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed ".. getPlayerStorageValue(cid, mob.storage) .." of "..mob.count.." "..getCreatureName(target).."s.") 
            if getPlayerStorageValue(cid, mob.storage) == mob.count then  
                doPlayerSetStorageValue(cid, main_storage, mob.finished_storage_value) 
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed enough "..getCreatureName(target).."s.") 
            end 
    elseif getPlayerStorageValue(cid, bosses_storage) == mob.begin_storage_value and getPlayerStorageValue(cid, mob.storage) == mob.count then 
        doPlayerSetStorageValue(cid, main_storage, mob.finished_storage_value) 
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed "..getCreatureName(target)..".") 
    end 
end 
    return true 
end

PHP:
do login.lua przed return true

PHP:
registerCreatureEvent(cid, "Tasks_System")

PHP:
i plik .xml

PHP:
<event type="kill" name="Tasks_System" event="script" value="tasks_system.lua"/>

~NPC

PHP:
tasks_system.lua

1/2
 

Sassin

Forum friend
Joined
Jun 13, 2009
Messages
1,281
Reaction score
107
Odp: Grizzly Adams - RL wersja. - By Oskar

PHP:
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 say(param) 
            npcHandler:say(param.text,param.cid) 
         end 
    function delayedSay(text, delay, cid) 
    if(not npcHandler:isFocused(cid)) then 
                return FALSE 
     else 
         local param = {cid = cid, text = text} 
            local delay = delay or 0 
            addEvent(say, delay, param) 
        end 
    end 
function creatureSayCallback(cid, type, msg) 
    if(not npcHandler:isFocused(cid)) then 
    return false 
end 
local main_storage = 10001 
local bosses_storage = 10002 
local getStorage = getPlayerStorageValue(cid, main_storage) 
local getStorages = getPlayerStorageValue(cid, bosses_storage) 
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid 
local good_hunting = {"Happy hunting, old chap! Come back to me when you are through with your {task}.", "Good show, old chap! Speak to me again when you are done hunting."}     
local good_job = {"That took some time, huh? Good hunting though. If you're up for another hunting mission just ask me for a {task}.", "If you're up for another hunting mission just ask me for a {task}."} 
local tasks = { 
            [1] = {name = "trolls", storage = 9999, min_level = 8, max_level = 20, first_reward = "yes", first_type = "item", reward_one = 2148, count_one = 50, second_reward = "no", second_type = "item", reward_second = 0, count_second = 0, third_reward = "no", third_type = "item", reward_third = 0, count_third = 0, begin_storage_value = 1, finish_storage_value = 2, boss = "yes", before_kill_boss = 1, after_kill_boss = 2, talkstate = 1}, 
            [2] = {name = "high lizards", storage = 9998, min_level = 50, max_level = 150, first_reward = "no", first_type = "item", reward_one = 0, count_one = 0, second_reward = "no", second_type = "item", reward_second = 0, count_second = 0, third_reward = "yes", third_type = "storage", reward_third = 5000, count_third = -1, begin_storage_value = 3, finish_storage_value = 4, boss = "yes", before_kill_boss = 3, after_kill_boss = 4, talkstate = 2}, 
            [3] = {name = "witches", storage = 9997, min_level = 20, max_level = 50, first_reward = "no", first_type = "item", reward_one = 0, count_one = 0, second_reward = "no", second_type = "item", reward_second = 0, count_second = 0, third_reward = "no", third_type = "item", reward_third = 0, count_third = 0, begin_storage_value = 5, finish_storage_value = 6, boss = "no", before_kill_boss = 5, after_kill_boss = 6, talkstate = 3}, 
            [4] = {name = "dragons", storage = 9996, min_level = 5, max_level = 270, first_reward = "yes", first_type = "skill", reward_one = SKILL__LEVEL, count_one = 4, second_reward = "yes", second_type = "money", reward_second = 0, count_second = 5000, third_reward = "no", third_type = "exp", reward_third = 0, count_third = 25000, begin_storage_value = 7, finish_storage_value = 8, boss = "no", before_kill_boss = 7, after_kill_boss = 8, talkstate = 4}, 
            [5] = {name = "undead dragon", storage = 9995, min_level = 30, max_level = 260, first_reward = "yes", first_type = "item", reward_one = 9777, count_one = 1, second_reward = "yes", second_type = "item", reward_second = 2148, count_second = 5000, third_reward = "yes", third_type = "money", reward_third = 0, count_third = 5000, begin_storage_value = 9, finish_storage_value = 10, boss = "no", before_kill_boss = 9, after_kill_boss = 10, talkstate = 5} 
            } 
if msgcontains(msg, "task") then 
    if getStorage <= 0 then  
        selfSay("All right, what would you like to hunt? {trolls}, {high lizards}, {witches}, {dragons} or {undead dragons}?", cid) 
        talkState[talkUser] = 100 
    end 
elseif msgcontains(msg, "cancel") and getStorage > 0 then 
    selfSay("Do you want cancel actual mission?", cid) 
    talkState[talkUser] = 101 
end 
for i = 1, #tasks do 
    if msgcontains(msg, tasks[i].name) and talkState[talkUser] == 100 then 
        if (getPlayerLevel(cid) >= tasks[i].min_level and getPlayerLevel(cid) <= tasks[i].max_level) then 
            selfSay("Do you want hunt "..tasks[i].name.."?", cid) 
            talkState[talkUser] = tasks[i].talkstate 
        else 
            selfSay("You do not have enough level.", cid) 
            return true 
        end 
    elseif msgcontains(msg, "yes") and talkState[talkUser] == tasks[i].talkstate then 
        doPlayerSetStorageValue(cid, main_storage, tasks[i].begin_storage_value) 
        selfSay(good_hunting[math.random(1, #good_hunting)], cid) 
        doPlayerSetStorageValue(cid, tasks[i].storage, 0) 
    elseif msgcontains(msg, "task") then 
        if getStorage == tasks[i].finish_storage_value and getStorages < tasks[i].before_kill_boss then 
            if tasks[i].boss == "yes" then 
                selfSay("Good job, go kill boss.", cid) 
                doPlayerSetStorageValue(cid, bosses_storage, tasks[i].before_kill_boss) 
            else  
                doPlayerSetStorageValue(cid, bosses_storage, -1) 
                doPlayerSetStorageValue(cid, main_storage, -1) 
                doPlayerSetStorageValue(cid, tasks[i].storage, -1) 
                selfSay(good_job[math.random(1, #good_job)], cid) 
                if tasks[i].first_reward == "yes" then 
                    if tasks[i].first_type == "item" then 
                        doPlayerAddItem(cid, tasks[i].reward_one, tasks[i].count_one, true) 
                    elseif tasks[i].first_type == "exp" then 
                        doPlayerAddExperience(cid, tasks[i].count_one) 
                        doSendAnimatedText(getPlayerPosition(cid), tasks[i].count_one, TEXTCOLOR_WHITE) 
                    elseif tasks[i].first_type == "storage" then 
                        doPlayerSetStorageValue(cid, tasks[i].reward_one, tasks[i].count_one)
                    elseif tasks[i].first_type == "money" then 
                        doPlayerAddMoney(cid, tasks[i].count_one) 
                    elseif tasks[i].first_type == "skill" then 
                        doPlayerAddSkill(cid, tasks[i].reward_one, tasks[i].count_one) 
                    end 
                end 
                if tasks[i].second_reward == "yes" then 
                    if tasks[i].second_type == "item" then 
                        doPlayerAddItem(cid, tasks[i].reward_second, tasks[i].count_second, true) 
                    elseif tasks[i].second_type == "exp" then 
                        doPlayerAddExperience(cid, tasks[i].count_second) 
                        doSendAnimatedText(getPlayerPosition(cid), tasks[i].count_second, TEXTCOLOR_WHITE) 
                    elseif tasks[i].second_type == "storage" then 
                        doPlayerSetStorageValue(cid, tasks[i].reward_second, tasks[i].count_second) 
                    elseif tasks[i].second_type == "money" then 
                        doPlayerAddMoney(cid, tasks[i].count_second) 
                    elseif tasks[i].second_type == "skill" then 
                        doPlayerAddSkill(cid, tasks[i].reward_second, tasks[i].count_second) 
                    end 
                end 
                if tasks[i].third_reward == "yes" then 
                    if tasks[i].third_type == "item" then 
                        doPlayerAddItem(cid, tasks[i].reward_third, tasks[i].count_third, true) 
                    elseif tasks[i].third_type == "exp" then 
                        doPlayerAddExperience(cid, tasks[i].count_third) 
                        doSendAnimatedText(getPlayerPosition(cid), tasks[i].count_third, TEXTCOLOR_WHITE) 
                    elseif tasks[i].third_type == "storage" then 
                        doPlayerSetStorageValue(cid, tasks[i].reward_third, tasks[i].count_third) 
                    elseif tasks[i].third_type == "money" then 
                        doPlayerAddMoney(cid, tasks[i].count_third) 
                    elseif tasks[i].third_type == "skill" then 
                        doPlayerAddSkill(cid, tasks[i].reward_third, tasks[i].count_third) 
                    end 
                end 
            end 
        elseif getStorages == tasks[i].after_kill_boss then 
            doPlayerSetStorageValue(cid, main_storage, -1) 
            doPlayerSetStorageValue(cid, tasks[i].storage, -1) 
            selfSay(good_job[math.random(1, #good_job)], cid) 
                if tasks[i].first_reward == "yes" then 
                    if tasks[i].first_type == "item" then 
                        doPlayerAddItem(cid, tasks[i].reward_one, tasks[i].count_one, true) 
                    elseif tasks[i].first_type == "exp" then 
                        doPlayerAddExperience(cid, tasks[i].count_one) 
                        doSendAnimatedText(getPlayerPosition(cid), tasks[i].count_one, TEXTCOLOR_WHITE) 
                    elseif tasks[i].first_type == "storage" then 
                        doPlayerSetStorageValue(cid, tasks[i].reward_one, tasks[i].count_one)
                    elseif tasks[i].first_type == "money" then 
                        doPlayerAddMoney(cid, tasks[i].count_one) 
                    elseif tasks[i].first_type == "skill" then 
                        doPlayerAddSkill(cid, tasks[i].reward_one, tasks[i].count_one) 
                    end 
                end 
                if tasks[i].second_reward == "yes" then 
                    if tasks[i].second_type == "item" then 
                        doPlayerAddItem(cid, tasks[i].reward_second, tasks[i].count_second, true) 
                    elseif tasks[i].second_type == "exp" then 
                        doPlayerAddExperience(cid, tasks[i].count_second) 
                        doSendAnimatedText(getPlayerPosition(cid), tasks[i].count_second, TEXTCOLOR_WHITE) 
                    elseif tasks[i].second_type == "storage" then 
                        doPlayerSetStorageValue(cid, tasks[i].reward_second, tasks[i].count_second) 
                    elseif tasks[i].second_type == "money" then 
                        doPlayerAddMoney(cid, tasks[i].count_second) 
                    elseif tasks[i].second_type == "skill" then 
                        doPlayerAddSkill(cid, tasks[i].reward_second, tasks[i].count_second) 
                    end 
                end 
                if tasks[i].third_reward == "yes" then 
                    if tasks[i].third_type == "item" then 
                        doPlayerAddItem(cid, tasks[i].reward_third, tasks[i].count_third, true) 
                    elseif tasks[i].third_type == "exp" then 
                        doPlayerAddExperience(cid, tasks[i].count_third) 
                        doSendAnimatedText(getPlayerPosition(cid), tasks[i].count_third, TEXTCOLOR_WHITE) 
                    elseif tasks[i].third_type == "storage" then 
                        doPlayerSetStorageValue(cid, tasks[i].reward_third, tasks[i].count_third) 
                    elseif tasks[i].third_type == "money" then 
                        doPlayerAddMoney(cid, tasks[i].count_third) 
                    elseif tasks[i].third_type == "skill" then 
                        doPlayerAddSkill(cid, tasks[i].reward_third, tasks[i].count_third) 
                    end 
                end 
        elseif getStorage == tasks[i].begin_storage_value then 
            selfSay("You have kill "..getPlayerStorageValue(cid, tasks[i].storage).." "..tasks[i].name..".", cid) 
        elseif getStorages == tasks[i].before_kill_boss then 
            selfSay("You do not kill boss yet.", cid) 
        end 
    elseif msgcontains(msg, "yes") and talkState[talkUser] == 101 then 
        if getStorage > 0 then 
            selfSay("Speak to me again when you are done hunting.", cid) 
            doPlayerSetStorageValue(cid, main_storage, -1) 
            doPlayerSetStorageValue(cid, tasks[i].storage, -1) 
            return true 
        end 
    end 
end 
return true 
end 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) 
npcHandler:addModule(FocusModule:new())

PHP:
tasker.xml

PHP:
<?xml version="1.0"?> 
<npc name="Tasker" script="tasks_system.lua" access="3" walkinterval="2000" lookdir="2"> 
        <health now="200" max="200"/> 
<look type="142" head="97" body="97" legs="94" feet="97" addons="3"/> 
</npc>

2/2
 
Last edited:

Sassin

Forum friend
Joined
Jun 13, 2009
Messages
1,281
Reaction score
107
Odp: Grizzly Adams - RL wersja. - By Oskar

~Wyja?nienie

W sumie niewiele trzeba wyja?nia?. Zacznijmy od pliku w folderze creaturescripts.
Aby doda? nowego taska, musimy po prostu doklei? now? linijk? w tym?e pliku, tak by ostatni wers nie mia? na ko?cu przecinka. Nazwy potwor?w piszemy z ma?ej literki.
begin_storage_value to warto?? storage pocz?tkowa, kt?r? ustalamy w pliku NPC. W obu plikach musi by? zgodne z sob?.
finished_storage_value to warto?? storage ko?cowa, po jej nadaniu task zostaje uznany jako "zako?czony" i mo?emy i?? do NPC po nagrod?.
count to ilo?? potwor?w wymaganych do zabicia.
To teraz plik NPC.
name to nazwa taska, albo inaczej - s?owo klucz, na kt?re zareaguje nasz NPC.
storage storage do liczenia potwork?w, ustawi? takie, kt?rego si? nie u?ywa.
min_level minimalny poziom wymagany do rozpocz?cia taska.
max_level maksymalny dopuszczalny poziom by wykona? taska.
first_reward/second_reward/third_reward "yes" albo "no", czyli czy gracz ma otrzymywa? nagrod?, "yes" to tak, "no" to nie.
first_type/second_type/third_type typ pierwszej nagrody, do wyboru "exp" czyli do?wiadczenie, "money" czyli got?wka, "item" czyli przedmiot, "skill" czyli umiej?tno?? walki tudzie? poziom do?wiadczenia/magiczny, "storage" czyli nadawanie jakiego? storage w takim czy innym celu.
reward_one/reward_second/reward_third dla "exp" nadajemy mu "0" (zero), dla "money" r?wnie? "0", dla "item" nadajemy id itemu, jaki ma by? nagrod?, dla "skill" nazw? skilla (do wyboru:
SKILL_FIST = 0
SKILL_CLUB = 1
SKILL_SWORD = 2
SKILL_AXE = 3
SKILL_DISTANCE = 4
SKILL_SHIELD = 5
SKILL_FISHING = 6
SKILL__MAGLEVEL = 7
SKILL__LEVEL = 8
Wyra?a? mo?na poprzez nazw?, tudzie? liczb?. Oraz "storage", kt?remu nadajemy jakie storage ma zosta? zmienione.
count_one/count_second/count_third czyli po prostu ilo??. W przypadku storage warto??.
begin_storage_value warto?? pocz?tkowa storage, musi by? taka sama jak w przypadku begin_storage_value w pliku creaturescripts.
finish_storage_value warto?? ko?cowa storage, musi by? taka sama jak w przypadku finish_storage_value w pliku creaturescripts.
boss czy po zabiciu danej ilo?ci potwork?w ma by? walka z bossem. "yes" lub "no".
before_kill_boss warto?? storage po uko?czeniu taska i po zainicjowaniu w skrypcie mo?liwo?ci walki z bossem.
after_kill_boss warto?? storage po zabiciu bossa.
talkstate to was nie powinno interesowa?, nadawajcie coraz to kolejne liczby pocz?wszy od "1".

To tyle. Mi?ej zabawy!
 
Last edited:

Vergil93

Advanced User
Joined
Jun 19, 2010
Messages
263
Reaction score
6
Odp: Grizzly Adams - RL wersja. - By Oskar

Chyba Ci si? co? pomyli?o. Tutaj jest m?j skrypt:
 

Sassin

Forum friend
Joined
Jun 13, 2009
Messages
1,281
Reaction score
107
Odp: Grizzly Adams - RL wersja. - By Oskar

Owszem, ale z Tnet'u usun??e?...
 

Vergil93

Advanced User
Joined
Jun 19, 2010
Messages
263
Reaction score
6
Odp: Grizzly Adams - RL wersja. - By Oskar

Po pierwsze - skoro go usun??em to znaczy, i? mia?em zapewne jaki? wa?ny pow?d.
Po drugie - nie przypominam sobie bym udziela? Ci zgody na rozpowszechnianie mojego skryptu. To ?amanie praw autorskich, czego sobie nie ?ycz?.
Po trzecie - ??dam usuni?cia tego tematu w trybie natychmiastowym, gdy? nie zosta?a udzielona zgoda na okazanie tego skryptu.
 

MarexXx

User
Joined
Oct 15, 2009
Messages
26
Reaction score
0
Odp: Grizzly Adams - RL wersja. - By Oskar

witam ,
mam pytanie czy ktos zrobilby mi takiego npc pod 8.60
z wlasnymi taskami zabijania potworow ??

bardzo bylbym wdzieczny prosze pisac na priv :>
fajnie by bylo gdyby ktos zrobil to za darmo aczkolwiek jesli bedzie wszystko pieknie dzialac moge wyslac jakiegos smsa :>
 
Status
Not open for further replies.
Top