Author Topic: Unique Items  (Read 2481 times)

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Unique Items
« on: July 29, 2010, 09:22:51 pm »


               All of us who build or script have some fun items we like or have found on the Vault. I am going to paste a few here with scripts. Anyone is more than welcome to snag them. Some I got from tutorials like Axes on Tag Based Scripting, some I stumbled upon on the Vault or in long lost modules. Some I made up.

Please feel free to post any you have as well.

A Player gets these when they log in to give other players XP when they recognize good role play. Nothing huge, just a snappy way of saying good job.

void main()
 {
int nEvent =GetUserDefinedItemEventNumber();
        // Exit if not an activate event
        if(nEvent !=  X2_ITEM_EVENT_ACTIVATE)return;
          object oItem = GetItemActivated();
            object oTarget = GetItemActivatedTarget();
            string sTargetName = GetName(oTarget);
            string sTargetPlayer = GetPCPlayerName(oTarget);
            object oUser = GetItemActivator();
            string sUserName = GetPCPlayerName(oUser);
            string sUserName2 = GetName (oUser);
            int iUserLevel = GetHitDice(oTarget);

            if (GetIsPC(oTarget)){
                if (oTarget == oUser){
                    SendMessageToPC(oUser, "You can't give yourself a gift.");
                    }
                    else{
                        int iRandom = Random(100);
                        int iMultiplier = 10;
                        int iXPgift = iUserLevel * iMultiplier + iRandom;
                        SendMessageToPC(oUser, "You have given " + sTargetName + " (" + sTargetPlayer + ") a gift.");
                        SendMessageToPC(oTarget, "Another Player has given you a Role Playing reward.");
                        //SendMessageToAllDMs (sMsg);
                        PWFXP_GiveXP(oTarget, iXPgift);
                        DestroyObject(oItem, 0.0);
                        }
                }
                else{
                    SendMessageToPC(oUser, "That's not a valid target.  You can only give XP gifts to your fellow players.");
                }
            }
               
               

               
            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Unique Items
« Reply #1 on: July 29, 2010, 09:28:18 pm »


               A amulet/ring when equipped turns one into a chicken. Just make the description somethign that makes them want to try it on.


void main()
{ switch( GetUserDefinedItemEventNumber())
   { case X2_ITEM_EVENT_EQUIP:
         { // The item was just equipped.
            object oEquipper = GetPCItemLastEquippedBy();
            object oItem         = GetPCItemLastEquipped();
            if( !GetIsObjectValid( oEquipper) || !GetIsObjectValid( oItem))
            { SetExecutedScriptReturnValue( X2_EXECUTE_SCRIPT_CONTINUE);
               return;
            }
            // Change the wearer's appearance to that of a chicken if he wasn't already wearing a chicken ring.
            if( GetLocalInt( oEquipper, "WearingChickenRing"))
            { SetExecutedScriptReturnValue( X2_EXECUTE_SCRIPT_CONTINUE);
               return;
            }
            SetLocalInt( oEquipper, "WearingChickenRing", TRUE);
            // Save his original appearance so when he removes the ring we'll know what to change him back into.
            if( !GetLocalInt( oEquipper, "OriginalAppearance"))
                 SetLocalInt( oEquipper, "OriginalAppearance", GetAppearanceType( oEquipper) +1);
            // Now make him look like a chicken.
            SetCreatureAppearanceType( oEquipper, APPEARANCE_TYPE_CHICKEN);
          // take control of the equipper's body for 20 secs.
        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectCutsceneDominated(), oEquipper, 20.0);
        // change their appearance to that of a chicken with a "polymorph" visual effect.
        //ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_POLYMORPH), oEquipper, 3.0);
        //ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectPolymorph(POLYMORPH_TYPE_CHICKEN), oEquipper, 15.0);
        // tell them to walk around randomly (we'll end this later with ClearAllActions(); )
        AssignCommand(oEquipper, ActionRandomWalk());
        // squacking noises every 4 seconds.  To change what the say, just edit the stuff
        // inside of the quotes in the next four lines:
        DelayCommand(2.0, AssignCommand(oEquipper, SpeakString("Squack! Squack!", TALKVOLUME_TALK)));
        DelayCommand(2.0, AssignCommand(oEquipper, PlaySound("as_an_chickens1")));
        DelayCommand(6.0, AssignCommand(oEquipper, SpeakString("Squack! Gobble!", TALKVOLUME_TALK)));
        DelayCommand(6.0, AssignCommand(oEquipper, PlaySound("as_an_chickens1")));
        DelayCommand(10.0, AssignCommand(oEquipper, SpeakString("Squack! ****-a-doodle-doo!", TALKVOLUME_TALK)));
        DelayCommand(10.0, AssignCommand(oEquipper, PlaySound("as_an_chickens1")));
        DelayCommand(14.0, AssignCommand(oEquipper, SpeakString("Squack! Squack!", TALKVOLUME_TALK)));
        DelayCommand(14.0, AssignCommand(oEquipper, PlaySound("as_an_chickens1")));
        // once 15 seconds runs out, apply the same polymorph vfx when the polymorph stops
        DelayCommand(15.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_POLYMORPH), oEquipper, 3.0));
        // makes them fall down and then play a tired vfx while speaking a small exclamation...
        DelayCommand(16.5, AssignCommand(oEquipper, PlayAnimation(ANIMATION_LOOPING_DEAD_FRONT, 1.0, 1.0)));
        DelayCommand(18.0, AssignCommand(oEquipper, SpeakString("Yikes...that was bizarre...")));
        DelayCommand(17.6, AssignCommand(oEquipper, PlayAnimation(ANIMATION_LOOPING_PAUSE_TIRED, 1.0, 4.0)));
        // remove the "randomwalk" command
        DelayCommand(20.0, AssignCommand(oEquipper, ClearAllActions()));
         }
         SetExecutedScriptReturnValue( X2_EXECUTE_SCRIPT_END);
         return;
     case X2_ITEM_EVENT_UNEQUIP:
         { // The item was just un-equipped.
            object oUnequipper = GetPCItemLastUnequippedBy();
            object oItem              = GetPCItemLastUnequipped();
            if( !GetIsObjectValid( oUnequipper) || !GetIsObjectValid( oItem))
            { SetExecutedScriptReturnValue( X2_EXECUTE_SCRIPT_CONTINUE);
               return;
            }
            // If he is still wearing another  chicken ring, do nothing. We check all the inventory
            // slots in case there is an amulet or a sword etc. that is tagged "alh_chickenequip".
            int iSlot = NUM_INVENTORY_SLOTS;
            while( --iSlot >= 0)
            { object oItemInSlot = GetItemInSlot( iSlot, oUnequipper);
               if( (oItemInSlot != oItem) && (GetTag( oItemInSlot) == "amuletofthechick"))
               { SetExecutedScriptReturnValue( X2_EXECUTE_SCRIPT_CONTINUE);
                  return;
               }
            }
            // Otherwise change the wearer's appearance back to normal.
            int iOriginal = GetLocalInt( oUnequipper, "OriginalAppearance") -1;
            if( iOriginal >= 0) SetCreatureAppearanceType( oUnequipper, iOriginal);
            DeleteLocalInt( oUnequipper, "WearingChickenRing");
         }
         SetExecutedScriptReturnValue( X2_EXECUTE_SCRIPT_END);
         return;
     case X2_ITEM_EVENT_UNACQUIRE:
         { // The item was just unacquired (dropped, sold, lost, etc).
            object oOldOwner  = GetModuleItemLostBy();
            object oItem             = GetModuleItemLost();
            object oNewOwner = GetItemPossessor( oItem);
            if( !GetIsObjectValid( oOldOwner) || !GetIsObjectValid( oItem))
            { SetExecutedScriptReturnValue( X2_EXECUTE_SCRIPT_CONTINUE);
               return;
            }
            // If he is still wearing another  chicken ring, do nothing. We check all the inventory
            // slots in case there is an amulet or a sword etc. that is tagged "alh_chickenequip".
            int iSlot = NUM_INVENTORY_SLOTS;
            while( --iSlot >= 0)
            { object oItemInSlot = GetItemInSlot( iSlot, oOldOwner);
               if( (oItemInSlot != oItem) && (GetTag( oItemInSlot) == "amuletofthechick"))
               { SetExecutedScriptReturnValue( X2_EXECUTE_SCRIPT_CONTINUE);
                  return;
               }
            }
            // Otherwise change the wearer's appearance back to normal only if he was wearing the ring.
            if( GetLocalInt( oOldOwner, "WearingChickenRing"))
            { int iOriginal = GetLocalInt( oOldOwner, "OriginalAppearance") -1;
               if( iOriginal >= 0) SetCreatureAppearanceType( oOldOwner, iOriginal);
            }
            DeleteLocalInt( oOldOwner, "WearingChickenRing");
         }
         SetExecutedScriptReturnValue( X2_EXECUTE_SCRIPT_END);
         return;
   }
  SetExecutedScriptReturnValue( X2_EXECUTE_SCRIPT_CONTINUE);
}
               
               

               
            

