Author Topic: Modified True Seeing  (Read 402 times)

Legacy_xephnin

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Modified True Seeing
« on: October 01, 2010, 11:47:44 pm »


               I'm quite horrible at scripting and need a script (if at all possible) for a nerfed version of "True Seeing." By default the spell acts as "See Invisible" with the perk of auto-spotting people who are sneaking. I need a version that still provides the "See Invisible" but instead of auto-spot, it gives the target like +10 spot/listen.

I've tried searching NWvault but for some strange reason I can't find any examples of what I'm looking for. Just a bunch of other modified spells. ':unsure:'
Which is why I've come here in hopes that some knowledgeable person will read this and aid me. Thank you to any and all who help. '^_^' 
               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Modified True Seeing
« Reply #1 on: October 02, 2010, 12:48:05 am »


               Here's my own nerfed version. It lasts 2 rounds per caster level and grants see invisible. Spot and Listen bonuses of 5+1per caster level also apply.



//::///////////////////////////////////////////////

//:: True Seeing

//:: NW_S0_TrueSee.nss

//:: Copyright © 2001 Bioware Corp.

//:://////////////////////////////////////////////

#include "x2_inc_spellhook"



void main()

{

   if (!X2PreSpellCastCode())

   {

   return;

   }



   object oTarget = GetSpellTargetObject();

   int nCasterLevel = GetCasterLevel(OBJECT_SELF)*2;

   effect eSpot = EffectSkillIncrease(SKILL_SPOT, 5 + nCasterLevel);

   effect eSearch = EffectSkillIncrease(SKILL_SEARCH, 5 + nCasterLevel);

   effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);

   effect eSight1 = EffectSeeInvisible();

   effect eSight2 = EffectUltravision();

   effect eLink = EffectLinkEffects(eSpot, eSearch);

   eLink = EffectLinkEffects(eLink, eDur);

   eLink = EffectLinkEffects(eLink, eSight1);

   eLink = EffectLinkEffects(eLink, eSight2);



   SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_TRUE_SEEING, FALSE));

   int nDuration = GetCasterLevel(OBJECT_SELF)*2;

   int nMetaMagic = GetMetaMagicFeat();

   if (nMetaMagic == METAMAGIC_EXTEND)

   {

       nDuration = nDuration *2; //Duration is +100%

   }

   ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, TurnsToSeconds(nDuration));

}
               
               

               
            

Legacy_420

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
Modified True Seeing
« Reply #2 on: October 02, 2010, 01:04:26 am »


               I'm really busy this entire weekend but I'll try to post my server's modified True Seeing script. Basically it replaces the default True Seeing effect with a combination See Invisibility and Ultravision. This allows Rogues and Shadow Dancers to remain concealed unless they fail a Spot or Listen check.



I made it work for both the spell True Seeing and the Item Property.



-420
               
               

               
            

Legacy_Taino

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +0/-0
Modified True Seeing
« Reply #3 on: October 31, 2010, 01:29:44 am »


               @ 420

Have you ever had time too dig this out?
               
               

               
            

Legacy_420

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
Modified True Seeing
« Reply #4 on: October 31, 2010, 05:48:34 pm »


               Sorry about that, I completely forgot.

Here is the altered nw_s0_truesee script, you can do this through the spellhook system now but it didn't exist back in 2004. Though the scripting is all mine the idea came from Talon and Mo of the GodSpire PvP server.


//Changes True Seeing to the effects Ultravision and See Invisibility
//By: 420
//11/15/04
//::///////////////////////////////////////////////
//:: True Seeing
//:: NW_S0_TrueSee.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    The creature can seen all invisible, sanctuared,
    or hidden opponents.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: [date]
//:://////////////////////////////////////////////

#include "x2_inc_spellhook"

