Secret Door script...no clickable objects
required
(sorry for posting in the scripting questions as well...I kept clicking 'new
post'...dang caffeine jitters).
I noticed most people were going with object conversation and clickable
objects. For my purposes, I wanted a more generic approach that didn't
require an obvious trigger, allowed global party knowledge (to prevent the
need for every player to find it), and a MapPin indicator. So I went with a
Generic Trigger type that ran the following script on the 'on Enter' event (ie.
someone walks over the Trigger area):
NWScript: int secret_crypt_party_flag=0;
void main()
{
int difficulty = 20;
object oPlayer = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,
PLAYER_CHAR_IS _PC,OBJECT_SELF,1);
int search_score = GetSkillRank(SKILL_SEARCH, oPlayer);
if ( (d20(1)+search_score > 20)||GetLocalInt(GetModule(),"secret_crypt_party_flag") )
{
SetMapPinEnabled(GetObjectByTag("NW_SD_CRYPT",0),1);
SetLocalInt(GetModule(),"secret_crypt_party_flag",1);
ActionStartConversation(oPlayer,"crypt_sd",TRUE);
}
}
1) the 'difficulty' is the DC for a search/spot (I just picked 'search').
2) the oPlayer is the closest creature (ie. the creature that walked into
the Generic Trigger floor area)
3) search_score is the 'search roll'
4) the 'secret_crypt_party_flag' is used to 'spread the knowledge' to the
other members of the party so they no longer have to search to find it.
5) The SetMapPin turns on the MapPin for a Waypoint I stuck on the secret
door Generic Trigger Area. The ActionStartConversation calls a 'take secret
door?' conversation called "crypt_sd" and keeps it Private (ie. TRUE...only
the player who found the secret door has the conversation). Only 2 choices
in the conversation: 1. take it 2. dont take it. In theory, you could add a
'notify party' option if you want to set the global flag to let everyone
share the wealth.
If the player takes the secret door in the conversation, the following
script is called:
NWScript: void main()
{
object oPlayer = GetPCSpeaker();
object oTargetArea = GetObjectByTag("NW_CRYPT_START",0);
AssignCommand(oPlayer,ActionJumpToLocation(GetLocation(oTargetArea)));
}
this results in the teleporting of the speaking character to a Waypoint in
my Crypt Area called NW_CRYPT_START.
=====================================
This seems to satisfy a few requests for a generic secret door method (Area
transition waypoints create an arch on the cursor, Trap transition areas
wind up saying 'Trap Triggered' over the players head who walks near the
secret door :/ ).
===========================
Hope this proves useful for someone...great learning experience for me ;P
|