• 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!

Lua Need help with these luas

Ahead

New Member
Joined
Dec 27, 2013
Messages
165
Reaction score
2
I do not know how these luas work, could you explain to me?

1º. Pythius The Rotten

xml

Code:
    <event type="death" name="PythiusTheRotten" event="script" value="PythiusTheRotten.lua"/>

lua

Code:
function onDeath(cid, corpse, deathList)
   
if getCreatureName(cid):lower() == "pythius the rotten" then
       
for i = 1, #deathList do
           
if isPlayer(deathList[i]) then
               
doCreatureSay(deathList[i], "NICE FIGHTING LITTLE WORM, YOUR VICTORY SHALL BE REWARDED!", TALKTYPE_ORANGE_1, nil, nil, {x=32577, y=31402, z=15})
               
doSendMagicEffect(getCreaturePosition(deathList[i]), CONST_ME_TELEPORT)
               
doTeleportThing(deathList[i], {x=32577, y=31402, z=15})
               
doSendMagicEffect({x=32577, y=31402, z=15}, CONST_ME_TELEPORT)
               
break
           
end
       
end
   
end
   
return true

end

I suppose that if type event is "death" will be something relationed with killing him, but he is an NPC. I mean, when you go in front of him, he does not attack you, just speak.

2º. Tasks.

lua

Code:
function onSay(cid, words, param)

    function pairsByKeys (t, f)
      local a = {}
      for n in pairs(t) do table.insert(a, n) end
      table.sort(a, f)
      local i = 0
      local iter = function ()
        i = i + 1
        if a[i] == nil then return nil
        else return a[i], t[a[i]]
        end
      end
      return iter
    end

local m = {
["crystalcrusher"] = {storage = 101001,count = 100},
["cliff strider"] = {storage = 101002,count = 120}, 
["ironblight"] = {storage = 101003,count = 90},
["lava golem"] = {storage = 101004,count = 100},
["orewalker"] = {storage = 101005,count = 150},
["hideous fungus"] = {storage = 101006,count = 200},
["humongous fungus"] = {storage = 101007,count = 180},
["damaged crystal golem"] = {storage = 101008,count = 100},
["magma crawler"] = {storage = 101009,count = 140},
["lost berserker"] = {storage = 101010,count = 110},
["enraged crystal golem"] = {storage = 101011,count = 60},
["infected weeper"] = {storage = 101012,count = 200},
["weeper"] = {storage = 101013,count = 150},
["wiggler"] = {storage = 101014,count = 80},
["vulcongra"] = {storage = 101015,count = 120},
}

local str = ""
str = str .. "Task Completed :\n\n"
for k, v in pairsByKeys(m) do
local contagem = getPlayerStorageValue(cid, v.storage)
if(contagem == -1) then 
contagem = 1 
end 
str = str..k.." = ["..((contagem)-1).."/"..v.count.."]\n"
end
str = str .. "" 
return doShowTextDialog(cid, 8983, str) 
end

When i use !task ingame, there appears a list with those monsters, with a count, but i do not know what happens if you complete one of them or all. Anyways, do not know how it works xD.

Thank you all.
 
1º.
When the player kills the monster named "pythius the rotten", the function will be executed (it will teleport the player who killed it to the x, y, z listed in the function).

2º.
When the player kills an monster (in the list), his storage (101001 or 101002 or... 101015) will go up by 1.
I'm pretty sure it's all it does :p
Unless you have another script(talkaction,think,npc, whatever) that gives the player a reward, it will only show if the player completed or not the task.
 
Back
Top