It is definitely possible to make the secret doors class restricted, but will require some script editing.
1. If you look at the trigger you have placed for the secret door, there is a script in the OnEnter drop down menu called "x0_o2_sec_tdoor2". Use the Edit button beside it to enter the script attached to the trigger. Before you do anything else, SAVE the script under a new name. If you change anything in the default script it will apply to all future secret doors you make in your module (unless you want that, then by all means don't change a thing).
2. Replace the default script by this:
//:://////////////////////////////////////////////////
//:: X0_O2_SEC_TDOOR2
//:: This is an OnEntered script for a generic trigger.
//:: When a PC enters the trigger area, it will perform
//:: a check to determine if the secret item is revealed,
//:: then make it appear if so.
//::
//:: Secret item to be revealed: Secret Stone Trap Door
//:: Checking for: SKILL_SEARCH
//::
//:: Copyright © 2002 Floodgate Entertainment
//:: Created By: Naomi Novik
//:: Created On: 12/08/2002
//:://////////////////////////////////////////////////
#include "x0_i0_secret"
void main()
{
object oEntered = GetEnteringObject();
if (GetIsSecretItemRevealed()) {return;}
// * This checks oEntered to see whether they are of the correct class
if (GetclassByPosition(1, oEntered) == class_TYPE_* | GetclassByPosition(2, oEntered) == class_TYPE_*
| GetclassByPosition(3, oEntered) == class_TYPE_*)
{
if ( DetectSecretItem(oEntered)) {
if (!GetIsPC(oEntered)) {
// If a henchman, alert the PC if we make the detect check
object oMaster = GetMaster(oEntered);
if (GetIsObjectValid(oMaster)
&& oEntered == GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oMaster))
{
AssignCommand(oEntered, PlayVoiceChat(VOICE_CHAT_SEARCH));
}
} else {
// It's a PC, reveal the item
AssignCommand(oEntered, PlayVoiceChat(VOICE_CHAT_LOOKHERE));
RevealSecretItem("x0_sec_tdoor2");
}
}
}
}
3. Replace every class_TYPE_* in the script (there are only 3) with the class type of your choice. You can find the class type choices in the Constants tab in the Script Editor (you can find them easier by typing class_type in the search option). Remember to replace ALL 3 of the class_TYPE_* options with THE SAME class option (this checks all three of oEntered's class positions, in case they decided to multi-class).
4. As you probably guessed from the above, this will only check for one kind of class. If you want to check for more, you will need edit the if() statement containing the GetclassByPosition() functions. All you have to do is place a | (that's a bar found on the right of your keyboard, not the capital letter i) after the last GetclassByPosition() statement, then copy all of the GetclassByPosition() functions I've written for you, and paste them after the |. Then, change the class_TYPE_ constant to whatever new class type you want. Repeat ad nauseum until you've covered all the classes you want to check for.
5. Enjoy the fruits of your labour!
Modifié par Ralthis, 18 mai 2011 - 02:30 .