This is from the T2A Demo Server and is what happens after a player target something to steal.
1. Check that the target is something or exit the trigger.
2. Check if the target is alive and if it is dead, exit the trigger.
3. Check distance to the object by count tiles from the thief and the container/item. If it over 1 tile it will say "You must be standing..." and exit.
Later in the script we have calculations of weight.
1. Get the weight of the object we are trying to steal.
2. Check if over 10 stones, if it is write "This item is too Heavy.." and exit.
(it also check that it is at least 1 item in the stack here or the same "too Heavy" message is sent)
Another thing I didnt know before I looked into the script was that it is three times bigger chance to get catched if a single item is targeted vs a random thing from a bag/box.
-Grim
1. Check that the target is something or exit the trigger.
2. Check if the target is alive and if it is dead, exit the trigger.
3. Check distance to the object by count tiles from the thief and the container/item. If it over 1 tile it will say "You must be standing..." and exit.
Code:
TRIGGER( oortargetobj )(obj user, obj usedon)
{
if(usedon == NULL())
{
return(false);
}
if(isDead(this))
{
return(false);
}
obj Q63P = getTopmostContainer(usedon);
int Q5F2 = getDistanceInTiles(getLocation(usedon), getLocation(this));
if(getDistanceInTiles(getLocation(usedon), getLocation(this)) > 0x01)
{
systemMessage(this, "You must be standing next to an item to steal it.");
return(false);
}
...
Later in the script we have calculations of weight.
1. Get the weight of the object we are trying to steal.
2. Check if over 10 stones, if it is write "This item is too Heavy.." and exit.
(it also check that it is at least 1 item in the stack here or the same "too Heavy" message is sent)
Code:
...
int Q68B = getWeight(usedon);
int quantity = getQuantity(usedon);
if((Q68B > 0x0A) && (quantity <= 0x01) && (owner != NULL()))
{
systemMessage(this, "This item is too heavy to steal from someone's backpack.");
return(false);
}
...
Another thing I didnt know before I looked into the script was that it is three times bigger chance to get catched if a single item is targeted vs a random thing from a bag/box.
-Grim