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

Vocation quest, help me !

DVEagle

New Member
Joined
Aug 29, 2009
Messages
95
Reaction score
3
Location
PoLand
I've got vocation quest on my ot with this script:
Code:
function onUse(cid, item, frompos, item2, topos)
	-- Item ID and Uniqueid --
	switchUniqueID = 1912
	switchID = 1945
	switch2ID = 1946
	swordID	= 2376
	crossbowID = 2455
	appleID	= 2674
	spellbookID	= 2175
 
 
	-- Level to do the quest --
	questlevel = 25
 
 
	piece1pos = {x=1181, y=1095, z=4, stackpos=1} -- Where the first piece will be placed
	getpiece1 = getThingfromPos(piece1pos)
 
	piece2pos = {x=1181, y=1087, z=4, stackpos=1} -- Where the second piece will be placed
	getpiece2 = getThingfromPos(piece2pos)
 
	piece3pos = {x=1177, y=1091, z=4, stackpos=1} -- Where the third piece will be placed
	getpiece3 = getThingfromPos(piece3pos)
 
	piece4pos = {x=1185, y=1091, z=4, stackpos=1} -- Where the fourth piece will be placed
	getpiece4 = getThingfromPos(piece4pos)
 
	player1pos = {x=1181, y=1093, z=4, stackpos=253} -- Where player1 will stand before pressing lever
	player1 = getThingfromPos(player1pos)
	player2pos = {x=1181, y=1089, z=4, stackpos=253} -- Where player2 will stand before pressing lever
	player2 = getThingfromPos(player2pos)
	player3pos = {x=1179, y=1091, z=4, stackpos=253} -- Where player3 will stand before pressing lever
	player3 = getThingfromPos(player3pos)
	player4pos = {x=1183, y=1091, z=4, stackpos=253} -- Where player4 will stand before pressing lever
	player4 = getThingfromPos(player4pos)
 
	knightvoc = getPlayerVocation(player1.uid)   -- The vocation of player1
	paladinvoc = getPlayerVocation(player2.uid)  -- The vocation of player2
	druidvoc = getPlayerVocation(player3.uid)    -- The vocation of player3
	sorcerervoc = getPlayerVocation(player4.uid) -- The vocation of player4
 
	nplayer1pos = {x=1194, y=1093, z=4} -- The new position of player1
	nplayer2pos = {x=1194, y=1092, z=4} -- The new position of player2
	nplayer3pos = {x=1195, y=1091, z=4} -- The new position of player3
	nplayer4pos = {x=1193, y=1091, z=4} -- The new position of player4
 
 
	player1level = getPlayerLevel(player1.uid) -- Checking the level of player1
	player2level = getPlayerLevel(player2.uid) -- Checking the level of player2
	player3level = getPlayerLevel(player3.uid) -- Checking the level of player3
	player4level = getPlayerLevel(player4.uid) -- Checking the level of player4
 
 
	-- Check if all players has the correct vocation
	if knightvoc == 4 or knightvoc == 8 and
	paladinvoc == 3 or paladinvoc == 7 and
	druidvoc == 2 or druidvoc == 6 and
	sorcerervoc == 1 or sorcerervoc == 5 then	
 
 
	-- Check if all players are standing on the correct positions
	if player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 and player4.itemid > 0 then
		if player1level >= questlevel and player2level >= questlevel and player3level >= questlevel and	player4level >= questlevel then
			if item.uid == switchUniqueID and item.itemid == switchID and getpiece1.itemid == swordID and getpiece2.itemid == crossbowID and getpiece3.itemid == appleID and getpiece4.itemid == spellbookID then
				doSendMagicEffect(player1pos,2)
				doTeleportThing(player1.uid,nplayer1pos)
				doSendMagicEffect(nplayer1pos,10)
				doRemoveItem(getpiece1.uid,1)
 
				doSendMagicEffect(player2pos,2)
				doTeleportThing(player2.uid,nplayer2pos)
				doSendMagicEffect(nplayer2pos,10)
				doRemoveItem(getpiece2.uid,1)
 
				doSendMagicEffect(player3pos,2)
				doTeleportThing(player3.uid,nplayer3pos)
				doSendMagicEffect(nplayer3pos,10)
				doRemoveItem(getpiece3.uid,1)
 
				doSendMagicEffect(player4pos,2)
				doTeleportThing(player4.uid,nplayer4pos)	
				doSendMagicEffect(nplayer4pos,10)
				doRemoveItem(getpiece4.uid,1)
 
				doTransformItem(item.uid,item.itemid+1)
			elseif item.uid == switchUniqueID and item.itemid == switch2ID then
				doTransformItem(item.uid,item.itemid-1)
			else
				doPlayerSendCancel(cid,"Sorry, you need to put the correct stuffs at the correct basins.")
			end
			else
			return 0
			end
		else
			doPlayerSendCancel(cid,"Sorry, all players in your team must to be level " .. questlevel .. ".")
		end
	else
		doPlayerSendCancel(cid,"Sorry, all 4 players must be on right positions.")
	end
	return 1
