Author Topic: Scrying  (Read 388 times)

Legacy_WhenTheNightComes

  • Jr. Member
  • **
  • Posts: 53
  • Karma: +0/-0
Scrying
« on: June 08, 2013, 04:05:22 pm »


               I would like to give PCs the ability to scry. I thought I would do this through an item called a "Scrying Glass," that when used would scry them to the PCs that they named. Currently, I have it set up so that when PCs say something, a variable gets set on them called "message" that has what they said, so that could be used for getting the PCs name that is to be scried.

Firstly, I want them to be required to have the feat Greater Spell Focus : Divination. Secodly, they would need to have casted Clairaudience/Clairvoyance on them, or have it casted on them. Now, I've no clue where to start, at all. Could I get some help? Thank you.
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Scrying
« Reply #1 on: June 09, 2013, 04:01:28 am »


               Scrying, in the old world of D&D was usually done via a magical item which was aided by magic, meaning not any person could just use a scrying device, they had to be a caster, and specifcally a wizard/sorcerer of some sort...
(Or a Witch/Warlock etc)

So essentially you want to make an object similar to this, which requires the feat Greater Spell Focus Divination..

if(GetHasFeat(FEAT_GREATER_SPELL_FOCUS_DIVINATION, oCaster))
{
// passed, so do this...
}

So you would use a Tagbased Script, and put the above check in the event under OnSpellCast(...)

So, when the PC cast the spell onto the scrying device it would then start a conversation with the PC, showing them what you wanted them to see..

// using the template provided below, nSpell is defined...

if(nSpell == SPELL_CLAIRAUDIENCE_AND_CLAIRVOYANCE)
{
  // passed spell check, so run the feat check...
  if(GetHasFeat(FEAT_GREATER_SPELL_FOCUS_DIVINATION, oCaster))
  {
    // passed feat check, so do this...
  }
 else
 {
  // Didn't Cast the proper spell, so do this... (If anything?  Or Send Message telling them why they failed?)
 }
}
else
 {
  // Didn't pass so do this... (If anything?  Or Send Message telling them why they failed?)
 }


Here is a template Tagbased Item script I use a lot....


//
// (NOTE: This is a template script, save it under a new name FIRST)
////////////////////////////////////////////////////////////////////////////////
// Created by:   The Krit
// Created on:   04-03-2010
// Modified by:  Genisys / Guile
// Modified on:  04-30-2011
///////////////////////////////////////////////////////////////////////////////

// This is intended to be a starting point for writing an item's tag-based script.
// Copy this to a script whose name is the tag of the item in question.
// Edit the event handlers (scroll down to find them) as desired.
// -----------------------------------------------------------------------------
//Required Include (DO NOT TOUCH!)
#include "x2_inc_switches"
//------------------------------------------------------------------------------

    // Delcare ALL Common Integers / Floats / Strings


// -----------------------------------------------------------------------------
// Event handlers
// -----------------------------------------------------------------------------
// This second part is where you add your desired functionality. Each event
// has its own function with relavant information passed as parameters.
// -----------------------------------------------------------------------------


// -----------------------------------------------------------------------------
// oItem was acquired (by a PC or an NPC).
// Run by the module.
void OnAcquire(object oItem, object oAcquiredBy, object oTakenFrom, int nStackSize)
{
    // Enter code to execute when this event happens
}


// -----------------------------------------------------------------------------
// oItem was activated ("activate item" or "unique power").
// Run by the module.
void OnActivate(object oItem, object oActTarget, location lActTarget, object oActivator)
{
    // Enter code to execute when this event happens
}


// -----------------------------------------------------------------------------
// oItem was equipped by a PC.
// Run by the module.
void OnEquip(object oItem, object oEquippedBy)
{
    // Enter code to execute when this event happens
}


// -----------------------------------------------------------------------------
// oItem is a weapon that just hit a target, or it is the armor of someone who
// was just hit by someone else's weapon.
// Run by the caster.
void OnHit(object oItem, object oHitTarget, object oCaster)
{
    // Enter code to execute when this event happens
}


// -----------------------------------------------------------------------------
// Someone cast a spell at oItem.

// Run by the caster.
int OnSpellCast(object oItem, int nSpell, object oCaster)
{
   // Enter code to execute when this event happens

   return FALSE; //Necessary return (Do this !)
}


// -----------------------------------------------------------------------------
// oItem was unacquired/lost (by a PC or NPC).
// Run by the module.
void OnUnacquire(object oItem, object oLostBy)
{
    // Enter code to execute when this event happens
}


// -----------------------------------------------------------------------------
// oItem was unequipped by a PC.
// Run by the module.
void OnUnequip(object oItem, object oUnequippedBy)
{
    // Enter code to execute when this event happens
}


//////////////////////////////////////////////////////////////////////////////
// ##### WARNINING:: DON'T TOUCH ANYTHING BELOW THIS LINE!!! #### ///////////
////////////////////////////////////////////////////////////////////////////

// The main function.
void main()
{
    int nEvent = GetUserDefinedItemEventNumber();

    // Spells might continue to their spell scripts. All other events are
    // completely handled by this script.
    if ( nEvent != X2_ITEM_EVENT_SPELLCAST_AT )
        SetExecutedScriptReturnValue();

    // Determine which event triggered this script's execution.
    switch ( nEvent )
    {
        // Item was acquired.
        case X2_ITEM_EVENT_ACQUIRE:
                OnAcquire(GetModuleItemAcquired(), GetModuleItemAcquiredBy(),
                          GetModuleItemAcquiredFrom(), GetModuleItemAcquiredStackSize());
                break;

        // Item was activated ("activate item" or "unique power").
        case X2_ITEM_EVENT_ACTIVATE:
                OnActivate(GetItemActivated(), GetItemActivatedTarget(),
                           GetItemActivatedTargetLocation(), GetItemActivator());
                break;

        // Item was equipped by a PC.
        case X2_ITEM_EVENT_EQUIP:
                OnEquip(GetPCItemLastEquipped(), GetPCItemLastEquippedBy());
                break;

        // Item is a weapon that just hit a target, or it is the armor of someone
        // who was just hit.
        case X2_ITEM_EVENT_ONHITCAST:
                OnHit(GetSpellCastItem(), GetSpellTargetObject(), OBJECT_SELF);
                break;

        // A PC (or certain NPCs) cast a spell at the item.
        case X2_ITEM_EVENT_SPELLCAST_AT:
                if ( OnSpellCast(GetSpellTargetObject(), GetSpellId(), OBJECT_SELF) )
                    SetExecutedScriptReturnValue();
                break;

        // Item was unacquired.
        case X2_ITEM_EVENT_UNACQUIRE:
                OnUnacquire(GetModuleItemLost(), GetModuleItemLostBy());
                break;

        // Item was unequipped by a PC.
        case X2_ITEM_EVENT_UNEQUIP:
                OnUnequip(GetPCItemLastUnequipped(), GetPCItemLastUnequippedBy());
                break;
    }
}

               
               

               


                     Modifié par _Guile, 09 juin 2013 - 03:08 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Scrying
« Reply #2 on: June 10, 2013, 06:17:45 pm »


                Check out Mannast's scry system