Code for open and close cloaks

For builders to discuss and ask building questions.
Post Reply
User avatar
Gwain
Sword Grand Master
Sword Grand Master
Posts: 2354
Joined: Tue Nov 01, 2005 9:25 pm
Location: Waterdeep

Code for open and close cloaks

Post by Gwain » Sun Aug 21, 2011 11:46 pm

There are a few items in the game that can change into other items, I'd like to use this for cloaks, but I need the code to do so, So a cloak that you can wear with a transparent flag then with the typing of a command becomes a cloak without that flag, what would the fully coded item look like? Thank you.
Justice is not neccesarily honourable, it is a tolerable business, in essence you tolerate honour until it impedes justice, then you do what is right.

Spelling is not necessarily correct :)
User avatar
Harroghty
Staff
Staff
Posts: 9695
Joined: Tue Jul 27, 2004 5:38 pm

Re: Code for open and close cloaks

Post by Harroghty » Mon Aug 22, 2011 1:42 am

If you want the cloak to change it while it is worn then you would do this:

Code: Select all

>intercept_prog opencloak~
if actorhasobjnum(OBJVNUMHERE)
  if wear_loc($o) != -1
    mpechoat $n {80}You open your cloak.
    mpechoaround $n {80}@N opens $s cloak.
    mposet $o flags transparent 
  else
    mpunintercept
  endif
else
  mpunintercept
endif
~
The same command (mposet $o flags transparent) should remove the flag from the item.
"A man may die yet still endure if his work enters the greater work, for time is carried upon a current of forgotten deeds, and events of great moment are but the culmination of a single carefully placed thought." - Chime of Eons
User avatar
Gwain
Sword Grand Master
Sword Grand Master
Posts: 2354
Joined: Tue Nov 01, 2005 9:25 pm
Location: Waterdeep

Re: Code for open and close cloaks

Post by Gwain » Mon Aug 22, 2011 1:43 am

Excellent, thank you *fans cloak*
Justice is not neccesarily honourable, it is a tolerable business, in essence you tolerate honour until it impedes justice, then you do what is right.

Spelling is not necessarily correct :)
Post Reply