void main()
{

/*
  Spellcast Hook Code
  Added 2003-06-23 by GeorgZ
  If you want to make changes to all spells,
  check x2_inc_spellhook.nss to find out more

*/

    if (!X2PreSpellCastCode())
    {
    // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
        return;
    }

// End of Spell Cast Hook


    //Declare major variables
    object oTarget = GetSpellTargetObject();
    effect eVis = EffectVisualEffect(VFX_DUR_MAGICAL_SIGHT);
    effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
    effect eSight = EffectSeeInvisible();
    effect eUltra = EffectUltravision();
    effect eLink = EffectLinkEffects(eVis, eSight);
    eLink = EffectLinkEffects(eLink, eDur);
    eLink = EffectLinkEffects(eLink, eUltra);
    //Fire cast spell at event for the specified target
    SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_TRUE_SEEING, FALSE));
    int nDuration = GetCasterLevel(OBJECT_SELF);
    int nMetaMagic = GetMetaMagicFeat();
    //Enter Metamagic conditions
    if (nMetaMagic == METAMAGIC_EXTEND)
    {
        nDuration = nDuration *2; //Duration is +100%
    }

    if(GetLocalInt(oTarget, "TrueSeeing"))
        {
        FloatingTextStringOnCreature("You are already wearing an item with that effect.", oTarget, FALSE);
        return;
        }

    //Apply the VFX impact and effects
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, TurnsToSeconds(nDuration));
    SetLocalInt(oTarget, "TSSpell", TRUE);
    DelayCommand(TurnsToSeconds(nDuration), DeleteLocalInt(oTarget, "TSSpell"));
}

Now the next part is a little trickier, they are the module's OnPlayerEquipItem and OnPlayerUnEquipItem events.

First the OnPlayerEquipItem (the check for multiple darkvisions handles cases where the item was unequiped in another module):


//OnPlayerEquipItem script to replace the True Seeing item property on an item
//with See Invisibility/Ultravision effects
//by: 420
//5/1/04
void main()
{
object oPC = GetPCItemLastEquippedBy();
object oItem = GetPCItemLastEquipped();
string sItem = GetTag(oItem);
itemproperty ipTS;
effect eUltra = EffectUltravision();
effect eSeeInv = EffectSeeInvisible();
effect eLink = SupernaturalEffect(EffectLinkEffects(eUltra, eSeeInv));
int iCountDV;
effect eTS;

if (GetItemHasItemProperty(oItem, ITEM_PROPERTY_TRUE_SEEING))
    {
    SetLocalInt(oItem, "TrueSeeing", 1);

    ipTS = GetFirstItemProperty(oItem);
    while (GetIsItemPropertyValid(ipTS) == TRUE)
        {
        if (GetItemPropertyType(ipTS) == ITEM_PROPERTY_TRUE_SEEING)
            {
            //For Item Level Restriction servers
            //Replace the True Seeing item property with 6 Darkvisions to keep the item value equal
            RemoveItemProperty(oItem, ipTS);
            AddItemProperty(DURATION_TYPE_PERMANENT,ItemPropertyDarkvision(), oItem);
            AddItemProperty(DURATION_TYPE_PERMANENT,ItemPropertyDarkvision(), oItem);
            AddItemProperty(DURATION_TYPE_PERMANENT,ItemPropertyDarkvision(), oItem);
            AddItemProperty(DURATION_TYPE_PERMANENT,ItemPropertyDarkvision(), oItem);
            AddItemProperty(DURATION_TYPE_PERMANENT,ItemPropertyDarkvision(), oItem);
            AddItemProperty(DURATION_TYPE_PERMANENT,ItemPropertyDarkvision(), oItem);
            }
        ipTS = GetNextItemProperty(oItem);
        }
    //Check to see if the altered True Seeing spell is in effect if so, end the effect
    if(GetLocalInt(oPC, "TSSpell"))
        {
        DeleteLocalInt(oPC, "TSSpell");

        eTS = GetFirstEffect(oPC);
        while(GetIsEffectValid(eTS) == TRUE)
            {
            if(GetEffectType(eTS) == EFFECT_TYPE_ULTRAVISION ||
                GetEffectType(eTS) == EFFECT_TYPE_SEEINVISIBLE &&
                GetEffectSubType(eTS) == SUBTYPE_SUPERNATURAL)
                {
                RemoveEffect(oPC, eTS);
                }
            eTS = GetNextEffect(oPC);
            }
        }

    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLink, oPC);
    SetLocalInt(oPC, "TrueSeeing", TRUE);
    }
