• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Elemetal Sphere quest, machine only

Muboz

New Member
Joined
Jun 5, 2007
Messages
33
Reaction score
4
posL = left side of the machine
posR = right side of the machine
countStorage = storage to count how many sapphires/rubies/amethyst/emerald has been used on the machine
realms = position of the realm

Im a bit newbie on this still =P tried my best I'll be releasing the quest while im finishing it.
And I know this is a bit inefficient but it works

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local config = {
	posL = {x=33268, y=31830, z=10},
	posR = {x=33269, y=31830, z=10},
	countStorage = 30530,
	knightRealm = {x=33086, y=32095, z=13},
	pallyRealm = {x=33264, y=32200, z=13},
	druidRealm = {x=33330, y=32075, z=13},
	sorcRealm = {x=33181, y=32198, z=13}
}
 
local function teleportVocation(cid)
local voc = {
    [1] = config.sorcRealm, --sorc
    [2] = config.druidRealm, --druid
    [3] = config.pallyRealm, --pally
    [4] = config.knightRealm,--knight
    [5] = config.sorcRealm, --sorc
    [6] = config.druidRealm, --druid
    [7] = config.pallyRealm, --pally
    [8] = config.knightRealm,--knight
    }
		doTeleportThing(cid,voc[getPlayerVocation(cid)])
	return true
end
--on to off
if item.itemid == 7916 then
		doRemoveItem(getThingFromPos(config.posL).uid)
		doRemoveItem(getThingFromPos(config.posR).uid)
		doSendMagicEffect(config.posR, CONST_ME_POFF)
		doCreateItem(7911, 1, config.posL)
		doCreateItem(7912, 1, config.posR)
end
--off to on
if item.itemid == 7912 then
	if getPlayerStorageValue(cid,config.countStorage) >= 20 then
		teleportVocation(cid)
	else
		doRemoveItem(getThingFromPos(config.posL).uid)
		doRemoveItem(getThingFromPos(config.posR).uid)
		doSendMagicEffect(config.posR, CONST_ME_PURPLEENERGY)
		doCreateItem(7915, 1, config.posL)
		doCreateItem(7916, 1, config.posR)
	end
end

end--end function


TODO:
Different jewels needed per vocation
 
man, this is really nice, but try to explain a little bit.
 
euh you should put the locals and the custom function outside of onUse function :ninja:
Lua:
local config = {
    posL = {x=33268, y=31830, z=10},
    posR = {x=33269, y=31830, z=10},
    countStorage = 30530,
    knightRealm = {x=33086, y=32095, z=13},
    pallyRealm = {x=33264, y=32200, z=13},
    druidRealm = {x=33330, y=32075, z=13},
    sorcRealm = {x=33181, y=32198, z=13}
}
 
local function teleportVocation(cid)
    local voc = {
        [1] = config.sorcRealm, --sorc
        [2] = config.druidRealm, --druid
        [3] = config.pallyRealm, --pally
        [4] = config.knightRealm,--knight
        [5] = config.sorcRealm, --sorc
        [6] = config.druidRealm, --druid
        [7] = config.pallyRealm, --pally
        [8] = config.knightRealm,--knight
        }
    doTeleportThing(cid,voc[getPlayerVocation(cid)])
    return true
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
--on to off
    if item.itemid == 7916 then
        doRemoveItem(getThingFromPos(config.posL).uid)
        doRemoveItem(getThingFromPos(config.posR).uid)
        doSendMagicEffect(config.posR, CONST_ME_POFF)
        doCreateItem(7911, 1, config.posL)
        doCreateItem(7912, 1, config.posR)
    end
--off to on
    if item.itemid == 7912 then
        if getCreatureStorage(cid,config.countStorage) >= 20 then
            teleportVocation(cid)
        else
            doRemoveItem(getThingFromPos(config.posL).uid)
            doRemoveItem(getThingFromPos(config.posR).uid)
            doSendMagicEffect(config.posR, CONST_ME_PURPLEENERGY)
            doCreateItem(7915, 1, config.posL)
            doCreateItem(7916, 1, config.posR)
        end
    end
    return true
--end function 
end
 
Last edited:
Back
Top