Legacy_ChaosInTwilight

  • Full Member
  • ***
  • Posts: 126
  • Karma: +0/-0
Unique Items
« Reply #2 on: July 30, 2010, 11:52:51 pm »


               /me chips in too.
               
               

               
            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Unique Items
« Reply #3 on: July 31, 2010, 01:31:04 am »


               #include "x2_i0_spells"

//Ioun Stones
int IounStone(string sIoun)
{
    int nIoun = 0;
    string sRESREF = "ioun_";

    //Determine the Ioun Stone.
    if(sIoun == sRESREF+"armor1") nIoun = 1;
    if(sIoun == sRESREF+"resist1") nIoun = 2;
    if(sIoun == sRESREF+"str") nIoun = 3;
    if(sIoun == sRESREF+"dex") nIoun = 4;
    if(sIoun == sRESREF+"con") nIoun = 5;
    if(sIoun == sRESREF+"int") nIoun = 6;
    if(sIoun == sRESREF+"wis") nIoun = 7;
    if(sIoun == sRESREF+"chr") nIoun = 8;
    if(sIoun == sRESREF+"reduction") nIoun = 9;
    if(sIoun == sRESREF+"freedom") nIoun = 10;
    if(sIoun == sRESREF+"regen") nIoun = 11;

    return nIoun;
}

//Freedom of Movement
void Freedom(object oPC, float fDuration)
{
    effect eParalyze = EffectImmunity(IMMUNITY_TYPE_PARALYSIS);
    effect eEntangle = EffectImmunity(IMMUNITY_TYPE_ENTANGLE);
    effect eSlow = EffectImmunity(IMMUNITY_TYPE_SLOW);
    effect eMove = EffectImmunity(IMMUNITY_TYPE_MOVEMENT_SPEED_DECREASE);
    effect eVis = EffectVisualEffect(VFX_DUR_FREEDOM_OF_MOVEMENT);
    effect eLink;

    //Link effects.
    eLink = EffectLinkEffects(eParalyze, eEntangle);
    eLink = EffectLinkEffects(eSlow, eLink);
    eLink = EffectLinkEffects(eMove, eLink);
    eLink = EffectLinkEffects(eVis, eLink);

    //Apply effects.
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oPC, fDuration);
}

//Delay Local Int
void DelayLocalInt(object oTarget, string sVars, int nLocal)
{
    SetLocalInt(oTarget, sVars, nLocal);
}