end

I've checked 100x times the positions and item ids but everytime in any combination it always says "Put blablabla in correct basins".

What is wrong ?
I dont understand this part of script:
doTransformItem(item.uid,item.itemid+1)
elseif item.uid == switchUniqueID and item.itemid == switch2ID then
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry, you need to put the correct stuffs at the correct basins.")
end
else

Help plax.

+++ Screen to show how it looks:
desert2c.jpg
 
I've changed it and now nothing happens in game and in ot window i've got that error:
[Error - Action Interface]
[17/06/2010 13:59:28] data/actions/scripts/quests/vocation_quest.lua:eek:nUse
[17/06/2010 13:59:28] Description:
[17/06/2010 13:59:28] attempt to index a function value
[17/06/2010 13:59:28] stack traceback:
[17/06/2010 13:59:28] [C]: in function 'getTileItemById'
[17/06/2010 13:59:28] data/actions/scripts/quests/vocation_quest.lua:17: in function <data/actions/scripts/quests/vocation_quest.lua:1>
 
Ehh.. Now when i'm using the lever there aren't any bug but nothing happens and i dont have any comment. Just like the lever was without action.

piece1pos = {x=1181, y=1095, z=4, stackpos=1} -- Where the first piece will be placed
getpiece1 = getTileItemById(pos, itemId[, subType = -1])
 
Ok i liked my old script but it seems i have no choice ;D..
I give u 2 guys rep but i dont know did it matters on this site if person who give reput have few posts.

Anyways i'll try this script and if something's gone wrong i'll post it here :).
 
My new script looks like that:
Code:
local config = {
    -- level needed to make the quest
    level = 25,
 
    -- if players should be able to do the quest unlimited amount of times (not conflicting quest rewards)
    redo = {
        status = true, -- true = unlimited, false = once
        storageValue = 4535 -- only if status is false this will be used
    },
 
    -- vocation requirement, positions and item configuration
    {
        vocations = {1, 5},
        itemId = 2175,
        playerPos = {x=1183, y=1091, z=4},
        newPos = {x=1194, y=1093, z=4},
        itemPos = {x=1185, y=1091, z=4}
    },
 
    {
        vocations = {2, 6},
        itemId = 2674,
        playerPos = {x=1179, y=1091, z=4},
        newPos = {x=1194, y=1093, z=4},
        itemPos = {x=1177, y=1091, z=4}
    },
 
    {
        vocations = {3, 7},
        itemId = 2455,
        playerPos = {1181, y=1089, z=4},
        newPos = {x=1194, y=1093, z=4},
        itemPos = {x=1181, y=1087, z=4}
    },
 
    {
        vocations = {4, 8},
        itemId = 2376,
        playerPos = {x=1181, y=1093, z=4},
        newPos = {x=1194, y=1093, z=4},
        itemPos = {x=1181, y=1095, z=4}
    }
}
 
function onUse(cid)
    local players = {}
    local items = {}
    for _, v in ipairs(config) do
        v.playerPos.stackpos = 253
        local player = getThingfromPos(v.playerPos).uid
 
        if isPlayer(player) == FALSE then
            return doPlayerSendCancel(cid, "There are not enough players.")
        elseif getPlayerLevel(player) < config.level then
            players.level = true
        elseif isInArray(v.vocations, getPlayerVocation(player)) == FALSE then
            players.vocation = true
        elseif config.redo.status and getPlayerStorageValue(cid, config.redo.storageValue) ~= TRUE then
            players.done = true
        else
            local item = getTileItemById(v.itemPos, v.itemid)
 
            if item.uid == 0 then
                players.item = true
            else
                table.insert(players, player)
                table.insert(items, item.uid)
            end
        end
    end
 
    if players.level then
        doPlayerSendCancel(cid, "All players need to be level " .. config.level .. " or above.")
    elseif players.vocation then
        doPlayerSendCancel(cid, "All players must stand on the correct tiles.")
    elseif players.done then
        doPlayerSendCancel(cid, "A player in your team has already done this quest.")
    elseif players.item then
        doPlayerSendCancel(cid, "All items must be on the correct positions.")
    else
        for k, player in ipairs(players) do
            doSendMagicEffect(getCreaturePosition(player), CONST_ME_POFF)
            doTeleportThing(player, config[k].newPos)
            doSendMagicEffect(getCreaturePosition(player), CONST_ME_TELEPORT)
 
            for _, item in ipairs(items) do
                doRemoveItem(item.uid)
            end
        end
    end
 
    return TRUE
end
I've changed only xYz and in game i've got that message "There are not enough players." And in engine an error:

[18/06/2010 00:07:41] [Error - Action Interface]
[18/06/2010 00:07:41] data/actions/scripts/quests/vocation_quest.lua:eek:nUse
[18/06/2010 00:07:41] Description:
[18/06/2010 00:07:41] (luaGetThingFromPos) Tile not found

