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

Solved 0.3.7 onThrow, check destination of item.

Xikini

I whore myself out for likes
Senator
Joined
Nov 17, 2010
Messages
6,818
Solutions
586
Reaction score
5,387
I know how to check for tile positions..
But what position is the inventory slots?

Like.. check if item is in a players backpack, or if the item is being moved to the arrow/armor slot?
(Not a movements script. Creaturescript 'onThrow'.)

something like..

Code:
function onThrow(cid, item, fromPosition, toPosition)
    if toPosition == const_slot_head then
        return false
    end
    return true
end
I'm fairly sure without trying that const_slot_head is a slotType rather then a position..
I'm a little lost. :p

If anyone has any idea's please throw them my way.

Cheers,

Xikini
 
Last edited:
Checked into it now that I'm home.
Hopefully this helps someone in the future.

using the 'x' position, you can check if the player is moving the item from/to their inventory (somewhere)
to/fromPosition.x
Player's inventory/slots = 65535
Example:
Code:
if fromPosition.x == 65535 then
    print("in inventory")
else
    print("not in inventory:)
end
using the 'y' position, while checking the 'x' position 65535, you can check the slot for the item.
to/fromPosition.y (while to/fromPosition.x == 65535)
head = 1
amulet = 2
container = 3
chest = 4
right hand = 5
left hand = 6
legs = 7
boots = 8
ring = 9
arrow slot = 10
Example:
Code:
if fromPosition.x == 65535 then
    if fromPosition.y == 1 then
        print("moved from head slot")
    else
        print("moved from some other inventory place")
    end
else
    print("item not in inventory")
end
 
@Xikini
i was about to say thats not possible because all containers values are only 65535, never knew Y could return inventory, what about Z? what it returns?
 
@Xikini
i was about to say thats not possible because all containers values are only 65535, never knew Y could return inventory, what about Z? what it returns?
Returns the item slot? position.
It's not really useful.

If it's the player inventory 1->10, then z returns 0
If it's inside a container, and you move the item to the fourth position, z returns 4.
I can't think of a reason why you'd ever need to check it.
stackpos always returns 0 as well. (inside the player inventory)
 
Returns the item slot? position.
It's not really useful.

If it's the player inventory 1->10, then z returns 0
If it's inside a container, and you move the item to the fourth position, z returns 4.
I can't think of a reason why you'd ever need to check it.
stackpos always returns 0 as well. (inside the player inventory)
Have you tested if the item is a stackable item?
Like money or anything with a count, just curious if it returns a stack position.
 
Have you tested if the item is a stackable item?
Like money or anything with a count, just curious if it returns a stack position.
Code:
function onThrow(cid, item, fromPosition, toPosition)
   print(cid)
   print(item.uid)
   print(item.itemid)
   print(item.type)
   print(fromPosition.x, fromPosition.y, fromPosition.z, fromPosition.stackpos, toPosition.x, toPosition.y, toPosition.z, toPosition.stackpos)
   return true
end

100 gold coins, from 1st slot in backpack, to 4th slot in backpack.
Code:
-- cid
268438693

-- item
80132
2148
100

-- fromPosition
65535
64
0
0

-- toPosition
65535
64
4
0
 
Back
Top