Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stealing skill & item weight
#2
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.


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 
Jack and Veranis like this post
Reply


Messages In This Thread
Stealing skill & item weight - by Veranis - 02-01-2016, 11:08 PM
RE: Stealing skill & item weight - by Grimoric - 02-02-2016, 11:29 PM
RE: Stealing skill & item weight - by Jack - 02-24-2016, 12:13 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)