What da hell is wrong again?
 
Lua:
function onUse(cid, item, frompos, item2, topos)
	-- Item ID and Uniqueid --
	swordID	= 2376
	crossbowID = 2455
	appleID	= 2674
	spellbookID	= 2175
 
 
	-- Level to do the quest --
	questlevel = 25
 
 
	piece1pos = {x=1181, y=1095, z=4, stackpos=255} -- Where the first piece will be placed
	getpiece1 = getThingfromPos(piece1pos)
 
	piece2pos = {x=1181, y=1087, z=4, stackpos=255} -- Where the second piece will be placed
	getpiece2 = getThingfromPos(piece2pos)
 
	piece3pos = {x=1177, y=1091, z=4, stackpos=255} -- Where the third piece will be placed
	getpiece3 = getThingfromPos(piece3pos)
 
	piece4pos = {x=1185, y=1091, z=4, stackpos=255} -- Where the fourth piece will be placed
	getpiece4 = getThingfromPos(piece4pos)
 
	player1pos = {x=1181, y=1093, z=4, stackpos=253} -- Where player1 will stand before pressing lever
	player1 = getThingfromPos(player1pos)
	player2pos = {x=1181, y=1089, z=4, stackpos=253} -- Where player2 will stand before pressing lever
	player2 = getThingfromPos(player2pos)
	player3pos = {x=1179, y=1091, z=4, stackpos=253} -- Where player3 will stand before pressing lever
	player3 = getThingfromPos(player3pos)
	player4pos = {x=1183, y=1091, z=4, stackpos=253} -- Where player4 will stand before pressing lever
	player4 = getThingfromPos(player4pos)

	nplayer1pos = {x=1194, y=1093, z=4} -- The new position of player1
	nplayer2pos = {x=1194, y=1092, z=4} -- The new position of player2
	nplayer3pos = {x=1195, y=1091, z=4} -- The new position of player3
	nplayer4pos = {x=1193, y=1091, z=4} -- The new position of player4
 
 
	player1level = getPlayerLevel(player1.uid) -- Checking the level of player1
	player2level = getPlayerLevel(player2.uid) -- Checking the level of player2
	player3level = getPlayerLevel(player3.uid) -- Checking the level of player3
	player4level = getPlayerLevel(player4.uid) -- Checking the level of player4
 
 if player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 and player4.itemid > 0 then
	-- Check if all players has the correct vocation
	if isKnight(player1.uid) and
	isPaladin(player2.uid) and
	isDruid(player3.uid) and
	isSorcerer(player4.uid) then	
 
 
		if player1level >= questlevel and player2level >= questlevel and player3level >= questlevel and	player4level >= questlevel then
			if  getpiece1.itemid == swordID and getpiece2.itemid == crossbowID and getpiece3.itemid == appleID and getpiece4.itemid == spellbookID then
				doSendMagicEffect(player1pos,2)
				doTeleportThing(player1.uid,nplayer1pos)
				doSendMagicEffect(nplayer1pos,10)
				doRemoveItem(getpiece1.uid,1)
 
				doSendMagicEffect(player2pos,2)
				doTeleportThing(player2.uid,nplayer2pos)
				doSendMagicEffect(nplayer2pos,10)
				doRemoveItem(getpiece2.uid,1)
 
				doSendMagicEffect(player3pos,2)
				doTeleportThing(player3.uid,nplayer3pos)
				doSendMagicEffect(nplayer3pos,10)
				doRemoveItem(getpiece3.uid,1)
 
				doSendMagicEffect(player4pos,2)
				doTeleportThing(player4.uid,nplayer4pos)	
				doSendMagicEffect(nplayer4pos,10)
				doRemoveItem(getpiece4.uid,1)
			else
				doPlayerSendCancel(cid,"Sorry, you need to put the correct stuffs at the correct basins.")
			end
		else
			doPlayerSendCancel(cid,"Sorry, all players in your team must to be level " .. questlevel .. ".")
		end
	else
		doPlayerSendCancel(cid,"Sorry, all 4 players must be on right positions.")
	end
	else
		doPlayerSendCancel(cid,"Sorry, you need 4 players to go.")
	end
end
??
 
W pierwszym poście w tym temacie jest o tym starym skrypcie i dlaczego nie działał.
/
At the beginning of this topic there is about an old script which doesn't worked too.
 
Kurde annihilator mi nie działa w ogóle a skrypt jest dobry bo na 2-gim serwerze działa.. A zmieniłem tylko współrzędne (sprawdzałem 100 razy).
Czy to może być przez to , że oddzielam sobie linie ?? TZn. wrzucam przez codes i tak ładniej skrypt wygląda bo tak to skrypty są tak pisane obok siebie wszystko , nieczytelnie ..
 
Skrypty są oddzielane liniami, widzisz w nich bałagan bo pewnie otwierasz w notatniku... Wyślij mi anihi na PW...

English
No have idea what's up :/
 
Back
Top