void main()
{
    //Major Varibles
    object oItem = GetItemActivated();
    object oPC = GetItemActivator();
    object oTarget = GetItemActivatedTarget();
    int nRandom;
    effect eVis;
    effect eLink;
    string sItem;

    //Activate
    if(GetUserDefinedItemEventNumber() == X2_ITEM_EVENT_ACTIVATE)
    {
        //Skullshaker Hammer
        if(GetResRef(oItem) == "skullshaker")
        {
            itemproperty ipWisdom = ItemPropertyOnHitProps(IP_CONST_ONHIT_ABILITYDRAIN, IP_CONST_ONHIT_SAVEDC_16, IP_CONST_ABILITY_WIS);
            itemproperty ipVis = ItemPropertyVisualEffect(ITEM_VISUAL_EVIL);
            eVis = EffectVisualEffect(VFX_IMP_EVIL_HELP);

            //Apply effects.
            IPSafeAddItemProperty(oItem, ipWisdom, RoundsToSeconds(10));
            IPSafeAddItemProperty(oItem, ipVis, RoundsToSeconds(10));
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);
        }

        //Ringsword
        if(GetResRef(oItem) == "ringsword")
        {
            //Only rings.
            if(GetBaseItemType(oTarget) == BASE_ITEM_RING)
            {
                itemproperty ipItem = GetFirstItemProperty(oTarget);
                while(GetIsItemPropertyValid(ipItem))
                {
                    IPSafeAddItemProperty(oItem, ipItem, HoursToSeconds(24));
                    ipItem = GetNextItemProperty(oTarget);
                }

                //Ring is no longer useable.
                AssignCommand(oPC, ActionUnequipItem(oTarget));
                IPSafeAddItemProperty(oTarget, ItemPropertyLimitUseByRace(IP_CONST_RACIALTYPE_OUTSIDER), HoursToSeconds(24));

                //Apply effects.
                eVis = EffectVisualEffect(VFX_IMP_SUPER_HEROISM);
                ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);
            }
        }

        //Hand of Kelemvor
        if(GetResRef(oItem) == "hand_kelemvor")
        {
            itemproperty ipDamage = ItemPropertyDamageBonusVsRace(IP_CONST_RACIALTYPE_UNDEAD, IP_CONST_DAMAGETYPE_POSITIVE, IP_CONST_DAMAGEBONUS_2d6);
            eVis = EffectVisualEffect(VFX_IMP_SUPER_HEROISM);

            //Apply effects.
            IPSafeAddItemProperty(oItem, ipDamage, RoundsToSeconds(10), X2_IP_ADDPROP_POLICY_IGNORE_EXISTING);
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);

            //Decrease Turn Undead.
            DecrementRemainingFeatUses(oPC, FEAT_TURN_UNDEAD);
        }

        //Larethion Protector
        if(GetResRef(oItem) == "larethion_bow")
        {
            object oArrow = GetItemInSlot(INVENTORY_SLOT_ARROWS, oPC);
            itemproperty ipDamage = ItemPropertyDamageBonusVsRace(IP_CONST_RACIALTYPE_UNDEAD, IP_CONST_DAMAGETYPE_POSITIVE, IP_CONST_DAMAGEBONUS_2d6);
            eVis = EffectVisualEffect(VFX_IMP_SUPER_HEROISM);

            //Arrows
            if(oArrow != OBJECT_INVALID)
            {
                //Apply effects.
                IPSafeAddItemProperty(oArrow, ipDamage, RoundsToSeconds(10));
                ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);

                //Decrease Turn Undead.
                DecrementRemainingFeatUses(oPC, FEAT_TURN_UNDEAD);
            }
        }

        //Gauntlets of the Heartfelt Blows
        if(GetResRef(oItem) == "gloves_heart")
        {
            object oGloves = GetItemInSlot(INVENTORY_SLOT_ARMS, oPC);
            int nCharisma = GetAbilityModifier(ABILITY_CHARISMA, oPC);
            int nDamage;
            itemproperty ipHeart;
            eVis = EffectVisualEffect(VFX_IMP_FLAME_M);

            //Determine bonus.
            switch(nCharisma)
            {
                case 1: nDamage = IP_CONST_DAMAGEBONUS_1; break;
                case 2: nDamage = IP_CONST_DAMAGEBONUS_2; break;
                case 3: nDamage = IP_CONST_DAMAGEBONUS_3; break;
                case 4: nDamage = IP_CONST_DAMAGEBONUS_4; break;
                case 5: nDamage = IP_CONST_DAMAGEBONUS_5; break;
                case 6: nDamage = IP_CONST_DAMAGEBONUS_6; break;
                case 7: nDamage = IP_CONST_DAMAGEBONUS_7; break;
                case 8: nDamage = IP_CONST_DAMAGEBONUS_8; break;
                case 9: nDamage = IP_CONST_DAMAGEBONUS_9; break;
                case 10: nDamage = IP_CONST_DAMAGEBONUS_10; break;
            }
            ipHeart = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_FIRE, nDamage);

            //Apply effects.
            IPSafeAddItemProperty(oGloves, ipHeart, HoursToSeconds(24));
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);
        }

        //Scarab of Protection
        if(GetResRef(oItem) == "scarab_protect")
        {
            effect eNegative = EffectDamageImmunityIncrease(DAMAGE_TYPE_NEGATIVE, 100);
            effect eDrain = EffectImmunity(IMMUNITY_TYPE_ABILITY_DECREASE);
            effect eLevel = EffectImmunity(IMMUNITY_TYPE_NEGATIVE_LEVEL);
            effect eSR = EffectSpellResistanceIncrease(20);
            eVis = EffectVisualEffect(VFX_IMP_DEATH_WARD);

            //Link effects.
            eLink = EffectLinkEffects(eNegative, eDrain);
            eLink = EffectLinkEffects(eLink, eLevel);
            eLink = EffectLinkEffects(eLink, eSR);

            //Apply effects.
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oPC, TurnsToSeconds(5));
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);
        }

        //Quiver of Energy
        if(GetResRef(oItem) == "quiver_energy")
        {
            nRandom = d6(1);
            if(nRandom == 1){sItem = "fire_arrow01";}
            if(nRandom == 2){sItem = "cold_arrow01";}
            if(nRandom == 3){sItem = "shock_arrow01";}
            if(nRandom == 4){sItem = "acid_arrow01";}
            if(nRandom == 5){sItem = "sonic_arrow01";}
            if(nRandom == 6){sItem = "fire_arrow01";}

            //Create arrows.
            object oArrow = CreateItemOnObject(sItem, oPC, 20);
            SetIdentified(oArrow, TRUE);

            //Apply effects.
            ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_SUPER_HEROISM), oPC);
        }

        //Quiver of Plenty
        if(GetResRef(oItem) == "quiver_plenty")
        {
            //Create arrows.
            object oArrow0 = CreateItemOnObject("arrow00", oPC, 40);
            object oArrow1 = CreateItemOnObject("arrow01", oPC, 20);
            object oArrow2 = CreateItemOnObject("arrow02", oPC, 10);
            object oArrow3 = CreateItemOnObject("arrow03", oPC, 5);
            SetIdentified(oArrow0, TRUE);
            SetIdentified(oArrow1, TRUE);
            SetIdentified(oArrow2, TRUE);
            SetIdentified(oArrow3, TRUE);

            //Apply effects.
            ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_SUPER_HEROISM), oPC);
        }

        //Thunderstaff
        if(GetResRef(oItem) == "thunderstaff")
        {
            //Only PCs!
            if(GetIsPC(oTarget) == FALSE || GetIsEnemy(oTarget) == TRUE)
            {
                oTarget = OBJECT_SELF;
            }
            effect eDragon = EffectPolymorph(143);//Adult Blue Dragon
            effect eVis = EffectVisualEffect(VFX_IMP_POLYMORPH);

            //Apply effects.
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDragon, oTarget, HoursToSeconds(6));
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
        }

        //Cloak of Shadows
        if(GetResRef(oItem) == "cloak_shadow")
        {
            effect eCloak = EffectSummonCreature("s_greater_shadow", VFX_FNF_SUMMON_MONSTER_2);

            //Apply effects.
            ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eCloak, GetLocation(oPC), HoursToSeconds(24));
        }

        //Ion Stones
        if(GetStringLeft(GetResRef(oItem), 5) == "ioun_")
        {
            int nIoun = IounStone(GetResRef(oItem));
            effect eIoun;

            //Determine Ioun Stone.
            switch(nIoun)
            {
                //Armor
                case 1:
                eIoun = EffectACIncrease(1, AC_DODGE_BONUS);
                eVis = EffectVisualEffect(VFX_DUR_IOUNSTONE_RED);
                break;

                //Resistance
                case 2:
                eIoun = EffectSavingThrowIncrease(SAVING_THROW_ALL, 1);
                eVis = EffectVisualEffect(VFX_DUR_IOUNSTONE_RED);
                break;

                //Strength
                case 3:
                eIoun = EffectAbilityIncrease(ABILITY_STRENGTH, 2);
                eVis = EffectVisualEffect(VFX_DUR_IOUNSTONE_BLUE);
                break;

                //Dexterity
                case 4:
                eIoun = EffectAbilityIncrease(ABILITY_DEXTERITY, 2);
                eVis = EffectVisualEffect(VFX_DUR_IOUNSTONE_RED);
                break;

                //Constitution
                case 5:
                eIoun = EffectAbilityIncrease(ABILITY_CONSTITUTION, 2);
                eVis = EffectVisualEffect(VFX_DUR_IOUNSTONE_RED);
                break;

                //Intelligence
                case 6:
                eIoun = EffectAbilityIncrease(ABILITY_INTELLIGENCE, 2);
                eVis = EffectVisualEffect(VFX_DUR_IOUNSTONE);
                break;

                //Wisdom
                case 7:
                eIoun = EffectAbilityIncrease(ABILITY_WISDOM, 2);
                eVis = EffectVisualEffect(VFX_DUR_IOUNSTONE_BLUE);
                break;

                //Charisma
                case 8:
                eIoun = EffectAbilityIncrease(ABILITY_CHARISMA, 2);
                eVis = EffectVisualEffect(VFX_DUR_IOUNSTONE_GREEN);
                break;

                //Reduction
                case 9:
                eIoun = EffectDamageReduction(10, DAMAGE_POWER_PLUS_ONE);
                eVis = EffectVisualEffect(VFX_DUR_IOUNSTONE_RED);
                break;

                //Freedom
                case 10:
                Freedom(oPC, HoursToSeconds(24));
                eVis = EffectVisualEffect(VFX_DUR_IOUNSTONE_BLUE);
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVis, oPC, 3.0f);
                return;
                break;

                //Regen
                case 11:
                eIoun = EffectRegenerate(1, 6.0f);
                eVis = EffectVisualEffect(VFX_DUR_IOUNSTONE_YELLOW);
                break;
            }

            //Apply effects.
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, ExtraordinaryEffect(eIoun), oPC, HoursToSeconds(24));
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVis, oPC, 3.0f);
        }
    }
}
               
               

               
            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Unique Items
