DMH-Online

Dungeon Masters Helper · Est. 2005

Items Scripts

NWN Script: teleport_item.htm

Author Sticky: Post Working Scripts Here
Nifoyg Posted: Monday, 01 July 07:55AM
Name: oia_ItemTeleport

Desc: Allows items such as a ring to teleport to a single waypoint.

Notes: At bottom of file.

NWScript:
// oia_ItemTeleport - belongs in Module OnItemActivate (oia)
//   Script allows items w/tag that start with "xfer" to teleport
//   by Nifoyg (PhilFischer@Yahoo.com)
// Note: The notes to make this work are at the bottom of the file
void JumpUsingItem(string asTagID);
void main()
{
    object oItem = GetItemActivated();
    //if (GetIsObjectValid(oItem)) // * Check for object validity
    //    {
    //    AssignCommand(GetItemActivator(), SpeakString("1 oItem is Valid"));
    //    }
    string sTagID = GetTag(oItem);
    string sTagTypeID = GetStringLeft(sTagID,4);
    if (sTagTypeID == "xfer")
        {
        //AssignCommand(GetItemActivator(), SpeakString("About to Jump..."));
        JumpUsingItem(sTagID);
        }
}
void JumpUsingItem(string asTagID)
{
    object oClicker = GetItemActivator();
    string sWPTagID = GetStringLeft(GetStringRight(asTagID,7),4);
    // Make the Jump to the Waypoint
    object oDest = GetWaypointByTag(sWPTagID);
    location lDest = GetLocation(oDest);
    AssignCommand(oClicker, JumpToLocation(lDest));
    effect eVis = EffectVisualEffect(VFX_IMP_UNSUMMON);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oClicker, 2.0);
}
// Requirement1: This script installed in the modules OnItemActivate
// Requirement2:  An Item (I used a ring) with a tag that has a special name
  // Item Name Tag:  Where tag is "xfer_item_XXAA-NN", i.e. "xfer_ring_L1ci_01"
  //   XX is Location on Area, AA is Area, NN is Item's Unique ID
  //   Just name your waypoint "L1ci" (in this case).
  //   Note: Coding did not have special requirements for changes in other
  //     areas so the XXAA is simply the name of a waypoint anywhere in module
  // Item Ability:  To make this script fire, the item must assign a property
  //   of "Cast Spell:Unique Power".  Either of the two work.  Self works on
  //   self only.  The other can do anyone so that doesn't work well for a ring
// Requirement3: A Waypoint with the name of items tag associated with it
  // My item naming convention was based on this:
  //    If an item starts with "xnay" this script will process it.
  // The last 3 characters of the item define its unique instance i.e. _01, _02
  //    I created a custom item (ring) with a blueprint name of xfer_ring_L1ci_
  //    Now with each item's instance, I edit the next instance number into it.
  // Everything in between the first 4 chars and the last 7 are for reference
  //    I used _ring_ but you should be able to use _amulet_ or even nothing.
// Requirement4: Use the ring.  Activate the items Unique Power.
// eof



Have fun, I'm interested in upgrades please email me.
-z

⌂ 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