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

Feature [creatureEvent] onMove very advanced

Hello i have problem with this script for block move items on title with 10 items
look
Lua:
function onMoveItem(cid, item, fromPosition, toPosition, fromItem, toItem, fromGround, toGround, status)
toPosition.stackpos = 10
if(getThingFromPos(toPosition).uid)then
   doPlayerSendCancel(cid, "Sorry, you cannot put more items on this tile.")
   return false
	end
end
And if i move item to ground without items then i have message "Sorry, you cannot put more items on this tile.".
 
Last edited:
I need a script that does not let equip in hand's (right hand and left hand), if the item.id have in the script, the player can not equip the item in the hands...i tring to make this but i poor in script, tks (srry my inglish.)

tks all.
 
Error

d:\openservers project\sources\trunk.r3777.r19\sources\game.cpp||in member function 'bool game::playermoveitem(uint32_t, const position&, uint16_t, int16_t, const position&, uint8_t)':|
d:\openservers project\sources\trunk.r3777.r19\sources\game.cpp|1601|error: Suggest parentheses around '&&' within '||'|
d:\openservers project\sources\trunk.r3777.r19\sources\game.cpp|1601|error: Suggest parentheses around '&&' within '||'|
||=== build finished: 2 errors, 0 warnings ===|
Code:
...
	status["inInvBag"] = (Out && !In && !checkToSlot )? 0:(In && !Out || !Out && equip && checkToSlot) ? 1:(In && Out || Out && equip && checkToSlot)?2:3;
...
 
Last edited:
well okay some compilers do that use this line instead
[cpp]
status["inInvBag"] = (Out && !In && !checkToSlot )? 0:((In && !Out) || (!Out && equip && checkToSlot)) ? 1:((In && Out) || (Out && equip && checkToSlot))?2:3;
[/cpp]
 
all this things just for Premium Scrolls?... This is like the p scroll you may not puted out of your purse to the gground only to your depot or bps

- - - Updated - - -

all this things just for Premium Scrolls?... This is like the p scroll you may not puted out of your purse to the gground only to your depot or bps
 
Code:
  CXX    iologindata.o
creatureevent.cpp: In member function âuint32_t CreatureEvent::executeOnMove(Player*, Item*, const Position&, const Position&, Item*, Item*, Item*, Item*, std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> > >)â:
creatureevent.cpp:1933: error: could not convert â((CreatureEvent*)this)->CreatureEvent::<anonymous>.Event::m_scriptDataâ to âboolâ
  CXX    iomap.o
make[1]: *** [creatureevent.o] Error 1
make[1]: *** Se espera a que terminen otras tareas....
game.cpp: In member function âbool Game::playerMoveItem(uint32_t, const Position&, uint16_t, int16_t, const Position&, uint8_t)â:
game.cpp:1373: error: âRET_NOTMOVABLEâ was not declared in this scope
make[1]: *** [game.o] Error 1
make[1]: se sale del directorio `/home/serv/sources_respaldos/sources_r11_dupe_doggynub/sources_r11_dupe'
make: *** [all] Error 2


Did the change of:

Code:
    if(m_scriptData)
                scriptstream << *m_scriptData;
to
Code:
    if(m_scriptData)
                scriptstream << m_scriptData;

And still getting this error.

-----------------------
Then changed

Code:
    if(m_scriptData)
                scriptstream << m_scriptData;
to
Code:
                scriptstream << m_scriptData;


And worked, but now getting this error:


Code:
  CXX    manager.o
game.cpp: In member function âbool Game::playerMoveItem(uint32_t, const Position&, uint16_t, int16_t, const Position&, uint8_t)â:
game.cpp:1373: error: âRET_NOTMOVABLEâ was not declared in this scope
make[1]: *** [game.o] Error 1
make[1]: *** Se espera a que terminen otras tareas....
 
game.cpp

Code:
    if(!player->hasCustomFlag(PlayerCustomFlag_CanPushAllItems) && (!item->isPushable() || (item->isLoadedFromMap() && 
        (item->getUniqueId() != 0 || (item->getActionId() != 0 && item->getContainer())))))
    {
        player->sendCancelMessage(RET_NOTMOV[COLOR=#ff0000]E[/COLOR]ABLE);
        return false;
    }
 
No Script yet... Since I can't understand how to check ALL movements, it just check status on mov, but I need to check all movements :S
 
this checks all move lol... and the status is just giving info on the move event that occured

for the script you need ( i used addEvent because no way to get time in milliseconds)
Lua:
local storage = "exhaust_move_storage"
local exhause_time = 500		-- in milli seconds
local function doExhaust(cid)
	setPlayerStorageValue(cid,storage,1)
	addEvent(setPlayerStorageValue,exhause_time,cid,storage,0)
end
function onMoveItem(cid, item, formPosition, toPosition, fromItem, toItem, fromGround, toGround, status)
	if getPlayerStorageValue(cid,storage) == 1 then
		return false -- cant move exhausted
	end
	doExhaust(cid)
	return true
end
 
Last edited:
Will this script(example) work with all move made?

Lua:
function onMoveItem(cid, item, formPosition, toPosition, fromItem, toItem, fromGround, toGround, status)
        if getplayerstorage ==1 then
                doPlayerSendCancel(cid,"EXAUSTED.")
        else
                doplayeraddstorage
end
 
Will this script(example) work with all move made?

Lua:
function onMoveItem(cid, item, formPosition, toPosition, fromItem, toItem, fromGround, toGround, status)
        if getplayerstorage ==1 then
                doPlayerSendCancel(cid,"EXAUSTED.")
        else
                doplayeraddstorage
end

Just once, but then you wouldn't be able to move items again, since the exhausted doesn't end.

- - - Updated - - -

this checks all move lol... and the status is just giving info on the move event that occured

for the script you need ( i used addEvent because no way to get time in milliseconds)
Lua:
local storage = "exhaust_move_storage"
local exhause_time = 500        -- in milli seconds
local function doExhaust(cid)
    setPlayerStorageValue(cid,storage,1)
    addEvent(setPlayerStorageValue,exhause_time,cid,storage,0)
end
function onMoveItem(cid, item, formPosition, toPosition, fromItem, toItem, fromGround, toGround, status)
    if getPlayerStorageValue(cid,storage) == 1 then
        return false -- cant move exhausted
    end
    doExhaust(cid)
    return true
end

This is a movement script or this should go on creaturescripts? And how should we register it?
 
Lol, this is the creaturescript that uses the c++ code you just added to your server so yes it is creaturescript and you register it like i is shown in first page in one of the posts or like any other creaturescript!!
 
Back
Top