« Reply #4 on: July 31, 2010, 01:31:36 am »


               #include "x2_i0_spells"



void main()

{

   //Major Varibles

   object oItem = GetItemActivated();

   object oPC = GetItemActivator();

   object oTarget = GetItemActivatedTarget();

   int nRoll;

   effect eDur;

   effect eVis;

   effect eLink;



   //Activate

   if(GetUserDefinedItemEventNumber() == X2_ITEM_EVENT_ACTIVATE)

   {

       //Porcupine Elixir

       if(GetResRef(oItem) == "p_porcupine")

       {

           effect eArmor = EffectACIncrease(1);

           effect eSpikes = EffectDamageShield(0, DAMAGE_BONUS_1d6, DAMAGE_TYPE_PIERCING);

           eDur = EffectVisualEffect(VFX_DUR_GLOW_BROWN);

           eVis = EffectVisualEffect(VFX_IMP_PULSE_NATURE);



           //Link effects.

           eLink = EffectLinkEffects(eArmor, eSpikes);

           eLink = EffectLinkEffects(eLink, eDur);



           //Apply effects.

           ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oPC, HoursToSeconds(12));

           ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);

       }

       //Rhino Elixir

       if(GetResRef(oItem) == "p_rhino")

       {

           effect eArmor = EffectACIncrease(3);

           effect eDamage = EffectDamageIncrease(1, DAMAGE_TYPE_BASE_WEAPON);

           eDur = EffectVisualEffect(VFX_DUR_GLOW_GREY);

           eVis = EffectVisualEffect(VFX_IMP_PULSE_NATURE);



           //Link effects.

           eLink = EffectLinkEffects(eArmor, eDamage);

           eLink = EffectLinkEffects(eLink, eDur);



           //Apply effects.

           ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oPC, HoursToSeconds(12));

           ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);

       }

       //Salve of Spell Resistance (Minor)

       if(GetResRef(oItem) == "p_sr1")

       {

           effect eSR = EffectSpellResistanceIncrease(17);

           eDur = EffectVisualEffect(VFX_DUR_GLOBE_MINOR);

           eVis = EffectVisualEffect(VFX_IMP_HEAD_MIND);



           //Link effects.

           eLink = EffectLinkEffects(eSR, eDur);



           //Apply effects.

           ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oPC, TurnsToSeconds(5));

           ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);

       }

       //Elixir of Vision

       if(GetResRef(oItem) == "p_vision")

       {

           effect eVision = EffectSkillIncrease(SKILL_SEARCH, 10);

           eDur = EffectVisualEffect(VFX_DUR_MAGICAL_SIGHT);

           eVis = EffectVisualEffect(VFX_IMP_HEAD_MIND);



           //Link effects.

           eLink = EffectLinkEffects(eVision, eDur);



           //Apply effects.

           ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oPC, HoursToSeconds(1));

           ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);

       }

       //Oil of Elements

       if(GetResRef(oItem) == "oil_elements")

       {

           oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);

           nRoll = d6(1);

           int nElement;

           eVis = EffectVisualEffect(VFX_IMP_SUPER_HEROISM);

           itemproperty ipOil;



           //Melee weapons only.

           if(IPGetIsMeleeWeapon(oItem) == FALSE)

           {

               SendMessageToPC(oPC, "<c þþ>Must be carrying a melee weapon!</c>");

               CreateItemOnObject("oil_elements", oPC, 1);

               return;

           }



           //Determine element.

           switch(nRoll)

           {

               case 1: nElement = IP_CONST_DAMAGETYPE_FIRE; break;

               case 2: nElement = IP_CONST_DAMAGETYPE_COLD; break;

               case 3: nElement = IP_CONST_DAMAGETYPE_ELECTRICAL; break;

               case 4: nElement = IP_CONST_DAMAGETYPE_ACID; break;

               case 5: nElement = IP_CONST_DAMAGETYPE_SONIC; break;

               case 6: nElement = IP_CONST_DAMAGETYPE_MAGICAL; break;

           }



           //Add element.

           ipOil = ItemPropertyDamageBonus(nElement, IP_CONST_DAMAGEBONUS_1d6);

           IPSafeAddItemProperty(oItem, ipOil, HoursToSeconds(12));



           //Apply effects.

           ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);

       }

   }

}

               
               

               
            

Legacy_SHOVA

  • Hero Member
  • *****
  • Posts: 893
  • Karma: +0/-0
Unique Items
« Reply #5 on: July 31, 2010, 02:37:15 am »


               Should this topic be in scripting as thats is where the true value of these items is.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Unique Items
« Reply #6 on: July 31, 2010, 03:03:50 am »


                
Being Unique Items, I think this is a good place for them. Useful source for people adding items in the toolset. Even if they have no Idea how to script.

**Add Item Here to make post on topic**

Ok this is to make a arrow unlimited. Just Give the arrow/bullet/bolt the tag of the script.

So want unlimited sonic arrows? Just paint one in the toolset and change its tag. to the script name.
 

