Can you help me to this problem with Chartan's mission from Wrath of Emperror Quest. Chartan gave me access to the room, but I can't use item on ground and later I don't have a item. In console haven't errors and bugs. The problem is all this his mission.
Sorry for my english.
I gives actions and libs into help
Actions :
Libs :
Thank you.
PS : I had fun with this many days
Sorry for my english.
I gives actions and libs into help
Actions :
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.actionid == 103 and getPlayerStorageValue(cid, STORAGE_ZLAK) == 4) then
if(getPlayerPosition(cid).x == POS_LEVER_TELEPORT[1].x and getPlayerPosition(cid).y == POS_LEVER_TELEPORT[1].y) then
doTeleportThing(cid, POS_LEVER_TELEPORT[2])
doSendMagicEffect(POS_LEVER_TELEPORT[2], CONST_ME_TELEPORT)
elseif(getPlayerPosition(cid).x == POS_LEVER_TELEPORT[2].x and getPlayerPosition(cid).y == POS_LEVER_TELEPORT[2].y) then
doTeleportThing(cid, POS_LEVER_TELEPORT[1])
doSendMagicEffect(POS_LEVER_TELEPORT[1], CONST_ME_TELEPORT)
end
end
if(item.acionid == 102) then -- a hole to teleport back from the zumtah prison
if(getPlayerStorageValue(cid, STORAGE_EXIT) == 1) then
doTeleportThing(cid, POS_PRISON_EXIT)
doSendMagicEffect(POS_PRISON_EXIT, CONST_ME_TELEPORT)
doSetCreatureOutfit(cid, {lookType = 352}, 1)
setPlayerStorageValue(cid, STORAGE_EXIT, 0)
end
end
if(REAGENTS[item.itemid]) then
local ID = (REAGENTS[item.itemid].ITEMEX)[1] and itemEx.actionid or itemEx.itemid
if(ID == (REAGENTS[item.itemid].ITEMEX)[2]) then
if(getPlayerStorageValue(cid, REAGENTS[item.itemid].STORAGE) < 1) then
doPlayerAddItem(cid, REAGENTS[item.itemid].ADDITEM, 1)
setPlayerStorageValue(cid, REAGENTS[item.itemid].STORAGE, 1)
doCreatureSay(cid, REAGENTS[item.itemid].TEXT, TALKTYPE_ORANGE_1)
end
end
end
if(item.itemid == 5908 and itemEx.itemid == 12296) then -- carving a bowl - ob knife
doTransformItem(itemEx.uid, 12287)
doCreatureSay(cid, "You carve a solid bowl of the chunk of wood.", TALKTYPE_ORANGE_1)
elseif(item.itemid == 12285 and itemEx.itemid == 12297) then -- combine earth with clay
doCreatureSay(cid, "You carefully mix the clay with the sacred earth.", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid)
doRemoveItem(itemEx.uid)
doPlayerAddItem(cid, 12300, 1)
elseif(item.itemid == 12300 and itemEx.itemid == 12287) then -- combine bowl with sacred clay
doCreatureSay(cid, "You carefully coat the inside of the wooden bowl with the sacred clay.", TALKTYPE_ORANGE_1)
doRemoveItem(itemEx.uid)
doTransformItem(item.uid, 12303)
elseif(item.itemid == 12303 and itemEx.itemid == 11450) then -- combine sacred bowl with water
doCreatureSay(cid, "Filling the corrupted water into the sacred bowl completly purifies the fluid.", TALKTYPE_ORANGE_1)
doTransformItem(item.uid, 12289)
elseif(item.itemid == 12289 and itemEx.itemid == 12301) then -- coal gathering
doTransformItem(item.uid, 12290)
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_POFF)
elseif(item.itemid == 12290 and itemEx.itemid == 12304) then -- coal usage - water clean, teleport done
doCreatureSay(cid, "As you give the coal into the pool the corrupted fluid begins to dissolve, leaving purified, refreshing water.", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid)
setPlayerStorageValue(cid, STORAGE_TELEPORT, 1)
end
if(item.actionid == 130) then -- combine scepter
if(getPlayerItemCount(cid, 12324) >= 1 and getPlayerItemCount(cid, 12325) >= 1 and getPlayerItemCount(cid, 12326) >= 1 and getPlayerStorageValue(cid, STORAGE_SCEPTRE) < 1) then
doPlayerRemoveItem(cid, 12324, 1)
doPlayerRemoveItem(cid, 12325, 1)
doPlayerRemoveItem(cid, 12326, 1)
doPlayerAddItem(cid, 12327, 1)
doSendMagicEffect(getThingPos(item.uid), CONST_ME_TELEPORT)
setPlayerStorageValue(cid, STORAGE_SCEPTRE, 1)
end
end
if(itemEx.itemid == 12383 and item.itemid == 12318) then -- summoning boss
doTransformItem(itemEx.uid, itemEx.itemid + 1)
addEvent(doTransformItem, 3 * 60 * 1000, itemEx.uid, itemEx.itemid - 1)
doSummonCreature(BOSSES[itemEx.actionid], getClosestFreeTile(cid, getThingPos(itemEx.uid)))
addEvent(doRemoveCreature, 3 * 60 * 1000, BOSSES[itemEx.actionid])
setGlobalStorageValue(itemEx.actionid, 1)
addEvent(setGlobalStorageValue, 3 * 60 * 1000, itemEx.actionid, 0)
end
if(isInArray({120, 121, 122, 123}, item.actionid)) then -- boss corpse
if(getPlayerStorageValue(cid, item.actionid) < 1 and getPlayerStorageValue(cid, STORAGE_BOSS) ~= 4) then
setPlayerStorageValue(cid, STORAGE_BOSS, math.max(0, getPlayerStorageValue(cid, STORAGE_BOSS)) + 1)
setPlayerStorageValue(cid, item.actionid, 1)
doSendMagicEffect(getThingPos(item.uid), CONST_ME_HOLYDAMAGE)
end
setPlayerStorageValue(cid, itemEx.actionid, 1)
elseif(item.actionid == 110) then -- teleport to the last room
for x = 746, 751 do
for y = 611, 616 do
pos = {x = x, y = y, z = getCreaturePosition(cid).z}
if(isPlayer(getTopCreature(pos).uid)) then
doTeleportThing(getTopCreature(pos).uid, POS_LAST_ROOM)
doSendMagicEffect(POS_LAST_ROOM, CONST_ME_TELEPORT)
end
end
end
if(not(getCreatureByName("snake god essence"))) then
doSummonCreature("snake god essence", {x = 2312, y = 2320, z = 8})
end
end
if(item.itemid == 12385 and getPlayerStorageValue(cid, STORAGE_END) == 1) then
setPlayerStorageValue(cid, STORAGE_END, 2)
doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
end
if(item.itemid == 12320 and itemEx.itemid == 12292 and not(getCreatureByName("the keeper"))) then -- the keeper summon
doSummonCreature("the keeper", getClosestFreeTile(cid, toPosition))
end
if(item.itemid == 12316) then -- the keeper corpse
if(getPlayerStorageValue(cid, STORAGE_THE_KEEPER) < 1) then
doPlayerAddItem(cid, 12323, 1)
setPlayerStorageValue(cid, STORAGE_THE_KEEPER, 1)
doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
end
end
if(item.itemid == 12318 and itemEx.itemid == 12385) then
if(getPlayerStorageValue(cid, STORAGE_END) < 3) then
setPlayerStorageValue(cid, STORAGE_END, 3)
doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
end
end
if(isInArray({113, 114, 115}, item.actionid)) then -- item reward
if(getPlayerStorageValue(cid, STORAGE_PRIZE) < 1) then
doPlayerAddItem(cid, PRIZE[item.actionid], 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found " .. getItemArticleById(PRIZE[item.actionid]) .. " " .. getItemNameById(PRIZE[item.actionid]) .. ".")
setPlayerStorageValue(cid, STORAGE_PRIZE, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It's empty.")
end
end
if(item.actionid == 116) then -- outfit
if(getPlayerStorageValue(cid, STORAGE_OUTFIT) < 1) then
for i = 366, 367 do
doPlayerAddOutfit(cid, i, 3)
end
setPlayerStorageValue(cid, STORAGE_OUTFIT, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You've found some clothes in wardrobe")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The wardrobe is empty.")
end
end
if(item.actionid == 117) then -- reward room door
storageDoors(cid, item.uid, "vertical", STORAGE_END, 4)
elseif(item.actionid == 131) then -- izsh doors
storageDoors(cid, item.uid, "vertical", STORAGE_END, 3)
elseif(item.actionid == 132) then -- zalamon doors
storageDoors(cid, item.uid, "horizontal", STORAGE_PREQUEST, 1)
elseif(item.actionid == 133) then -- izsh doors
storageDoors(cid, item.uid, "vertical", STORAGE_CHARTAN, 2)
end
return true
end
Libs :
Lua:
STORAGE_CHARTAN = 1
STORAGE_ZALAMON = 2
STORAGE_CLAY = 3
STORAGE_EARTH = 4
STORAGE_WOOD = 5
STORAGE_SCEPTRE = 6
STORAGE_BOSS = 7
STORAGE_END = 8
STORAGE_TELEPORT = 9
STORAGE_ZLAK = 10
STORAGE_NOBLE = 11
STORAGE_MAGISTRATUS = 12
STORAGE_GATE = 13
STORAGE_GHOST = 14
STORAGE_ZUMTAH = 15
STORAGE_ZIZZLE = 16
STORAGE_LAST = 17
STORAGE_DRAGON = 18
PRISON_POS = {x = 2532, y = 2204, z = 8}
STORAGE_THE_KEEPER = 19
STORAGE_OUTFIT = 20
POS_LAST_ROOM = {x = 2312, y = 2230, z = 8}
POS_PRISON_EXIT = {x = 2637, y = 2281, z = 8}
POS_LEVER_TELEPORT = {
{x = 2608, y = 2133, z = 9},
{x = 2321, y = 2089, z = 2}
}
SOUL_PARTS, ZALAMON_FORMS, ZLAK_MISSIONS, REAGENTS, BOSSES, PRIZE = {
["spite of the emperor"] = 120,
["wrath of the emperor"] = 121,
["scorn of the emperor"] = 122,
["fury of the emperor"] = 123
},
{
["snake god essence"] = {
TEXT = "IT'S NOT THAT EASY MORTALS! FEEL THE POWER OF THE GOD!",
NEW_FORM = "snake thing"
},
["snake thing"] = {
TEXT = "NOOO! NOW YOU HERETICS WILL FACE MY GODLY WRATH!",
NEW_FORM = "lizard abomination"
},
["lizard abomination"] = {
TEXT = "YOU ... WILL ... PAY WITH ETERNITY ... OF AGONY!",
NEW_FORM = "mutated zalamon"
}
},
{
["lizard magistratus"] = {
MAX_STORAGE_VALUE = 4,
STORAGE_ZLAK = 1
},
["lizard noble"] = {
MAX_STORAGE_VALUE = 6,
STORAGE_ZLAK = 2
}
},
{
[2549] = {
ITEMEX = {
false,
12322
},
TEXT = "You dig out a handful of ordinary clay.",
STORAGE = STORAGE_CLAY,
ADDITEM = 12285
},
[5710] = {
ITEMEX = {
true,
101
},
TEXT = "You dig out a handful of earth from this sacred place.",
STORAGE = STORAGE_EARTH,
ADDITEM = 12297
},
[2553] = {
ITEMEX = {
false,
12296
},
TEXT = "The cracked part of the table lets you cut out a large chunk of wood with your pick.",
STORAGE = STORAGE_WOOD,
ADDITEM = 12295
}
},
{
[105] = "scorn of the emperor",
[106] = "spite of the emperor",
[107] = "fury of the emperor",
[108] = "wrath of the emperor"
},
{
[113] = 12642,
[114] = 12643,
[115] = 12645
}
function storageDoors(cid, uid, direction, storage, value)
if(getPlayerStorageValue(cid, storage) >= value) then
if(direction == "vertical") then
if(getCreaturePosition(cid).y > getThingPosition(uid).y) then
doTeleportThing(cid, {x = getPlayerPosition(cid).x, y = getPlayerPosition(cid).y - 2, z = getPlayerPosition(cid).z})
else
doTeleportThing(cid, {x = getPlayerPosition(cid).x, y = getPlayerPosition(cid).y + 2, z = getPlayerPosition(cid).z})
end
elseif(direction == "horizontal") then
if(getCreaturePosition(cid).y > getThingPosition(uid).y) then
doTeleportThing(cid, {x = getPlayerPosition(cid).x, y = getPlayerPosition(cid).y - 2, z = getPlayerPosition(cid).z})
else
doTeleportThing(cid, {x = getPlayerPosition(cid).x, y = getPlayerPosition(cid).y + 2, z = getPlayerPosition(cid).z})
end
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The doors are sealed against unwanted intruders.")
end
return true
end
function doPlayerTeleportIfStorage(cid, storage, value, newpos, oldpos)
if(getPlayerStorageValue(cid, storage) >= value) then
doTeleportThing(cid, newpos)
doSendMagicEffect(newpos, CONST_ME_TELEPORT)
else
return oldpos and doTeleportThing(cid, oldpos) or true
end
return true
end
Thank you.
PS : I had fun with this many days
Last edited by a moderator: