• 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 movement help :)

Rethen

New Member
Joined
Apr 16, 2010
Messages
215
Reaction score
2
I did this quickly, I'm not that much experienced in LUA and would need some help/feedback...


Lua:
function onStepIn(cid, item, frompos, item2, topos)
    
    local storage = 27234
    
    if getPlayerStorageValue(cid,storage)
        setPlayerStorageValue(cid, storage, [B]???[/B])
    end
end

What should be in ???

also, after they get this storage, I want them able to go through a magic door, should I add storage in actionid in the door then?
 
Lua:
local storage = 27234

function onStepIn(cid, item, frompos, item2, topos)
    if getPlayerStorageValue(cid,storage) ~= 1 then
        setPlayerStorageValue(cid,storage,1)
    end
end

and no, you need to make a script with:

Lua:
if getPlayerStorageValue(cid,27234) == 1 then
 
If you are going to use that quest for anything else that will use that storage, you will need to change
Code:
if getPlayerStorageValue(cid,storage) ~= 1 then
to
Code:
if getPlayerStorageValue(cid,storage) < 0 then
 
I mean, if you first walk on a tile, you get a storage id to able to go into 1 door... it's part of a quest but not really thought that way...

I mean, you won't get any items or like that becouse u have this...

But simple question, what should I put in the door, action id and the storage? ;p
 
I mean, if you first walk on a tile, you get a storage id to able to go into 1 door... it's part of a quest but not really thought that way...

I mean, you won't get any items or like that becouse u have this...

But simple question, what should I put in the door, action id and the storage? ;p

Lua:
local storage = 27234

function onStepIn(cid, item, frompos, item2, topos)
    if getPlayerStorageValue(cid,storage) ~= 1 then
        setPlayerStorageValue(cid,storage,1)
    end
end

and no, you need to make a script with:

Lua:
if getPlayerStorageValue(cid,27234) == 1 then

Then you can use his script fine. Just set the AID of the door to the storage value
 
Should it not be like this?
Lua:
function onStepIn(cid, item, frompos, item2, topos)
   if getPlayerStorageValue(cid,27234) == 0 then
        setPlayerStorageValue(cid,27234,1)
    end
end

0 instead of 1 in "== 0"
cuz the player gets that when they have walk on it, or wut? :00
 
don't forget the returntrue
EMPTY_STORAGE equals -1, it's a constant
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if isPlayer(cid) and getCreatureStorage(cid, 27234) == EMPTY_STORAGE then
        doCreatureSetStorage(cid, 27234, 1)
    end
    return true
end
 
Back
Top