#include "x2_inc_switches"
void main()
{
object oPC;
object oItem;
int nStack;
int nEvent = GetUserDefinedItemEventNumber();
switch (nEvent)
{
case X2_ITEM_EVENT_EQUIP:
oPC = GetPCItemLastEquippedBy();
oItem = GetPCItemLastEquipped();
nStack =GetItemStackSize(oItem);
if (nStack > 1)
{
SetItemStackSize(oItem,nStack-1);
CopyObject(oItem,GetLocation(oPC),oPC);
SetItemStackSize(oItem,1);
}
AssignCommand (oItem, SetIsDestroyable(FALSE));
break;
case X2_ITEM_EVENT_UNEQUIP:
oPC = GetPCItemLastUnequippedBy();
oItem = GetPCItemLastUnequipped();
AssignCommand (oItem, SetIsDestroyable(TRUE));
break;
[/list]}
[/list]}
               
               

               


                     Modifié par Lightfoot8, 31 juillet 2010 - 03:10 .
                     
                  


            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Unique Items
« Reply #7 on: July 31, 2010, 01:48:12 pm »


               //::///////////////////////////////////////////////
//:: Name: dragonlancetrue
//:://////////////////////////////////////////////
/*
Script will get current HP of PC using the
Dragonlance and apply that as damage to a
Dragon. It will also get the current HP of
The PC and apply half of that as damage to
A Dragon Disciple.
*/
//:://////////////////////////////////////////////
//:: Created By: Emperor Yan
//:: Created On: June 26th, 2004
//:: Modified By: Emperor Yan
//:: Modified On: July 8th, 2004
//:://////////////////////////////////////////////
object oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, OBJECT_SELF);
object oPC = GetItemPossessor(oItem);
object oDragon = GetAttemptedAttackTarget();
int nHitPoints = GetCurrentHitPoints(oPC);
void main()
{
if(GetIsPC(oPC))
if((GetRacialType(oDragon)==RACIAL_TYPE_DRAGON))
{
effect eDamage;
eDamage = EffectDamage(nHitPoints);

ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oDragon, 1.0);
}
else if((GetLevelByclass(class_TYPE_DRAGONDISCIPLE, oDragon)>0))
{
int nHalf;
nHalf = FloatToInt(IntToFloat(nHitPoints)/2);

effect eRDD;
eRDD = EffectDamage(nHalf);

ApplyEffectToObject(DURATION_TYPE_INSTANT, eRDD, oDragon, 1.0);
}
else
{
return; //If Target isn't a Dragon or an RDD, Get Out!
}
}
               
               

               


                     Modifié par TSMDude, 31 juillet 2010 - 12:50 .
                     
                  


            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Unique Items
« Reply #8 on: July 31, 2010, 01:51:11 pm »


               //  Critter Bag v0.6 #jb_critterpouch
//  Created by Jimmy Buffit - August, 2008
/*
   Concept proposed by BBC-woulph July, 2008
*/
#include "x2_inc_switches"
#include "x3_inc_horse"
#include "x0_inc_henai"
#include "x3_inc_string"

// Adjust damage requirement for creature capture here.
// Default is 50% (0.5) or less of total hit points remaining.
const float fHealthRemaining = 0.5;

