Fizban's Treasure Chest Trigger

  • Liko
  • Liko's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
9 years 5 months ago #107 by Liko
Fizban's Treasure Chest Trigger was created by Liko
Hello,

Awhile ago Fizban wrote an excellent treasure chest trigger script that would allow the player to only open the chest once. I'm going to post it here, as I feel it should be shared. All credit goes to Fizban.
#101
Chest - Open Once Per Player (Object 102)~
1 c 4
o~
set tcmd 'open
if %tcmd.contains('%cmd%)%
  set argu 'chest 'treasure
  if %argu.contains('%arg%)%
    if %actor.varexists(opened_chest_102)%
      %send% %actor% You have already looted the contents of this chest, there is no longer anything here for you.
    else
      if %self.contents.vnum% == 101
        set opened_chest_102 1
        remote opened_chest_102 %actor.id%
        return 0
      else
        %send% %actor% This container is empty, perhaps you should check its contents again at a later time.
      end
    end
  else
    return 0
  end
else
  return 0
end
~

Randian(0.0.0)
Owner/Developer
The following user(s) said Thank You: Parnassus

Please Log in or Create an account to join the conversation.

More
7 years 5 months ago #4922 by Parnassus
Replied by Parnassus on topic Fizban's Treasure Chest Trigger
I don't know how I missed this one before! This one is going right to the top of my favourite trigger examples.

This is the best example I've seen of Fizban's .contains format, mentioned in
www.tbamud.com/forum/2-general/1674-trig...command-example#1933
and
www.tbamud.com/forum/4-development/1678-...r-help-pls-look#1952

It is also a great use of remotes.

As far as I can see (and as to be expected in one of Fizban's triggers) the ifs seem to hold no loopholes. If the player has previous opened the chest, don't let allow the chest to be opened. If not, let the chest be opened. Does the chest have treasure inside? If yes, attach a note to the player's file so that this player can't open the chest in the future. Don't attach the note if the treasure has already been taken by someone else.

Thanks to Liko, for posting it (wow, almost two years ago!) and to Fizban for writing it.

Please Log in or Create an account to join the conversation.

Time to create page: 0.081 seconds