• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Metin event Help talkactions

bartol150

New Member
Joined
Oct 16, 2013
Messages
18
Reaction score
0
What line I have to add for talkaction."!metin".
Code:
<?xml version="1.0" encoding="UTF-8"?>
    <mod name="Metin Stone Event" version="1.1" author="Oskar" contact="[email protected]" enabled="yes">
    <config name="metinStone_conf"><![CDATA[
    metinStoneStart = {
                        pos_od = {x=1019,y=1008,z=7}, --lewy gorny rog
                        pos_do = {x=1040,y=1014,z=7}, --prawy dolny rog [X: 1040 | Y: 1014 | Z: 7]
                        time = 480, --pierwsze i kazde nastepne losowanie od momentu startu serwera, w minutach
                        chance = 100 --szansa na wylosowanie kamulca
                        }
    metinArea = createCombatArea{
                                      {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
                                      {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
                                      {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
                                      {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
                                      {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
                                      {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
                                      {1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1},
                                      {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
                                      {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
                                      {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
                                      {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
                                      {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
                                      {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0}
                                      }
    metinConfig = {
                    ['fire stone'] = {
                                      [90] = {m = {'fire elemental','fire devil'}, n = {15, 20}},
                                      [80] = {m = {'fire elemental','fire devil','massive fire elemental'}, n = {16, 21}},
                                      [70] = {m = {'dragon','fire elemental'}, n = {17, 22}},
                                      [60] = {m = {'dragon','massive fire elemental','fire elemental'}, n = {18, 23}},
                                      [50] = {m = {'dragon','dragon lord','massive fire elemental'}, n = {19, 24}},
                                      [40] = {m = {'dragon lord','massive fire elemental','diabolic imp'}, n = {20, 25}},
                                      [30] = {m = {'diabolic imp','hellfire fighter','infernalist'}, n = {21, 26}},
                                      [20] = {m = {'diabolic imp','hellfire fighter','demon','infernalist'}, n = {22, 27}},
                                      [10] = {m = {'demon','hellfire fighter','infernalist','hellhound'}, n = {23, 28}},
                                      [5] = {m = {'demon','arch devil','hellhound'}, n = {24, 29}}},
                    ['earth stone'] = {
                                      [90] = {m = {'slime','bonelord','earth elemental'}, n = {15, 20}},
                                      [80] = {m = {'bonelord','elder bonelord','earth elemental'}, n = {16, 21}},
                                      [70] = {m = {'massive earth elemental','bog raider','earth elemental'}, n = {17, 22}},
                                      [60] = {m = {'bog raider','medusa','wyvern'}, n = {18, 23}},
                                      [50] = {m = {'medusa','defiler','slime'}, n = {19, 24}},
                                      [40] = {m = {'medusa','serpent spawn','slime'}, n = {20, 25}},
                                      [30] = {m = {'serpent spawn','wyvern','defiler'}, n = {21, 26}},
                                      [20] = {m = {'defiler','medusa','slime'}, n = {22, 27}},
                                      [10] = {m = {'defiler','plaguesmith','phantasm'}, n = {23, 28}},
                                      [5] = {m = {'plaguesmith','defiler','abomination creature'}, n = {24, 29}}},
                    ['ice stone'] = {
                                      [90] = {m = {'ice golem','crystal spider'}, n = {15, 20}},
                                      [80] = {m = {'ice golem','crystal spider','ice witch'}, n = {16, 21}},
                                      [70] = {m = {'crystal spider','ice witch','mammoth'}, n = {17, 22}},
                                      [60] = {m = {'crystal spider','frost dragon'}, n = {18, 23}},
                                      [50] = {m = {'crystal spider','frost dragon','ice witch'}, n = {19, 24}},
                                      [40] = {m = {'frost dragon','warlock'}, n = {20, 25}},
                                      [30] = {m = {'crystal spider','frost dragon','warlock'}, n = {21, 26}},
                                      [20] = {m = {'crystal spider','frost dragon','warlock','ice witch'}, n = {22, 27}},
                                      [10] = {m = {'frost dragon','warlock'}, n = {23, 28}},
                                      [5] = {m = {'frost dragon','warlock'}, n = {24, 29}}},
                    }
    metinCombat = {['fire stone'] = {COMBAT_FIREDAMAGE, CONST_ME_FIREAREA},
                        ['earth stone'] = {COMBAT_EARTHDAMAGE, CONST_ME_SMALLPLANTS},
                        ['ice stone'] = {COMBAT_ICEDAMAGE, CONST_ME_ICEATTACK}}
                     
    function getPercent(number, all)
        return (number / all) * 100
    end
   
    function choose(arg)
        return arg[math.random(#arg)]
    end
   
    function isWalkable(pos, creature, proj, pz)
    if getTileThingByPos({x=pos.x,y=pos.y,z=pos.z,stackpos=0}).itemid == 0 then return false end
    if getTopCreature(pos).uid > 0 and creature then return false end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 3 or 2
    for i = 0, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
              if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                  return false
              end
        end
    end
    return true
    end
   
    function checkPositions(fromPos, toPos, nb)
    local pos = {x=math.random(fromPos.x,toPos.x), y=math.random(fromPos.y,toPos.y), z=math.random(fromPos.z,toPos.z)}
    if isWalkable(pos, true, true, true) then
        return pos
    end
    return (nb < 50 and checkPositions(fromPos, toPos, nb+1) or false)
    end
   
    function setMetinStone(metinStoneStart, metinConfig)
    local pos = checkPositions(metinStoneStart.pos_od, metinStoneStart.pos_do, 0)
    if pos and math.random(100) <= metinStoneStart.chance then
        local stones = {}
        for k, _ in pairs(metinConfig) do
              table.insert(stones, k)
        end
        local stone = choose(stones)
        doBroadcastMessage(stone .. ' is summoned!')
        local mon = doCreateMonster(stone, pos, false)
        registerCreatureEvent(mon, 'metinStoneCombat')
    end
    return addEvent(setMetinStone, metinStoneStart.time * 60 * 1000, metinStoneStart, metinConfig)
    end
    ]]></config>
   
    <event type="combat" name="metinStoneCombat" event="script"><![CDATA[
    domodlib('metinStone_conf')
    function onCombat(cid, target)
    if isMonster(target) then
        registerCreatureEvent(target, 'metinStoneCombat')
    end
    local t, vw = getPercent(getCreatureHealth(target), getCreatureMaxHealth(target)), metinConfig[getCreatureName(target):lower()]
    if isMonster(target) and vw then
        if t > 90 then doCreatureSetStorage(target, 1000, 91) end
        for k, v in pairs(vw) do
              if k >= t and getCreatureStorage(target, 1000) > k then
                local pos = getThingPos(target)
                for i = 1, math.random(v.n[1], v.n[2]) do
                    local s = {x=pos.x,y=pos.y,z=pos.z}
                    s.x = pos.x + math.random(-3,3)
                    s.y = pos.y + math.random(-3,3)
                    doCreateMonster(choose(v.m), s, false)
                end
                  doCombatAreaHealth(target, metinCombat[getCreatureName(target):lower()][1], pos, metinArea, -298, -917, metinCombat[getCreatureName(target):lower()][2])
                return doCreatureSetStorage(target, 1000, k)
            end
        end
    end
    return true
    end
    ]]></event>
   
    <globalevent name="metinStoneStart" type="start" event="script"><![CDATA[
    domodlib("metinStone_conf")
    function onStartup()
        return addEvent(setMetinStone, metinStoneStart.time * 60 * 1000, metinStoneStart, metinConfig)
    end
    ]]></globalevent>
   
    <event type="login" name="metinStoneEventLogin" event="buffer" value="registerCreatureEvent(cid, 'metinStoneCombat')"/>
       
    </mod>
 
Back
Top