• 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 Help with quest script

blackfellow

New Member
Joined
May 31, 2011
Messages
10
Reaction score
0
hello,
i am trying to learn lua and am attempting to make a script for a quest but i need some help with it. I want to make it so that the player can not leave their tile and they have to use a water vial that appears beneath them and once they do it disappears and it reappears one tile in front of them and when it is used on the tile in front of them it disappears and reappears on the tile beneath them and so on. Then, after a certain amount of times a water puddle will appear on a certain tile.

Here is what i have gotten so far any help is appreciated thanks


Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local posy = getPlayerPosition(cid) -- Returns the player's position

if item.itemuid == 2006 then
doRemoveItem(2006,1)
doCreateItem(2006,1,posy.y+1)
elseif item.itemuid == 2006 and itempos = (2006,1,posy.y+1) then
doRemoveItem(2006,1)
doCreateItem(2006,1,posy.y-2)

end
return true
end
 
just wanna make sure i get this..
Player stepin and a vial of water appears under him and he cant move until he used the vial of water on on him self? then he must step e.g. to the north tile where the next vial of water is and so on?
 
no sorry ill explain better a player is on a tile and cant move and there is a vial of water 1sqm south of player and when it is used it disappears and reappears 1sqm north of them and vice versa until say 20 tries of making it disappear and reasppear back and forth then is does not reappear and a puddle of water appears 2sqm east.

ex: V=vial of water
p=player
W=puddle of water

Start:
V
p
when vial gets used:
p
V
after 20 tries:
P W
 
yeah im working on this.. atleest so you cant move atm. :)

This is a movement script. edit the positions etc.. just wanna see if this works.
then il continue on the script where you use the vial.

Code:
   <movevent event="StepIn" actionid="1000" script="script.lua"/>
   <movevent event="StepOut" actionid="1000" script="script.lua"/>
Code:
function onStepOut(cid, item, frompos, item2, topos) 
    playerpos = {x=XXXX, y=YYYY, z=Z, stackpos=1} --- Where the player should stay if he make the quest
    
    --- Nort,East,South or west poss. (or where the water vial supose to be.)
    vial1 = {x=XXX, y=YYY, z=Z, stackpos=255}
    vial2 = {x=XXX, y=YYY, z=Z, stackpos=255}
    vial3 = {x=XXX, y=YYY, z=Z, stackpos=255}
    vial4 = {x=XXX, y=YYY, z=Z, stackpos=255}

    

    getvial1 = getThingfromPos(vial1)
    getvial2 = getThingfromPos(vial2)
    getvial3 = getThingfromPos(vial3)
    getvial4 = getThingfromPos(vial4)
    
    if item.actionid == 1000 and 
        getvial1.itemid == XXXX or --- Item id for the vial of water
        getvial2.itemid == XXXX or --- Item id for the vial of water
        getvial3.itemid == XXXX or --- Item id for the vial of water
        getvial4.itemid == XXXX then --- Item id for the vial of water
        doTeleportThing(cid, playerpos)
        doPlayerSendTextMessage(cid,22,"You will not get away from here yet..")


        else
                doTransformItem(item.uid, item.itemid + 1)
        end

end

 
function onStepIn(cid, item, frompos, item2, topos)
    newvial = {x=XXX, y=YYY, z=Z, stackpos=255}

    
    getnewvial = getThingfromPos(wall1)

    
    if item.actionid == 1000 then


        doTransformItem(item.uid, item.itemid - 1)
        doCreateItem(XXXX,1,newvial) ---- Water vial id.


        else

 
end
end
 
Last edited by a moderator:
Back
Top