pukey brunster on 10/7/2016 at 16:56
How do I get an object to play a different schema when unlocking? I tried adding a new Schema / Class Tags to be what I wanted, but it's still playing the standard lockbox schema.
LarryG on 10/7/2016 at 19:57
I will assume that you remembered to rebuild your schemas. So let's go through the steps for this.
1. Start with the archetype. What does it have on it that makes the lock sounds?
* scripts: it has a script called "LockSounds". That seems promising.
* Schema>Class Tags: DeviceType Lockbox
2. Just to be sure of things, let's review the documentation for LockSounds:
[INDENT]LockSounds
gen.osm 1/G/2
Plays an environmental schema when the lock state changes. On NowLocked, the event tags Event StateChange, LockState Locked are used. On NowUnlocked, the tags are Event StateChange, LockState Unlocked. If the object had recently received the PlayerToolFrob message, then the tag CreatureType Player is added to the list. On FrobWorldEnd, the tags Event Reject, Operation FrobLock is played. When the object receives WrongKey, it plays the tags Event Reject, Operation KeyFit, but without considering whether it was frobbed by the player.[/INDENT]
3. OK. Now let's look at the schemas and related definitions associated with DeviceType Lockbox. Interestingly, the only schema I found explicitly associated with a DeviceType Lockbox is in DOORS.SCH:
[INDENT]//DOOR LOCKS OR IS LOCKED
schema locked
archetype DEVICE_MISC
// was no volume
volume -100
locked
env_tag (Event StateChange) (LockState Locked)
env_tag (Event Reject) (Operation OpenDoor)
env_tag (Event Reject) (Operation FrobLock) (DeviceType Lockbox)[/INDENT]
What this means is that the only sound that is made which is defined as specific to a DeviceType Lockbox happens when the lockbox is frobbed, whether by the wrong key or by hand, and that the sound is common to the sound made by doors under similar circumstances. There are no other special sets of sounds for a lockbox. If that's what you want then you will need a new devicetype (to differentiate your special lockbox from normal lockboxes) and a set of schemas which react to each operation that the script LockSounds supports.
4. Define a new DeviceType in ENVSOUND.SPC. Suppose you want your new DeviceType to be "LockBoxB". Then find the definition of the tag DeviceType and add LockBoxB to the end. This is necessary to allow recognition of the new LockBoxB keyword when you reference it in your schemas. Note: capitalization probably matters. That is, lockboxb is not the same tag as LockboxB is not the same tag as LockBoxB. However you type it in the DeviceType tag line is how you must type it in the schemas and in the archetype when you reference it via Schema>Class Tags.
[INDENT]
tag DeviceType GenPotion TimedPotion HolyH20 BlueLight CauldLvr MoldLvr CrunchyFood SoftFood Piano Whistle LitFlare PowderKeg Lockbox Banner LockBoxB[/INDENT]
5. Now decide, which of the events that LockSounds recognizes do you want special sounds for? Your choices are limited to four events.
Event StateChange, LockState Locked
Event StateChange LockState Unlocked
Event Reject, Operation FrobLock
Event Reject, Operation KeyFit
I'm pretty sure that if you add CreatureType Player to the first three events (or maybe only the first two) listed above that you can also have player specific versions of the first three (two) events. The script doc specifies that the KeyFit event doesn't check for CreatureType Player. It is not clear to me if FrobLock checks for Player.
Note that lock picking sounds are NOT specific to what is being picked, but are hardwired to specific schema names. Lock picking will always sound the same no matter what you are picking.
6. Let's assume that you want special sounds for all four events covered by LockSounds, but don't want any special sounds unique to the Player. So you will want to define four new schemas, one for each event. Model your new schemas after what is already in DOORS.SCH:
[INDENT]//DOOR UNLOCKS
schema unlocked
archetype DEVICE_MISC
unlocked
env_tag (Event StateChange) (LockState Unlocked)
//DOOR LOCKS OR IS LOCKED
schema locked
archetype DEVICE_MISC
// was no volume
volume -100
locked
env_tag (Event StateChange) (LockState Locked)
env_tag (Event Reject) (Operation OpenDoor)
env_tag (Event Reject) (Operation FrobLock) (DeviceType Lockbox)
//YOU GOT THE WRONG KEY
schema wrongkey
archetype DEVICE_MISC
volume -500
wrongkey
env_tag (Event Reject) (Operation KeyFit)[/INDENT]
Note that LockState Unlocked is device independent, as are LockState Locked and Operation KeyFit. Also note that the same sound is associated with LockState Locked and Operation FrobLock for DeviceType Lockbox. We'll be splitting that last up for DeviceType LockBoxB.
The following are new schemas which you can add to DOORS.SCH:
[INDENT]//LOCKBOXB UNLOCKS
schema unlockedB
archetype DEVICE_MISC
unlockedB
env_tag (Event StateChange) (LockState Unlocked) (DeviceType LockBoxB)
//LOCKBOXB LOCKS
schema locksB
archetype DEVICE_MISC
// was no volume
volume -100
locksB
env_tag (Event StateChange) (LockState Locked) (DeviceType LockBoxB)
//LOCKBOXB IS LOCKED
schema lockedB
archetype DEVICE_MISC
// was no volume
volume -100
lockedB
env_tag (Event Reject) (Operation FrobLock) (DeviceType LockBoxB)
//YOU GOT THE WRONG KEY FOR LOCKBOXB
schema wrongkeyB
archetype DEVICE_MISC
volume -500
wrongkeyB
env_tag (Event Reject) (Operation KeyFit) (DeviceType LockBoxB)[/INDENT]
That covers everything that LockSounds pays attention to (excepting Player only sounds).
7. Now create a child archetype under Physical>Locks>Lockboxes for your LockBoxB and be sure to make the Schema>Class Tags: DeviceType LockBoxB.
8. Rebuild your schemas and check monolog for errors.
9. Save your gamesys if you aren't using cows and hook it up to your mis.
NOTE TO EVERYONE REQUESTING HELP: It is much easier to help if you post all the information and not just a vague description. If, in the above request by pukey brunster, the new schemas and class tag definitions had been posted as well as the new archetype information, it would have been possible to provide a specific "you messed up here" type of response. Without that, you are likely to get something very general and probably not useful (if you get any responses at all). As it happened, I was intrigued by the question and spent a fair amount of my own time figuring it out and posting what I believe to be the solution. Normally I would just ignore such a poorly described request.
pukey brunster on 10/7/2016 at 20:31
Wow.. huge thank you for taking the time for this detailed description! Really appreciate it :)
I will try to be more detailed though in requests.. sorry about that. Although I have a lot of fun with Dromed.. I am truly a noob and forget sometimes ;)
I'll work through this info & let you know what I have come up with.