CreatureEvent KillingInTheNameOF (task system) for OTHIRE 7.72

Discussion in 'GlobalEvents, Spells & CreatureEvents' started by Stellow, Mar 31, 2015.

  1. Peonso

    Peonso Active Member

    Joined:
    Jan 14, 2008
    Messages:
    868
    Likes Received:
    420
    Best Answers:
    0
    getTasksByPlayer function is not implemented
     
  2. Evilor

    Evilor New Member

    Joined:
    Oct 17, 2016
    Messages:
    25
    Likes Received:
    2
    Best Answers:
    0
    Okay, how do i implement it?
    The functions.lua is the same.
     
  3. riesjuh666

    riesjuh666 New Member

    Joined:
    Sep 26, 2010
    Messages:
    27
    Likes Received:
    2
    Best Answers:
    0
    when i try to say Task,tasks or mission he dont respond :(

    anyone knows?
     
  4. Evilor

    Evilor New Member

    Joined:
    Oct 17, 2016
    Messages:
    25
    Likes Received:
    2
    Best Answers:
    0
    data/lib/functions
    or /data/functions
    add and edit the functions text posted
     
  5. riesjuh666

    riesjuh666 New Member

    Joined:
    Sep 26, 2010
    Messages:
    27
    Likes Received:
    2
    Best Answers:
    0
    Well i think the problem is that i'm not using OThire but tfs1.2 for 7.4 :(
     
  6. Tatuy1

    Tatuy1 Member

    Joined:
    Mar 24, 2014
    Messages:
    109
    Likes Received:
    6
    Best Answers:
    1
    I get this error:
    [​IMG]

    Can you help me to implement that?
     
  7. blady703

    blady703 Member

    Joined:
    Jun 30, 2011
    Messages:
    30
    Likes Received:
    7
    Best Answers:
    0
    Hello this script work Othire 0.0.3

    Npctask.lua

    local keywordHandler = KeywordHandler:new()
    local npcHandler = NpcHandler:new(keywordHandler)
    NpcSystem.parseParameters(npcHandler)
    local talkState = {}
    function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
    function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
    function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
    function onThink() npcHandler:eek:nThink() end
    keywordHandler:addKeyword({'task'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Help me and kill rat or bug?"})
    keywordHandler:addKeyword({'mission'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Help me and kill rat or bug??"})
    function creatureSayCallback(cid, type, msg)
    function creatureSayCallback(cid, type, msg)
    return false
    end

    local storage = 82000
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

    if msgcontains(msg, 'tarantula')then
    if getPlayerStorageValue(cid, 82006) == -1 then
    npcHandler:say("Do you can help me and kill 200 of this creatures?", cid)
    talk_state = 1
    elseif getPlayerStorageValue(cid, storage) == 12 then
    npcHandler:say("Great! You killed 200 Tarantula and finished the task. Your reward is 5000 gold coins 70000 experience points.", cid)
    setPlayerStorageValue(cid, storage, -12)
    doPlayerAddExp(cid, 70000)
    doPlayerAddMoney(cid, 5000)

    else
    npcHandler:say("I do not have anymore quests for you, adventurer.", cid)
    end
    elseif msgcontains(msg, 'yes') and talk_state == 1 then
    npcHandler:say("I appreciate that! Now go and kill 200 of this creatures, then back to me if you done this.", cid)
    setPlayerStorageValue(cid, storage, 11)
    talk_state = 2
    end

    if msgcontains(msg, 'giant spider') then
    if getPlayerStorageValue(cid, 82007) == -1 then
    npcHandler:say("Do you can help me and kill 50 of this creatures?", cid)
    talk_state = 3
    elseif getPlayerStorageValue(cid, storage) == 14 then
    npcHandler:say("Great! You killed 50 Giant Spiders and finished the task. Your reward is 10.000 gold coins 100000 experience points.", cid)
    setPlayerStorageValue(cid, storage, -14)
    doPlayerAddExp(cid, 100000)
    doPlayerAddItem(cid, 2160, 1)
    else
    npcHandler:say("I do not have anymore quests for you, adventurer.", cid)
    end
    elseif msgcontains(msg, 'yes') and talk_state == 3 then
    npcHandler:say("I appreciate that! Now go and kill 50 of this creatures, then back to me if you done this.", cid)
    setPlayerStorageValue(cid, storage, 13)
    talk_state = 4



    end
    end
    npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    npcHandler:addModule(FocusModule:new())



    data/creaturescript/script create tsak.lua
    and paste this code

    function onKill(cid, target)
    local config = {
    ["spider"] = {storage = 82001, begin_storage_value = 1, finished_storage_value = 2, count = 30},
    ["bug"] = {storage = 82002, begin_storage_value = 3, finished_storage_value = 4, count = 50},
    ["rat"] = {storage = 82003, begin_storage_value = 5, finished_storage_value = 6, count = 30},
    ["cave rat"] = {storage = 82003, begin_storage_value = 5, finished_storage_value = 6, count = 30},

    ["rotworm"] = {storage = 82004, begin_storage_value = 7, finished_storage_value = 8, count = 100},
    ["centipede"] = {storage = 82005, begin_storage_value = 9, finished_storage_value = 10, count = 50},
    ["slime"] = {storage = 82023, begin_storage_value = 45, finished_storage_value = 46, count = 50},
    ["cyclops"] = {storage = 82013, begin_storage_value = 25, finished_storage_value = 26, count = 300},


    ["tarantula"] = {storage = 82006, begin_storage_value = 11, finished_storage_value = 12, count = 200},
    ["giant spider"] = {storage = 82007, begin_storage_value = 13, finished_storage_value = 14, count = 50},

    ["larva"] = {storage = 82033, begin_storage_value = 65, finished_storage_value = 66, count = 50},
    ["scarab"] = {storage = 82034, begin_storage_value = 67, finished_storage_value = 68, count = 100},
    ["ancient scarab"] = {storage = 82035, begin_storage_value = 69, finished_storage_value = 70, count = 100},
    ["kongra"] = {storage = 82036, begin_storage_value = 71, finished_storage_value = 72, count = 100},
    ["sibang"] = {storage = 82036, begin_storage_value = 71, finished_storage_value = 72, count = 100},
    ["merlkin"] = {storage = 82036, begin_storage_value = 71, finished_storage_value = 72, count = 100},
    ["dworc venomsniper"] = {storage = 82027, begin_storage_value = 53, finished_storage_value = 54, count = 150},
    ["dworc voodoomaster"] = {storage = 82027, begin_storage_value = 53, finished_storage_value = 54, count = 150},
    ["dworc fleshhunter"] = {storage = 82027, begin_storage_value = 53, finished_storage_value = 54, count = 150},
    ["lizard sentinel"] = {storage = 82028, begin_storage_value = 55, finished_storage_value = 56, count = 100},
    ["lizard templar"] = {storage = 82028, begin_storage_value = 55, finished_storage_value = 56, count = 100},
    ["lizard snakecharmer"] = {storage = 82028, begin_storage_value = 55, finished_storage_value = 56, count = 100},
    ["hydra"] = {storage = 82008, begin_storage_value = 15, finished_storage_value = 16, count = 300},
    ["serpent spawn"] = {storage = 82009, begin_storage_value = 17, finished_storage_value = 18, count = 100},


    ["dragon"] = {storage = 82010, begin_storage_value = 19, finished_storage_value = 20, count = 300},
    ["dragon lord"] = {storage = 82011, begin_storage_value = 21, finished_storage_value = 22, count = 200},
    ["black knight"] = {storage = 82012, begin_storage_value = 23, finished_storage_value = 24, count = 20},



    ["troll"] = {storage = 82015, begin_storage_value = 29, finished_storage_value = 30, count = 50},
    ["skeleton"] = {storage = 82016, begin_storage_value = 31, finished_storage_value = 32, count = 50},
    ["ghoul"] = {storage = 82017, begin_storage_value = 33, finished_storage_value = 34, count = 150},
    ["minotaur"] = {storage = 82018, begin_storage_value = 35, finished_storage_value = 36, count = 100},
    ["minotaur guard"] = {storage = 82019, begin_storage_value = 37, finished_storage_value = 38, count = 100},
    ["minotaur mage"] = {storage = 82020, begin_storage_value = 39, finished_storage_value = 40, count = 20},

    ["orc"] = {storage = 82021, begin_storage_value = 41, finished_storage_value = 42, count = 100},
    ["orc warrior"] = {storage = 82021, begin_storage_value = 41, finished_storage_value = 42, count = 100},
    ["orc spearman"] = {storage = 82021, begin_storage_value = 41, finished_storage_value = 42, count = 100},

    ["warlock"] = {storage = 82022, begin_storage_value = 43, finished_storage_value = 44, count = 300},

    ["beholder"] = {storage = 82024, begin_storage_value = 47, finished_storage_value = 48, count = 40},

    ["orc berserker"] = {storage = 82025, begin_storage_value = 49, finished_storage_value = 50, count = 150},
    ["orc leader"] = {storage = 82025, begin_storage_value = 49, finished_storage_value = 50, count = 150},
    ["orc warlord"] = {storage = 82026, begin_storage_value = 51, finished_storage_value = 52, count = 50},

    ["dwarf"] = {storage = 82029, begin_storage_value = 57, finished_storage_value = 58, count = 200},
    ["dwarf soldier"] = {storage = 82029, begin_storage_value = 57, finished_storage_value = 58, count = 200},
    ["dwarf guard"] = {storage = 82030, begin_storage_value = 59, finished_storage_value = 60, count = 100},
    ["dwarf geomancer"] = {storage = 82030, begin_storage_value = 59, finished_storage_value = 60, count = 100},

    ["elf"] = {storage = 82031, begin_storage_value = 61, finished_storage_value = 62, count = 100},
    ["elf scout"] = {storage = 82031, begin_storage_value = 61, finished_storage_value = 62, count = 100},
    ["elf arcanist"] = {storage = 82032, begin_storage_value = 63, finished_storage_value = 64, count = 40},

    ["amazon"] = {storage = 82037, begin_storage_value = 73, finished_storage_value = 74, count = 100},
    ["valkyrie"] = {storage = 82037, begin_storage_value = 73, finished_storage_value = 74, count = 100},
    ["witch"] = {storage = 82038, begin_storage_value = 75, finished_storage_value = 76, count = 20},

    ["demon"] = {storage = 82039, begin_storage_value = 77, finished_storage_value = 78, count = 200},
    ["banshee"] = {storage = 82041, begin_storage_value = 81, finished_storage_value = 82, count = 30},
    ["behemoth"] = {storage = 82014, begin_storage_value = 27, finished_storage_value = 28, count = 200},

    ["hero"] = {storage = 82042, begin_storage_value = 83, finished_storage_value = 84, count = 150},
    ["priestess"] = {storage = 82050, begin_storage_value = 99, finished_storage_value = 100, count = 30},

    ["ghost"] = {storage = 82043, begin_storage_value = 85, finished_storage_value = 86, count = 40},

    ["smuggler"] = {storage = 82044, begin_storage_value = 87, finished_storage_value = 88, count = 200},
    ["wild warrior"] = {storage = 82044, begin_storage_value = 87, finished_storage_value = 88, count = 200},
    ["bandit"] = {storage = 82044, begin_storage_value = 87, finished_storage_value = 88, count = 200},

    ["mummy"] = {storage = 82045, begin_storage_value = 89, finished_storage_value = 90, count = 50},
    ["necromancer"] = {storage = 82046, begin_storage_value = 91, finished_storage_value = 92, count = 300},
    ["crypt shambler"] = {storage = 82047, begin_storage_value = 93, finished_storage_value = 94, count = 50},
    ["bonebeast"] = {storage = 82048, begin_storage_value = 95, finished_storage_value = 96, count = 200},
    ["vampire"] = {storage = 82049, begin_storage_value = 97, finished_storage_value = 98, count = 200},
    ["lich"] = {storage = 82040, begin_storage_value = 79, finished_storage_value = 80, count = 30},

    ["demon skeleton"] = {storage = 82051, begin_storage_value = 101, finished_storage_value = 102, count = 50},


    ["marid"] = {storage = 82052, begin_storage_value = 103, finished_storage_value = 104, count = 100},
    ["efreet"] = {storage = 82052, begin_storage_value = 103, finished_storage_value = 104, count = 100},
    ["green djinn"] = {storage = 82052, begin_storage_value = 103, finished_storage_value = 104, count = 100},
    ["blue djinn"] = {storage = 82052, begin_storage_value = 103, finished_storage_value = 104, count = 100},

    ["yeti"] = {storage = 82053, begin_storage_value = 105, finished_storage_value = 106, count = 20},
    ["ice warrior"] = {storage = 82054, begin_storage_value = 107, finished_storage_value = 108, count = 50},

    ["pirate buccaneer"] = {storage = 82055, begin_storage_value = 109, finished_storage_value = 110, count = 300},
    ["pirate corsair"] = {storage = 82055, begin_storage_value = 109, finished_storage_value = 110, count = 300},
    ["pirate cutthroat"] = {storage = 82055, begin_storage_value = 109, finished_storage_value = 110, count = 300},



    }
    local mob = config[string.lower(getCreatureName(target))]
    if(not mob) then
    return true
    end
    local main_storage = 82000
    if(isPlayer(target) ~= TRUE) then
    local count_monsters = getPlayerStorageValue(cid, mob.storage)
    if(count_monsters == 0 or count_monsters == -1) then
    count_monsters = 1
    end

    if(isPlayer(target) ~= TRUE) then
    if getPlayerStorageValue(cid, main_storage) == mob.begin_storage_value and count_monsters <= mob.count then
    setPlayerStorageValue(cid, mob.storage, count_monsters + 1)
    doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "You killed "..count_monsters.." of "..mob.count.." "..getCreatureName(target).."s.")
    if count_monsters == mob.count then
    setPlayerStorageValue(cid, main_storage, mob.finished_storage_value)
    doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Congratulations! You have killed enough "..getCreatureName(target).."s.")
    end
    elseif getPlayerStorageValue(cid, bosses_storage) == mob.begin_storage_value and count_monsters == mob.count then
    setPlayerStorageValue(cid, main_storage, mob.finished_storage_value)
    doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Congratulations! You have killed "..getCreatureName(target)..".")
    end
    end
    end
    return true
    end

    edite login.lua
    and paste this :
    registerCreatureEvent(cid, "onKill")

    creaturescripts.xml
    add this
    <event name="onKill" type="kill" script="task.lua"/>


    Work perfect :)
     

Share This Page

Loading...