Trigger of the Day - Disallow Dropping Keys in Houses

Login to reply  Page: « < 1 of 1 > »
05 Apr 2010 - 17:522451
Trigger of the Day - Disallow Dropping Keys in Houses
Sometimes it can be problematic if a key is maxload 1 and is being stored in a house. To prevent this situation, I came up with an easy little script to stop this from happening. Just attach it to the house (or any room you don't want keys dropped in).

Name: '[R:VARIOUS] Disallow Storing Keys in Houses'
Trigger Intended Assignment: Rooms
Trigger Type: Drop , Numeric Arg: 100, Arg list: None
Commands:
if %object.type% == KEY
  %send% %actor% The storing of keys in houses is not allowed.
  return 0
end
if %object.type% == CONTAINER
  eval i %object.contents%
  while %i%
    set next %i.next_in_list%
    if %i.type% == KEY
      %send% %actor% You may not drop containers here while there is a key inside.
      return 0
    end
    set i %next%
  done
end


05 Apr 2010 - 18:452452
Nice, though I recommend to ensure keys load more than one instance since key storage in a house is no different from a character always idling with keys to hoard them. Single instance keys are a bad idea since if a player dies behind a door with the only key in their corpse they have no way to get back. Also, keys should always be the first dependent object loaded to a mob so they don't rely on other equipment loading to the mob prior to it.


__________________
Rumble
The Builder Academy
tbamud.com 9091
06 Apr 2010 - 04:222455
eval i %object.contents%

should be

set i %object.contents%

both work, but the latter is more cpu efficient.


__________________
Login to reply  Page: « < 1 of 1 > »