DMH-Online

Dungeon Masters Helper · Est. 2005

Misc Scripts

NWN Script: mod_intro_003.htm

Author Sticky: Post Working Scripts Here
Novanus Posted: Thursday, 27 June 04:28AM
Script: Give player a "Readme"

This script is designed for multiplayer games. When a new player connects to your server, they will be given an item describing your rules or any other special information you want them to have.

To use, simply put the script in the Module's "OnClientEnter" event. Make a custom item (such as a letter or book) with the TAG that matches the one in the script (default is "Readme"). Edit the "identified text" for that item to be the information you want the player to have when they Examine the item. The script also checks to see if the player already has the item. If they do, it doesn't give it to them again.

Also included is a support function IsInInventory which returns TRUE or FALSE, depending on whether it finds the specified item in the inventory of the supplied PC, NPC, chest, etc.

NWScript:
//::///////////////////////////////////////////////
//:: Name Give Readme
//:: FileName GiveReadme.txt
//:://////////////////////////////////////////////
/*
     This script is designed to be placed in the OnClientEnter
     event of your module, which can be found under Edit ->
     Module properties -> Events.
     This script will give a player an item with the TAG "Readme",
     if that player doesn't already have it.  You should create
     a custom item (in my case, I used the Miscellaneous-Medium
     item that looked like a sealed letter), and give it the TAG
     of "Readme".  Then, for "identified text" in the item
     properties put information on your game server or module.
     For example, you could list your rules of conduct, special
     house rules you are running, and other bits of information
     new players to your server/module should know.  When the
     player examines the item (like the books in the Bioware
     campaign), they will see the text you wrote.
     To be sure that your document is unique to your server, use
     a custom TAG and change the instances of "Readme" in the
     script to your new unique TAG.  Also, note that you can change
     the NAME of your item to anything you want, just make sure
     the TAG is the same as is used in the script.  You can also
     change the line of text the server says to the player
     telling them they should examine the item.  If your item
     was a book, then you would tell them to examine the book
     and not a letter, as I have it now.
     Also included is one support function "IsInInventory" which
     is used to determine if an item exists in an object's
     inventory (PC, NPC, chest, etc).
*/
//:://////////////////////////////////////////////
//:: Created By: Ped Xing (pedx1ng@lycos.com)
//:: Created On: 26 June, 2002
//:://////////////////////////////////////////////

// This function determines if a specific item exists in the
// specfified container, which can be a creature or placeable
// object that is a container.
int IsInInventory(object oContainer, string sItemTag)
{
object oItem;
if (GetHasInventory(oContainer))
{
    oItem = GetFirstItemInInventory(oContainer);
    while ( OBJECT_INVALID != oItem )
    {
        if (GetTag(oItem) == sItemTag)
        { return TRUE; }
        oItem = GetNextItemInInventory(oContainer);
    } // end while
} // endif
return FALSE;
} // end IsInInventory

// Main code block
void main()
{
object oPC = GetEnteringObject();
if (GetIsPC(oPC))
{
    if (IsInInventory(oPC,"Readme") == FALSE)
    {
        CreateItemOnObject("Readme",oPC);
        SendMessageToPC(oPC,"You have been given a letter describing the rules of this server - Please examine it.");
    }
}
} // end main
⌂ All Scripts ← PreviousNext → 👁 Category List

All Misc Scripts

📄 arena 📄 cast_bless_on_PC 📄 change_music 📄 chess_game 📄 climbing 📄 climbing_002 📄 common_includes_002 📄 cone_aoe 📄 cron 📄 cross_country_travel 📄 daoc_style_graves 📄 determine_time 📄 effects 📄 escort 📄 ez_respawn 📄 faction 📄 floating_text 📄 function_includes 📄 gambling 📄 include_sounds 📄 include_time_date 📄 jail 📄 jail_system 📄 journal_entry 📄 logbook 📄 manage_action_queue 📄 mmorpg_vault 📄 mod_intro 📄 mod_intro_002 📄 mod_intro_003 📄 mod_intro_005 📄 pers_world_database 📄 pers_world_database_002 📄 piller_of_fire 📄 plot_item 📄 portal_system 📄 portal_system_002 📄 puking 📄 quest_escort 📄 rep_per 📄 reward_rp 📄 rotation 📄 save_pc_location_002 📄 save_pc_location_003 📄 skill_checks 📄 skill_checks_002 📄 slot_machine 📄 story 📄 swimming 📄 take20_bypass 📄 vis_waypoint 📄 working_temple 📄 working_temple_002 📄 xp_gold_loss 📄 xp_gold_loss_002 📄 xp_loss_action