void main()
{
   int nEvent =GetUserDefinedItemEventNumber();

   if (nEvent ==  X2_ITEM_EVENT_ACTIVATE)
   {
       // Visual effect when critter bag is activated
       effect eEffect = EffectVisualEffect(VFX_FNF_NATURES_BALANCE);
       effect eFailed = EffectVisualEffect(VFX_FNF_SMOKE_PUFF);
       effect eDouble = EffectVisualEffect(VFX_FNF_PWSTUN);

       object oPC = GetItemActivator();    // The PC using pouch
       string sKey = GetPCPublicCDKey(oPC, TRUE);
       float fDice = IntToFloat(GetHitDice(oPC));

// ---- // Use a combined PC Skill check - allow bonuses
       int nLore = GetSkillRank(SKILL_LORE, oPC, FALSE);
       int nCraftTrap = GetSkillRank(SKILL_CRAFT_TRAP, oPC, FALSE);

       // Skill check is 1/3 the total of Lore + Spot
       float fCheck = IntToFloat(nCraftTrap + nLore) / 3;

   // Get targeting information
       object oTarget = GetItemActivatedTarget();
       int nObjectType = GetObjectType(oTarget);

       // Pouch variables
       int nSlot;              // We are using 10 slots
       float fCCRHolder = 0.0;       // The stored CR if slot is full
       string sNameHolder = "";
       string sResRefHolder = "";

   // If target is oPC we are checking bag stats
       if(oTarget == GetItemActivator())
       {
           for (nSlot = 1; nSlot < 11; nSlot++)
           {
               fCCRHolder = GetLocalFloat(OBJECT_SELF, "critter_cr_" + sKey + IntToString(nSlot));
               sResRefHolder = GetLocalString(OBJECT_SELF, "critter_resref_" + sKey + IntToString(nSlot));
               sNameHolder = GetLocalString(OBJECT_SELF, "critter_name_" + sKey + IntToString(nSlot));
               if (sNameHolder == "") sNameHolder = "Empty";
               SendMessageToPC(oPC, StringToRGBString("Slot " + IntToString(nSlot) + ": " +
                   sNameHolder + "  CR: " + FloatToString(fCCRHolder, 0, 2) + ".", STRING_COLOR_PINK));
           }
       SendMessageToPC(oPC, StringToRGBString("Your Craft Trap Skill = " + IntToString(nCraftTrap) + ".", STRING_COLOR_PINK));
       SendMessageToPC(oPC, StringToRGBString("Your Lore Skill = " + IntToString(nLore) + ".", STRING_COLOR_PINK));
       SendMessageToPC(oPC, StringToRGBString("Your Check vs Target CR = " + FloatToString(fCheck, 0, 2) + ".", STRING_COLOR_PINK));
       return;
       }

   // If a target is a creature, we are trying to capture
       if (oTarget != oPC && nObjectType == OBJECT_TYPE_CREATURE)
       {
       // Pouch can only be used once per turn (60 seconds) for captures
       if(GetLocalInt(OBJECT_SELF, "RECHARGE" + sKey) == 1)  {
           FloatingTextStringOnCreature(StringToRGBString(
               "The pouch is still recharging!!!", STRING_COLOR_PINK), oPC);
           return;
           }

       // Creature variables
           int nObjectType = GetObjectType(oTarget);
           float fCCR = GetChallengeRating(oTarget);
           string sResRef = GetResRef(oTarget);
           string sName = GetName(oTarget);
           float fCurrent = IntToFloat(GetCurrentHitPoints(oTarget));
           float fMax =  IntToFloat(GetMaxHitPoints(oTarget));
           float fHealth = (fCurrent/fMax);

               // Cancel if target is PC, plot or CR is too high for party
               if( GetIsPC(oTarget) || GetIsPC( GetMaster(oTarget) ) ||
                 ( HorseGetIsAMount(oTarget) && !HorseGetIsMounted(oTarget) ) ||
                 GetPlotFlag(oTarget) || fCCR > fCheck )
               {

                   FloatingTextStringOnCreature(StringToRGBString(
                       "The target creature can not be captured!!!", STRING_COLOR_PINK), oPC);
                   DelayCommand(0.5, PlayVoiceChat(VOICE_CHAT_WEAPONSUCKS, oPC));
                   return;
               }

               // Cancel if target is dead
               if(fCurrent <= 0.0) {
               FloatingTextStringOnCreature(StringToRGBString(
                   "You can not capture a corpse!!!", STRING_COLOR_PINK), oPC);
                   DelayCommand(0.5, PlayVoiceChat(VOICE_CHAT_WEAPONSUCKS, oPC));
                   return;
                   }

               // Cancel if target has too much health remaining (50%)
               // Adjust this at top of script - const float fHealthRemaining
               if(fHealth > fHealthRemaining) {
               FloatingTextStringOnCreature(StringToRGBString(
                   "The target has too much health remaining!!!", STRING_COLOR_PINK), oPC);
                   DelayCommand(0.5, PlayVoiceChat(VOICE_CHAT_WEAPONSUCKS, oPC));
                   return;
                   }

           // All checks passed so execute the capture routine
           // Apply a 1 in 10 chance the capture attempt fails
           int nBackFire = d10();
           if (nBackFire == 10) {
               FloatingTextStringOnCreature(StringToRGBString(
                   "The capture attempt has failed!!!", STRING_COLOR_PINK), oPC);
                   DelayCommand(1.5, PlayVoiceChat(VOICE_CHAT_WEAPONSUCKS, oPC));

                   // 1 in 40 chance (overall) of major failure
                   int nDoubleTrouble = d4();
                       if (nDoubleTrouble == 4)    {

                           // Copy the creature
                           object oCopy = CopyObject(oTarget, GetLocation(oTarget));
                           ApplyEffectToObject(DURATION_TYPE_INSTANT, eDouble, oTarget, 0.1f);

                           // Make both copies hostile
                           ChangeToStandardFaction(oTarget, STANDARD_FACTION_HOSTILE);
                           ChangeToStandardFaction(oCopy, STANDARD_FACTION_HOSTILE);
                           DelayCommand(0.5, PlayVoiceChat(VOICE_CHAT_THREATEN, oTarget));
                           DelayCommand(0.5, PlayVoiceChat(VOICE_CHAT_THREATEN, oCopy));
                       }
               return;
           }


           SendMessageToPC(oPC, StringToRGBString("Capture attempt activated...", STRING_COLOR_PINK));
               for (nSlot = 1; nSlot < 11; nSlot++)
               {
                   fCCRHolder = GetLocalFloat(OBJECT_SELF, "critter_cr_" + sKey + IntToString(nSlot));
                   sResRefHolder = GetLocalString(OBJECT_SELF, "critter_resref_" + sKey + IntToString(nSlot));
                   sNameHolder = GetLocalString(OBJECT_SELF, "critter_name_" + sKey + IntToString(nSlot));

                       if(sResRefHolder == "")
                       {
                           SetLocalFloat(OBJECT_SELF, "critter_cr_" + sKey + IntToString(nSlot), fCCR);
                           SetLocalString(OBJECT_SELF, "critter_resref_" + sKey + IntToString(nSlot), sResRef);
                           SetLocalString(OBJECT_SELF, "critter_name_" + sKey + IntToString(nSlot), sName);

                           SendMessageToPC(oPC, StringToRGBString("Target creature " + sName +
                               " has been captured.", STRING_COLOR_PINK));

                           ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget, 0.1f);
                           DelayCommand(2.0, PlayVoiceChat(VOICE_CHAT_CHEER, oPC));
                           DelayCommand(1.5, DestroyObject(oTarget));

                           // Set 1 minute recharge time
                           SetLocalInt(OBJECT_SELF, "RECHARGE" + sKey, 1);
                           DelayCommand(60.0, SetLocalInt(OBJECT_SELF, "RECHARGE" + sKey, 0));
                           return;
                       }
               }
       return;
       }

   // If we get this far, target was not a valid object so it must me a location and we are releasing
       location lTarget = GetItemActivatedTargetLocation();
           for (nSlot = 1; nSlot < 11; nSlot++)
           {
               fCCRHolder = GetLocalFloat(OBJECT_SELF, "critter_cr_" + sKey + IntToString(nSlot));
               sResRefHolder = GetLocalString(OBJECT_SELF, "critter_resref_" + sKey + IntToString(nSlot));
               sNameHolder = GetLocalString(OBJECT_SELF, "critter_name_" + sKey + IntToString(nSlot));

               // Release the creature in the first slot we encounter that contains one
               if(sResRefHolder != "" && fCCRHolder <= fCheck)
               {
                   // Apply effects and spawn creature
                   ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eEffect, lTarget, 0.1f);

                           SendMessageToPC(oPC, StringToRGBString("Creature " + sNameHolder +
                               " has been released.", STRING_COLOR_PINK));

                   object oCritter = CreateObject(OBJECT_TYPE_CREATURE, sResRefHolder, lTarget, FALSE);

                   // Apply a 1 in 10 chance the creature
                   // will turn hostile when released.
                   int nFaction = d10();
                   if (nFaction == 10) {
                       ChangeToStandardFaction(oCritter, STANDARD_FACTION_HOSTILE);
                       DelayCommand(0.5, PlayVoiceChat(VOICE_CHAT_THREATEN, oCritter));
                   }
                   else    {

// -------------------- // Henchman spawn
                       // HireHenchman(oPC, oCritter, TRUE);

                       // NON-Henchman spawn
                       ChangeToStandardFaction(oCritter, STANDARD_FACTION_DEFENDER);
                       AssignCommand(oCritter, ActionForceFollowObject(oPC, 3.0f));
                   }

                   // Delete the stored creature data from the release slot
                   DeleteLocalFloat(OBJECT_SELF, "critter_cr_" + sKey + IntToString(nSlot));
                   DeleteLocalString(OBJECT_SELF, "critter_resref_" + sKey + IntToString(nSlot));
                   DeleteLocalString(OBJECT_SELF, "critter_name_" + sKey + IntToString(nSlot));

                   // Creature lifespan is a random 1 - 4 minutes
                   float fLifeSpan = IntToFloat(Random(180) + 121);
                   DestroyObject(oCritter, fLifeSpan);

                   // Set 1 minute recharge time for captures
                   SetLocalInt(OBJECT_SELF, "RECHARGE", 1);
                   DelayCommand(60.0, SetLocalInt(OBJECT_SELF, "RECHARGE", 0));
                   return;
               }
           }

       // If we arrive here, the bag was empty
       SendMessageToPC(oPC, StringToRGBString("The Critter Pouch does not contain a creature you can release...", STRING_COLOR_PINK));
       ApplyEffectToObject(DURATION_TYPE_INSTANT, eFailed, oTarget, 0.1f);
   }
}
               
               

               
            

