DMH-Online

Dungeon Masters Helper · Est. 2005

Items Scripts

NWN Script: stone_of_recall.htm

Author Sticky: Post Working Scripts Here
Miss Marple Posted: Friday, 05 July 07:48PM
Before I begin thanks to Yeldrig Yar for his Stone of Recall script which this is based on.

Name: Stone of Recall System
Function: Creates a Stone of Recall System for any module in a step by step process.

Creating Stone of Recall (Taken from Yeldrig Yar post)

Quote: 
1 - Create your item. Be sure to give it a unique tag name and that you remember that tagname....you'll want that info later. Make it "magical." Edit the properties of the item and click the "Properties" tab.
2 - There, you should see a whole bunch of effects. Go down to "Cast Spell" and click that to open that, then go down to "Unique Power." Decide if it's a power that you will cast on others, or only on the wielder, then double-click the appropriate decision.
3 - When you double-clicked, that added that Unique Power to the right-hand pane of the window. Double-click the power there, to determine how many charges per day it gets.
3 - When done, click OK/Done to get back to the editor


Now you have your item, you need to get it to work. Here's what you do:

1. Go to Edit->Module Properties->Events
2. For the OnActivateItem click Edit.
3. Paste this script and save as StoneRecall01 (or whatever you want)

NWScript:
void main()
{
object oActivated = GetItemActivated();
switch(2);
{
// Item 1 = Stone of Recall type item.
case 1: if(GetTag(oActivated) == "item1")
{
object oObject = GetItemActivator();
object oTarget = GetItemActivator();
location lLocation = GetLocation(oObject);
 {
// Object 1 = A Placeable object (invisible object works best). Must be the blueprint name NOT TAG!!
 CreateObject(OBJECT_TYPE_PLACEABLE, "object1", lLocation, FALSE);
 }
 {
// stonerecall02 = name of second script
  ExecuteScript("stonerecall02", oTarget);
 }
}
}
}



4.Create a new placeable object and give it a unique tag. Make sure it's apperance is set to Invisible Object. This is your object1 in the script above.
5. Create a new waypoint and give it a unique name. Place this where you want the player to appear after activating the item.
6. Go to the Script Editor, paste this in and save as "stonerecall02".

NWScript:
void main()
{
object oActivated = GetItemActivated();
switch(2);
{
case 1: if(GetTag(oActivated) == "item1")
{
object oPC = GetItemActivator();
// waypoint1 = Tag of waypoint where the player will be taken to when they activate the stone
object oTarget = GetWaypointByTag ("waypoint1");
AssignCommand (oPC,JumpToObject(oTarget));
ApplyEffectToObject (DURATION_TYPE_INSTANT, EffectVisualEffect (VFX_IMP_HOLY_AID), oPC);
}
}
}



7. Create a Recall Portal near the waypoint you just made.
8. Go to the Advanced Tab and edit the conversation.
9. Create a new conversation, with just a simple line like "This will take you back to where you activated the Stone of Recall". Add a PC line such as "Step in to the Portal" and then add this script to the Actions Taken part.

NWScript:
void main()
{
  location lLocation;
  object oObject, oActionSubject, oPC, oDestroy;
  {
    // object1 = blueprint name of the placeable created in the first script	
    oObject = GetObjectByTag("object1", 0);
    oDestroy = GetObjectByTag("object1", 0);
    oActionSubject = GetPCSpeaker();
    oPC = GetPCSpeaker();
    lLocation = GetLocation(oObject);
    {
      AssignCommand(oActionSubject, ActionJumpToLocation(lLocation));
      ApplyEffectToObject (DURATION_TYPE_INSTANT, EffectVisualEffect (VFX_IMP_UNSUMMON), oPC);
    }
    {
    DestroyObject(oDestroy, 3.0);
    }
  }
}



That's it. If it seems complicated trust me it isn't. Obviously this script is open to improvement and I welcome any constructive critisism. Thanks again to Yeldrig Yar.

⌂ All Scripts ← PreviousNext → 👁 Category List

All Items Scripts

📄 aquire_time 📄 bead_of_force 📄 book_of_inf_spells 📄 clear_inventory 📄 clear_inventory_002 📄 clear_inventory_003 📄 clear_inventory_004 📄 cursed_items 📄 cursed_items_002 📄 cursed_potion 📄 give_xp 📄 glow_when_mob 📄 healing_belt 📄 helm 📄 hurled_weapons 📄 item_weight 📄 key_rental 📄 lore_items 📄 npc_owners 📄 random_magic 📄 retrieve_ammo 📄 scimitar_of_dancing 📄 scroll_creation 📄 spawn_item 📄 spawn_item_002 📄 spawn_item_004 📄 stone_of_recall 📄 stone_of_recall_002 📄 summon_creature 📄 teleport_item 📄 torch 📄 weapon_upgrade