//Check to see if the item equiped has 6 Darkvision item properties
//If so, make it into an altered True Seeing item
else if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DARKVISION))
    {
    iCountDV = 1;

    ipTS = GetFirstItemProperty(oItem);
    while (GetIsItemPropertyValid(ipTS) == TRUE)
        {
        if (GetItemPropertyType(ipTS) == ITEM_PROPERTY_DARKVISION)
            {
            iCountDV = iCountDV+1;
            }
        ipTS = GetNextItemProperty(oItem);
        }
    if(iCountDV >= 6)
        {
        SetLocalInt(oItem, "TrueSeeing", 1);
        if(GetLocalInt(oPC, "TSSpell"))
            {
            DeleteLocalInt(oPC, "TSSpell");

            eTS = GetFirstEffect(oPC);
            while(GetIsEffectValid(eTS) == TRUE)
                {
                if(GetEffectType(eTS) == EFFECT_TYPE_ULTRAVISION ||
                    GetEffectType(eTS) == EFFECT_TYPE_SEEINVISIBLE &&
                    GetEffectSubType(eTS) == SUBTYPE_SUPERNATURAL)
                    {
                    RemoveEffect(oPC, eTS);
                    }
                eTS = GetNextEffect(oPC);
                }
            }

        ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLink, oPC);
        SetLocalInt(oPC, "TrueSeeing", TRUE);
        }
    }

}

OnPlayerUnEuipItem script:


//OnPlayerUnEquipItem script to replace the True Seeing property on an item and
//remove the See Invisibility/Ultravision effects
//by: 420
//5/1/04
void main()
{
object oPC = GetPCItemLastUnequippedBy();
object oItem = GetPCItemLastUnequipped();
string sItem = GetTag(oItem);
int iTSCheck = GetLocalInt(oItem, "TrueSeeing");
effect eTS;
int iCounter;
itemproperty ipTS;
int iCountDV;

if (iTSCheck == 1)
    {
    iCountDV = 1;

    ipTS = GetFirstItemProperty(oItem);
    while (GetIsItemPropertyValid(ipTS) == TRUE)
        {
        if (GetItemPropertyType(ipTS) == ITEM_PROPERTY_DARKVISION &&
            iCountDV <= 6)
            {
            RemoveItemProperty(oItem, ipTS);
            iCountDV = iCountDV+1;
            }
        ipTS = GetNextItemProperty(oItem);
        }

    AddItemProperty(DURATION_TYPE_PERMANENT, ItemPropertyTrueSeeing(), oItem);
    DeleteLocalInt(oItem, "TrueSeeing");

    //Check through all equiped items.
    for (iCounter = 0; iCounter <= NUM_INVENTORY_SLOTS; iCounter++)
        {
        oItem = GetItemInSlot(iCounter, oPC);
        if(GetLocalInt(oItem, "TrueSeeing") == 1)
            {
            return;
            }
        }

        eTS = GetFirstEffect(oPC);
        while(GetIsEffectValid(eTS) == TRUE)
            {
            if(GetEffectType(eTS) == EFFECT_TYPE_ULTRAVISION ||
                GetEffectType(eTS) == EFFECT_TYPE_SEEINVISIBLE)
                {
                if(GetEffectSubType(eTS) == SUBTYPE_SUPERNATURAL)
                    {
                    RemoveEffect(oPC, eTS);
                    }
                }
            eTS = GetNextEffect(oPC);
            }
    DeleteLocalInt(oPC, "TrueSeeing");
    }
}

-420
               
               

               


                     Modifié par 420, 31 octobre 2010 - 05:50 .