Legacy_Builder_Anthony

  • Hero Member
  • *****
  • Posts: 786
  • Karma: +0/-0
Unique Items
« Reply #9 on: July 31, 2010, 06:32:48 pm »


               I dont have the code on this computer but theres a dropable incense that kills undead.Basicly its a real small ochobo from cep table topers and i apply a vfx dust cloud to it and check if any undead are with in a certain range and kill them.I also use that small brown disk with a smoke puff coming out of the center for the icon ...i think thats in misc medium or thin.
               
               

               


                     Modifié par Builder_Anthony, 31 juillet 2010 - 05:33 .
                     
                  


            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Unique Items
« Reply #10 on: August 18, 2010, 12:27:55 am »


               Wand of Decoys


void main()
{
    object oItem = GetItemActivated();
    object oActivator = GetItemActivator();
    location lTarget = GetItemActivatedTargetLocation();
    if (GetTag(oItem) == "WandOfDecoy")
    {
        object decoy = CreateObject( OBJECT_TYPE_CREATURE , "decoy" , lTarget);
   // some special fx to go with it
        ApplyEffectAtLocation( DURATION_TYPE_INSTANT , EffectVisualEffect( VFX_FNF_SUMMON_MONSTER_1 ) , lTarget);
   // destroy it after 60 seconds
        DestroyObject( decoy , 60.0);
    }
}
               
               

               
            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Unique Items
« Reply #11 on: August 18, 2010, 12:29:51 am »


               Spellbooks as treasure...from the wiki
------------------------------------------

void openSpellBook(object spellBook, object oUser);
string lookupLevel1();
string lookupLevel2();
string lookupLevel3();
string lookupLevel4();
string lookupLevel5();
string lookupLevel6();
string lookupLevel7();
string lookupLevel8();
string lookupLevel9();
void openSpellBook(object spellBook, object oUser)
{
   string bookTag = GetTag(spellBook);
   // number of each level to create;
   int lvl1 = 0;
   int lvl2 = 0;
   int lvl3 = 0;
   int lvl4 = 0;
   int lvl5 = 0;
   int lvl6 = 0;
   int lvl7 = 0;
   int lvl8 = 0;
   int lvl9 = 0;

   // calculate the number of scrolls in the book
   int spells;
   int total = Random(100)+1;
   if (total <= 40)
       spells = 1;
   else if (total <= 63)
       spells = 2;
   else if (total <= 77)
       spells = 3;
   else if (total <= 85)
       spells = 4;
   else if (total <= 91)
       spells = 5;
   else if (total <= 95)
       spells = 6;
   else if (total <= 98)
       spells = 7;
   else if (total <= 100)
       spells = 8;
   //generate the spells;
   int rand;
   int counter;
   for (counter = 0; counter < spells; counter++)
   {
       rand = Random(100)+1;
       // low level
       if (bookTag == "minor_spellbook")
       {
           if (rand <= 50)
               lvl1++;
           else if (rand <= 95)
               lvl2++;
           else if (rand <= 100)
               lvl3++;
       }
       // mid level
       else if (bookTag == "spellbook")
       {
           if (rand <= 5)
               lvl2++;
           else if (rand <= 65)
               lvl3++;
           else if (rand <= 95)
               lvl4++;
           else if (rand <= 100)
               lvl5++;
       }
       // high level
       else if (bookTag == "major_spellbook")
       {
           if (rand <= 5)
               lvl4++;
           else if (rand <= 50)
               lvl5++;
           else if (rand <= 70)
               lvl6++;
           else if (rand <= 85)
               lvl7++;
           else if (rand <= 95)
               lvl8++;
           else if (rand <= 100)
               lvl9++;
       }
   }
WriteTimestampedLogEntry("Lvls: "+IntToString(lvl1)+" "+IntToString(lvl2)+" "+IntToString(lvl3)+" "+IntToString(lvl4)+" "+IntToString(lvl5)+" "+IntToString(lvl6)+" "+IntToString(lvl7)+" "+IntToString(lvl8)+" "+IntToString(lvl9));
WriteTimestampedLogEntry("Giving spells to: " + GetName(oUser));
   // generate the scrolls on the user
   int i;
   for (i = 0; i < lvl1; i++)
       CreateItemOnObject(lookupLevel1(), oUser, 1);
   for (i = 0; i < lvl2; i++)
       CreateItemOnObject(lookupLevel2(), oUser, 1);
   for (i = 0; i < lvl3; i++)
       CreateItemOnObject(lookupLevel3(), oUser, 1);
   for (i = 0; i < lvl4; i++)
       CreateItemOnObject(lookupLevel4(), oUser, 1);
   for (i = 0; i < lvl5; i++)
       CreateItemOnObject(lookupLevel5(), oUser, 1);
   for (i = 0; i < lvl6; i++)
       CreateItemOnObject(lookupLevel6(), oUser, 1);
   for (i = 0; i < lvl7; i++)
       CreateItemOnObject(lookupLevel7(), oUser, 1);
   for (i = 0; i < lvl8; i++)
       CreateItemOnObject(lookupLevel8(), oUser, 1);
   for (i = 0; i < lvl9; i++)
       CreateItemOnObject(lookupLevel9(), oUser, 1);

   // destroy the book
//    SetPlotFlag(spellBook, FALSE);
//    DestroyObject(spellBook);
}
string lookupLevel1()
{
   int index = Random(13);
   string out = "nw_it_sparscr";
   if (index == 0) out = out+"103";
   if (index == 1) out = out+"104";
   if (index == 2) out = out+"105";
   if (index == 3) out = out+"106";
   if (index == 4) out = out+"107";
   if (index == 5) out = out+"108";
   if (index == 6) out = out+"109";
   if (index == 7) out = out+"110";
   if (index == 8)  out = out+"111";
   if (index == 9) out = out+"112";
   if (index == 10) out = out+"113";
   if (index == 11) out = out+"114";
   if (index == 12) out = out+"211";
WriteTimestampedLogEntry(out);
   return out;
}
string lookupLevel2()
{
   int index = Random(18);
   string out = "nw_it_sparscr";
   if (index == 0) out = out+"202";
   if (index == 1) out = out+"203";
   if (index == 2) out = out+"204";
   if (index == 3) out = out+"205";
   if (index == 4) out = out+"206";
   if (index == 5) out = out+"207";
   if (index == 6) out = out+"208";
   if (index == 7) out = out+"209";
   if (index == 8)  out = out+"210";
   if (index == 9) out = out+"212";
   if (index == 10) out = out+"213";
   if (index == 11) out = out+"214";
   if (index == 12) out = out+"216";
   if (index == 13) out = out+"217";
   if (index == 14) out = out+"219";
   if (index == 15) out = out+"220";
   if (index == 16) out = out+"221";
   if (index == 17) out = out+"222";
WriteTimestampedLogEntry(out);
   return out;
}
string lookupLevel3()
{
   int index = Random(17);
   string out = "nw_it_sparscr";
   if (index == 0) out = out+"218";
   if (index == 1) out = out+"302";
   if (index == 2) out = out+"303";
   if (index == 3) out = out+"304";
   if (index == 4) out = out+"305";
   if (index == 5) out = out+"306";
   if (index == 6) out = out+"307";
   if (index == 7) out = out+"308";
   if (index == 8)  out = out+"309";
   if (index == 9) out = out+"310";
   if (index == 10) out = out+"311";
   if (index == 11) out = out+"312";
   if (index == 12) out = out+"313";
   if (index == 13) out = out+"314";
   if (index == 14) out = out+"315";
   if (index == 15) out = out+"316";
   if (index == 16) out = out+"510";
WriteTimestampedLogEntry(out);
   return out;
}
string lookupLevel4()
{
   int index = Random(17);
   string out = "nw_it_sparscr";
   if (index == 0) out = out+"302";
   if (index == 1) out = out+"402";
   if (index == 2) out = out+"403";
   if (index == 3) out = out+"404";
   if (index == 4) out = out+"405";
   if (index == 5) out = out+"406";
   if (index == 6) out = out+"407";
   if (index == 7) out = out+"408";
   if (index == 8)  out = out+"409";
   if (index == 9) out = out+"410";
   if (index == 10) out = out+"411";
   if (index == 11) out = out+"412";
   if (index == 12) out = out+"413";
   if (index == 13) out = out+"414";
   if (index == 14) out = out+"415";
   if (index == 15) out = out+"416";
   if (index == 16) out = out+"418";
WriteTimestampedLogEntry(out);
   return out;
}
string lookupLevel5()
{
   int index = Random(13);
   string out = "nw_it_sparscr";
   if (index == 0) out = out+"417";
   if (index == 1) out = out+"502";
   if (index == 2) out = out+"503";
   if (index == 3) out = out+"504";
   if (index == 4) out = out+"505";
   if (index == 5) out = out+"506";
   if (index == 6) out = out+"507";
   if (index == 7) out = out+"508";
   if (index == 8)  out = out+"509";
   if (index == 9) out = out+"511";
   if (index == 10) out = out+"512";
   if (index == 11) out = out+"513";
   if (index == 12) out = out+"514";
WriteTimestampedLogEntry(out);
   return out;
}
string lookupLevel6()
{
   int index = Random(14);
   string out = "nw_it_sparscr";
   if (index == 0) out = out+"602";
   if (index == 1) out = out+"603";
   if (index == 2) out = out+"604";
   if (index == 3) out = out+"605";
   if (index == 4) out = out+"606";
   if (index == 5) out = out+"607";
   if (index == 6) out = out+"608";
   if (index == 7) out = out+"609";
   if (index == 8)  out = out+"610";
   if (index == 9) out = out+"612";
   if (index == 10) out = out+"611";
   if (index == 11) out = out+"613";
   if (index == 12) out = out+"614";
   if (index == 13) out = out+"615";
WriteTimestampedLogEntry(out);
   return out;
}
string lookupLevel7()
{
   int index = Random(8);
   string out = "nw_it_sparscr";
   if (index == 0) out = out+"702";
   if (index == 1) out = out+"703";
   if (index == 2) out = out+"704";
   if (index == 3) out = out+"705";
   if (index == 4) out = out+"706";
   if (index == 5) out = out+"707";
   if (index == 6) out = out+"709";
   if (index == 7) out = out+"803";
WriteTimestampedLogEntry(out);
   return out;
}
string lookupLevel8()
{
   int index = Random(8);
   string out = "nw_it_sparscr";
   if (index == 0) out = out+"802";
   if (index == 1) out = out+"804";
   if (index == 2) out = out+"805";
   if (index == 3) out = out+"806";
   if (index == 4) out = out+"807";
   if (index == 5) out = out+"808";
   if (index == 6) out = out+"809";
   if (index == 7) out = out+"810";
WriteTimestampedLogEntry(out);
   return out;
}
string lookupLevel9()
{
   int index = Random(12);
   string out = "nw_it_sparscr";
   if (index == 0) out = out+"902";
   if (index == 1) out = out+"903";
   if (index == 2) out = out+"904";
   if (index == 3) out = out+"905";
   if (index == 4) out = out+"906";
   if (index == 5) out = out+"907";
   if (index == 6) out = out+"908";
   if (index == 7) out = out+"909";
   if (index == 8)  out = out+"910";
   if (index == 9) out = out+"911";
   if (index == 10) out = out+"912";
   if (index == 11) out = out+"913";
WriteTimestampedLogEntry(out);
   return out;
}
void main()
{
   object oActivated = GetItemActivated();
   object oUser = GetItemActivator();
   string oItem = GetTag(oActivated);
   if ((oItem == "spellbook") || (oItem == "minor_spellbook") || (oItem == "major_spellbook"))
   {
       openSpellBook(oActivated, oUser);
   }
}
               
               

               
            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Unique Items
