x0_i0_secret
Library for secret/hidden items.These use a trigger instead of an invisible item with an OnHeartbeat. This method is considerably less CPU-intensive and more flexible in determining the shape of the area in which the secret item can be detected. The trade-off is that you have to create one additional waypoint to specify where the item should appear.
Process:
- Create a trigger marking off the area where the secret item can be detected. There are several varieties already pre-created in the blueprints for different items.
- Edit the properties of the trigger as follows:
o Set the tag to something unique;
o On the "Scripts" tab, for "On Enter", pick "x0_o2_sec_
o On the "Advanced" tab, put an integer into the "Key Tag" field: this will be the DC for detection;
- Create a waypoint named "LOC_
- If you are creating a secret transport object like a door or portal, create a waypoint named "DST_
- Both the secret item and the detection trigger will be sent a user-defined event with the value EVENT_SECRET_REVEALED. To cause a reset, you can simply choose the 'x0_o2_sec_reset' script as the user-defined event handler for the detection trigger, or you can put something else in if you want to do something fancy.
- You can get a reference to the revealed secret item by using "GetSecretItemRevealed(
NOTE: This file includes x0_i0_common.
Constants
Name | Value | Brief Description | EVENT_SECRET_REVEALED | 2801 | User-defined event that the item generates when found (can be used to cause a reset) -- this goes to both the item itself and to the detection trigger. | sDestinationPrefix | DST_ | Prefix for the waypoint marking the destination of a secret door. | sDetectTriggerVarname | SECRET_TRIGGER | Variable that holds the detection trigger of this secret item. | sFoundPrefix | FOUND_ | Prefix on player to indicate whether they have found this item before. If they have, don't make them search again. | sLocationPrefix | LOC_ | Prefix for the waypoint marking where the secret item should appear. | sOpenVarname | IS_OPEN | Variable that indicates whether this item is open/closed. | sRevealedVarname | IS_REVEALED | Variable that indicates whether this item is revealed or not. | sSecretItemVarname | SECRET_ITEM | Variable that holds the tag of the item this detection item reveals. |
---|
Functions
Name | Brief Description |
---|---|
DetectSecretItem | Detection function for a secret item. Uses the specified skill (defaults to SKILL_SEARCH; use any of the SKILL_ constants here) and uses the key tag of the trigger as the DC of the detection check. |
DetectSecretItemByClass | Detection function that reveals an item only to members of the specified class. Compares the PC's level in the class plus a small modifier against the value of the key tag of the trigger. |
GetIsSecretItemOpen | Returns whether the secret item is currently open. Should be called from the secret item itself after being revealed. |
GetIsSecretItemRevealed | Returns whether the associated secret item is currently revealed. Should be called from the detect trigger, not the item itself. (If you have the item itself, it is definitely revealed!) |
GetSecretItemRevealed | Returns the associated secret item. |
QuickDetectSecret | Internal function. Used to avoid a bit of duplicate code in the Detect... functions. |
ResetSecretItem | Reset function for a secret item. When called, this destroys the item and resets the invisible detection object going again. This WILL cause any treasure and locks/traps on the door to regenerate. |
RevealSecretItem | Reveal function for a secret item. When called, this item creates the secret item from blueprint in the location of the item waypoint. Any item blueprint resref can be used here. Some common items are the ones in the placeables palette listed under "Secret Items". |
SetIsSecretItemOpen | Set whether the secret item is open or not. |
UseSecretTransport | Use a secret transport to transport a PC and associates. |
author: Mistress