• 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

Doggynub, can you tell us which the best way to do this to all movements? (operational cost)
 
The script above already do that is it hard to realize or what?!!!
 
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!!

I searched around all the topic and no examples on how to register it, just .lua examples or ideas... What is this event? Which type, I mean, for example:

Lua:
<event type="login" name="saveOn" event="script" value="save.lua"/>

type="login", what would this be, "login" too?
 
I guess it would be too hard to just try out "move"
 
I guess it would be too hard to just try out "move"

Code:
[COLOR=#666666][I]//custom move[/I][/COLOR]
	[COLOR=#B1B100]else[/COLOR] [COLOR=#B1B100]if[/COLOR][COLOR=#009900]([/COLOR]tmpStr [COLOR=#339933]==[/COLOR] [COLOR=#FF0000]"move"[/COLOR][COLOR=#009900])[/COLOR]		m_type [COLOR=#339933]=[/COLOR] CREATURE_EVENT_ONMOVE[COLOR=#339933];[/COLOR]	[COLOR=#666666][I]//
Totally right, didn't realized that the code was easy to read xD[/I][/COLOR]
 
Awesome!
 
Last edited:
This error i got when i compile at linux
game.cpp:1520: warning: suggest parentheses around '&&' within '||'
game.cpp:1520: warning: suggest parentheses around '&&' within '||'

status["inInvBag"] = (Out && !In && !checkToSlot )? 0:(In && !Out || !Out && equip && checkToSlot) ? 1:(In && Out || Out && equip && checkToSlot)?2:3;
 
Please link me also i found a glitch, if you have Ex. Magic Sword unquie item, then if you see a mace on the ground, you can replace the magic sword on your hand with the mace on the ground. It will work, it wont say "You cant drop unquie items etc.."

Please fix :)
 
Lol, this is your lua script that don't work correct not the c++ code.
 
But i used the script which you posted :eek:

Lua:
--$$ Undropable Items $$--
local items = {2222} -- item ids that is undropable
 
--[[ Script]]--
function searchContainers(uid,itemss)
	local items = itemss
	local containers = {}
	local check = false
	for i = 0, getContainerSize(uid)-1 do
		local item = getContainerItem(uid,i)
		if not isContainer(item.uid) then
			if isInArray(items,item.itemid) then
				check = true
			end
		else
			table.insert(containers,item.uid)
		end
	end
	for _, container in ipairs(containers) do
		if searchContainers(container,items) then
			check = true
			break
		end
	end
	return check
end	
function onMoveItem(cid, item, formPosition, toPosition, fromItem, toItem, fromGround, toGround, status)
	if status.inInv == 1 and status.inInvBag == 3 and status.inDepot == 3 and isInArray(items,getPlayerSlotItem(cid,status.slot).itemid ) then
		doPlayerSendCancel(cid,"You can't drop a special item on the ground.")
		doSendMagicEffect(getThingPos(cid),2)
		return false
	end
 
	if (status.inInv == 0 and status.inInvBag == 3 and status.inDepot == 3) or 
		(status.inDepot == 0 and status.inInv == 3 and status.inInvBag == 3 ) or
		(status.inInvBag == 0 and status.inDepot == 3 and status.inInv == 3) then
 
		if not isContainer(item.uid) then
			if isInArray(items,item.itemid) then
				doPlayerSendCancel(cid,"You can't drop a special item on the ground.")
				doSendMagicEffect(getThingPos(cid),2)
				return false
			end
		else
			if searchContainers(item.uid,items) then
				doPlayerSendCancel(cid,"You can't throw this bag that contains special item[s] on ground")
				doSendMagicEffect(getThingPos(cid),2)
				return false
			end
		end
	end
 
	return true
end
 
This script shouldn't allow a move like that unless you have made something wrong with it.
 
How can I save this house?
Player who is moving item can or not be owner of this house.
Lua:
function onMoveItem(cid, item, formPosition, toPosition, fromItem, toItem, fromGround, toGround, status)
	if (getTileInfo(fromPosition).house) then
		--doSaveHouse({getHouseByPlayerGUID(getPlayerGUID(cid))}) It will save the house of player who is moving item no matter if he is inside of his house of anyone else
		--doSaveHouse({getTileInfo(fromPosition).house)}) Will it work??
		--doSaveHouse({getHouseByPlayerGUID(getTileInfo(fromPosition).house)}) Will it work??
	end
	return true
end

Error here (if (getTileInfo(fromPosition).house) then), print:
View attachment 17837
 
Last edited:
What about it?

How can I save this house?
Player who is moving item can or not be owner of this house.
Lua:
function onMoveItem(cid, item, formPosition, toPosition, fromItem, toItem, fromGround, toGround, status)
	if (getTileInfo(fromPosition).house) then
		--doSaveHouse({getHouseByPlayerGUID(getPlayerGUID(cid))}) It will save the house of player who is moving item no matter if he is inside of his house of anyone else
		--doSaveHouse({getTileInfo(fromPosition).house)}) Will it work??
		--doSaveHouse({getHouseByPlayerGUID(getTileInfo(fromPosition).house)}) Will it work??
	end
	return true
end

Error here (if (getTileInfo(fromPosition).house) then), print:
View attachment 17837
 
Last edited:

Similar threads

Replies
7
Views
938
Back
Top