« Reply #12 on: August 18, 2010, 12:32:09 am »


               

GhostOfGod wrote...



I've always liked the items that you can use to change your appearance and then use it again to change back. Fun for people who want to run around as a wolf but who are not shifters or what not.



This one would be fun for vampires. Changes the player into a bat:



#include "x2_inc_switches"

void main()

{



int nEvent =GetUserDefinedItemEventNumber();

if(nEvent !=  X2_ITEM_EVENT_ACTIVATE)return;



object oPC = GetItemActivator();

object oItem = GetItemActivated();

effect eEffect = EffectVisualEffect(VFX_IMP_DUST_EXPLOSION, FALSE);



if (GetLocalInt(oItem, "DO_ONCE") != TRUE)

   {

   SetLocalInt(oItem, "DEFAULT_APPEARANCE", GetAppearanceType(oPC));

   SetLocalInt(oItem, "DO_ONCE", TRUE);

   }



if (GetLocalInt(oItem, "STATE") == 0)

   {

   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC);

   SetCreatureAppearanceType(oPC, APPEARANCE_TYPE_BAT);

   SetLocalInt(oItem, "STATE", 1);

   }



else

   {

   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC);

   SetCreatureAppearanceType(oPC, GetLocalInt(oItem, "DEFAULT_APPEARANCE"));

   SetLocalInt(oItem, "STATE", 0);

   }

}




               
               

               
            

Legacy_Genisys

  • Hero Member
  • *****
  • Posts: 961
  • Karma: +0/-0
Unique Items
« Reply #13 on: August 23, 2010, 07:09:33 pm »


               I got a silly question mate, why not make a resource for the community instead of posting X long winded scripts which makes it rather difficult to read / follow the post..



Like, something the players can download, a module, to test it out, with an erf for each system/item to import into their own module..



Just a suggestion..
               
               

               
            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Unique Items
« Reply #14 on: August 26, 2010, 01:08:00 pm »


               Most of the time these are plug and play items. This way people can post thier own stuff and pick and choose.