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

Feature Creaturescript: onMoveItem(moveItem, frompos, position, cid)

Mock, you can't do either of these:

Mock said:
if frompos == {x=100,y=100,z=100} then
because frompos return a stackpos, so you have to do it:
if frompos == {x=100,y=100,z=100,stackpos=255} then

You can't compare positions that way... You have to do "if frompos.x == 100 and frompos.y == 100 and frompos.z == 7 then"
 
@Colandus
in lua i cannot compare tables? o0

No it will only compare the table index...

For example:
Lua:
local t1 = {x=4, y=5}
local t2 = {x=4, y=5}
local t3 = t2

if(t1 == t2) then -- false

end

if(t2 == t3) then -- true because they are same

end

you need to compare each value of the table each..... t1.x == t2.x and t1.y == t2.y
 
...

PHP:
117 creatureevent.cpp 'CREATURE_EVENT_MOVEITEM' was not declared in this scope 
117 creatureevent.cpp In member function 'virtual bool CreatureEvent::configureEvent(xmlNode*)': 
214 creatureevent.cpp 'CREATURE_EVENT_MOVEITEM' was not declared in this scope 
214 creatureevent.cpp In member function 'virtual std::string CreatureEvent::getScriptEventName() const': 
285 creatureevent.cpp 'CREATURE_EVENT_MOVEITEM' was not declared in this scope 
285 creatureevent.cpp In member function 'virtual std::string CreatureEvent::getScriptEventParams() const': 
345 creatureevent.cpp 'CREATURE_EVENT_MOVEITEM' was not declared in this scope 
345 creatureevent.cpp *** [obj-console//creatureevent.o] Error 1

mock, edit your topic and add this:

after
PHP:
CREATURE_EVENT_DEATH,
PHP:
CREATURE_EVENT_MOVEITEM,
 
Isn't there already the functin onAddItem()?

I used this function on TFS0.3.5pl1 for one of my projects, it worked liked yours.

Or is there a major difference I'm overlooking here?
 
Yes, onAddItem cannot stop items from moving. This one allows you to prevent movement (by returning false) and e.g. add cancel message "You cannot move this item."
 
Why not setting an UniqueID on the item then?
Lua:
doCreateItem(setItemAttribute(item.uid, "uid", XXX)

this will prevent it also, allthough without return false in a function.
Or do I miss something again? xD
 
It does not prevent it... Putting uid on a firesword will not make it unmovable.
 
How to check if item is holding in Player bp??

In function onaction work frompos.x == 656366 (or something like this number), but here it not work.
Who can help me??
 
Down to 7 errors :) I appreciate the help so far a lot

Code:
../creatureevent.cpp: In member function 'uint32_t CreatureEvents::executeMoveItems(Creature*, Item*, const Position&, const Position&)':
../creatureevent.cpp:115: error: conversion from 'CreatureEventList' to non-scalar type 'std::vector<CreatureEvent*, std::allocator<CreatureEvent*> >' requested

../creatureevent.cpp: In member function 'uint32_t CreatureEvent::executeMoveItem(Creature*, Item*, const Position&, const Position&)':
../creatureevent.cpp:461: error: 'LuaScriptInterface' has not been declared

../creatureevent.cpp:462: error: 'LuaScriptInterface' has not been declared

../creatureevent.cpp:463: error: 'LuaScriptInterface' has not been declared

mingw32-make: *** [obj//creatureevent.o] Error 1

Execution terminated

Bump? I'd like to use this

Bump, has this ever been tested on 0.4?
 
Thanks a lot. This code work to tfs 0.3.5.

Only:
function onMoveItem(moveItem, frompos, position, cid)
if moveitem.itemid == 6500 then
doPlayerSendTextMessage(cid,25,'This item is blocked! you cannot move it!')
return false
end
end
Doesn`t work must been

function onMoveItem(moveItem, frompos, position, cid)
if moveItem.itemid == 1988 then
doPlayerSendTextMessage(cid,25,'This item is blocked! you cannot move it!')
return false
end
return true
end



#Edit
This scripts crash client tibia.
 
Last edited:
i dont know why but i put him on my ot and now always when a player try to login my server crash
what can be?
I am using TFS 0.3.6 pl1
 
Mock, Onde Ponho a tag, e como? :$
Where I put the Tag and how? :$


--

Sorry my Bad English
 
In 0.3.6pl1

When I search 'bool CreatureEvents::playerLogout(Player* player, bool forceLogout)' it can't find it :s (creatureevent.cpp) right?
 
just find where these functions are located and paste code somewhere in that area, the exact place is in tutorials just to prevent misunderstanding
 
Back
Top