Author Topic: 2 System For Download  (Read 648 times)

Legacy_Genisys

  • Hero Member
  • *****
  • Posts: 961
  • Karma: +0/-0
2 System For Download
« on: September 07, 2010, 04:45:08 pm »


               I recently created a forge that allows the PCs to change thier weapon from one type to another (of the same kind melee or ranged weapons), while retaining properties, for a cost...

You can check out the system here.. It's been thoroughly tested.


The Genisys Weapon Changing Forge

All My Other Content For Download
               
               

               


                     Modifié par Genisys, 08 septembre 2010 - 01:48 .
                     
                  


            

Legacy_Genisys

  • Hero Member
  • *****
  • Posts: 961
  • Karma: +0/-0
2 System For Download
« Reply #1 on: September 07, 2010, 06:30:55 pm »


               Here is yet another system I created today...

The Genisys Intelligent Item System



NOTE: Both systems were NOT originally my idea, but I thought I'd share the system with the community so they can also have these really cool ideas/system in their modules as well..  

':wizard:'  Cheers & Enjoy..   '=]'
               
               

               


                     Modifié par Genisys, 07 septembre 2010 - 06:53 .
                     
                  


            

Legacy_420

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
2 System For Download
« Reply #2 on: September 07, 2010, 06:51:01 pm »


               

Genisys wrote...

NOTE: Both systems were NOT originally my idea, but I thought I'd share the system with the community so they can also have these really cool ideas/system in their modules as well..  

Whose ideas were they?

-420
               
               

               
            

Legacy_Xovian

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
2 System For Download
« Reply #3 on: September 07, 2010, 07:03:42 pm »


               Sounds like re-writes of some old scripts, both were in HotU.

Remember the intelligent sword? Yea, it could change what weapon type it was, and the lexicon tells how to make the effect go by various tags (not just that specific weapon).



Just a guess though.
               
               

               
            

Legacy_Genisys

  • Hero Member
  • *****
  • Posts: 961
  • Karma: +0/-0
2 System For Download
« Reply #4 on: September 07, 2010, 07:52:27 pm »


               Actually, try not to be so skeptic or cynical, these are good systems, check them out before you say anything..  
Though bug reports would be most welcome..  '<img'>

I'm probably needing to work on the Intelligent item system some more, because I know I'm missing something, that script was pretty freaking long, and it's hard to follow along with all the custom controls in the include...

To answer your question 420, I saw the Weapon Changing forge in The Awakening Online Server Module, I only tried to reproduce the system, don't know who made it originally...

As far as the intelligent item system, I saw this also on an online server module, don't remember which & I don't know who made that system either, nevertheless, my version includes more options and more items that are intelligent by far..
               
               

               


                     Modifié par Genisys, 07 septembre 2010 - 07:08 .
                     
                  


            

Legacy_420

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
2 System For Download
« Reply #5 on: September 07, 2010, 11:55:51 pm »


               

Genisys wrote...

To answer your question 420, I saw the Weapon Changing forge in The Awakening Online Server Module, I only tried to reproduce the system, don't know who made it originally...

So, your code is all original is it? Somehow I find that hard to believe.

I don't want to be a skeptic or a cynic but you make it very difficult. Please give credit where it is due.

-420

EDIT: Also, it would be a lot less code if you just used the itemvalue.2da to check for item level.
               
               

               


                     Modifié par 420, 07 septembre 2010 - 10:58 .
                     
                  


            

Legacy_Genisys

  • Hero Member
  • *****
  • Posts: 961
  • Karma: +0/-0
2 System For Download
« Reply #6 on: September 08, 2010, 01:57:56 am »


               

420 wrote...

Genisys wrote...

To answer your question 420, I saw the Weapon Changing forge in The Awakening Online Server Module, I only tried to reproduce the system, don't know who made it originally...

So, your code is all original is it? Somehow I find that hard to believe.

I don't want to be a skeptic or a cynic but you make it very difficult. Please give credit where it is due.

-420

EDIT: Also, it would be a lot less code if you just used the itemvalue.2da to check for item level.


Um, what are you talking about mate, I made all of scripts from scratch yesterday & today, somehow I find what you're saying as inflmatory, however, just so you know what you posted and what I posted are 2 different things, here are my scripts for the two systems. (don't know which you are referring to)

//The Intelligent Item System Include

// gen_int_inc
//////////////////////////////////////////////
//Created By: Genisys (Guile)
//Created On: 9/06/10
///////////////////////////////////////////////////////////////////////////////
/*
   This include script has all of the functions for the Intelligent
   Item System I created for the community.

   NOTE: You MUST build your module (Scripts Only) after editing this include!
*/
///////////////////////////////////////////////////////////////////////////////
/////////////////IMPORTANT SETTINGS////////////AJUST BELOW////////////////////
/////////////////////////////////////////////////////////////////////////////

//Set this to the level increments you want to apply Bonuses for AC & AB
//example if set to 3 every 3rd level beyond 0 the PC will get a +1 Bonus
const int BONUS_INCREMENT = 4; //Default = 4 (Every 4 Levels the PC gets a bonus)

//Set this to the Maxium AC Bonus any item can have
const int MAX_AC_BONUS = 5; //Default = 5 (Max +5 Bonus)

//Set this to the Maxium Attack Bonus or Enchantment Bonus any item can have.
const int MAX_AB_BONUS = 5;  //Default = 5 (Max +5 Bonus)

//Set this to the Number of Damage Types to use on a weapon..
//Max = 8 (Damages will be: Elemental & Physical + Negative ONLY!)
//NOTE 0 = NO Damage Bonuses Will Be Added to Weapons!
const int MAX_DAMAGE_TYPES = 2; //default = 2 (2 damage types possible)

//Set this to the default type of Damage Applied to the FIRST Damage Property Type
//Use a constant (e.g.  IP_CONST_DAMAGETYPE_MAGICAL)
//Default = IP_CONST_DAMAGETYPE_SONIC (The default damage type for the 1rst Damage Type)
const int DAMAGE_TYPE_TO_USE = IP_CONST_DAMAGETYPE_SONIC;

//Set this to the maximum damage dice which is obtainable for all damage types!
//This will be scaled by level (YOU MUST USE CONSTANTS, e.g.  DAMAGE_BONUS_??)
//You may use 1d4 / 1d6 / 1d8 / 1d10 / 2d6 / 2d8 / 2d10 or 2d12 (max)
const int MAX_DAMAGE_BONUS = DAMAGE_BONUS_2d6; //Default = DAMAGE_BONUS_2d6

//Set this to the maximum Massive Criticals Damage the weapon will have..
//This will be scaled by level (YOU MUST USE CONSTANTS, e.g.  DAMAGE_BONUS_??)
//You may use 1d4 / 1d6 / 1d8 / 1d10 / 2d6 / 2d8 / 2d10 or 2d12 (max)
const int MAX_MASS_CRITICALS = DAMAGE_BONUS_2d8; //Default = DAMAGE_BONUS_2d8

//Set this to the level you wish Keen to be applied, set this to 41+ if
//don't want Keen to be applied to melee weapons (not ranged or ammunition)
const int KEEN_GAINED_AT_LEVEL = 10; //Default = 10 (Keen at level 10)

//Set this to the Maximum Save Bonus applied to Amulet & Cloak ONLY
const int MAX_SAVE_BONUS = 5; //Default = 5 (+5 Universal Saves - Max = +10)

//Set this to the Maximum Regeneration Bonus applied to Boots, Rings, & Helm Only!
const int MAX_REGENERATION_BONUS = 5; //Default = 5 (5 Regeneration - Max = +20)

//Set this to the Maximum Vampiric Regeneration Bonus applied to melee weapons
const int MAX_VAMP_REGEN = 5; //Default = 5 (5 Vampiric Regeneration Max)

//Set this constant to the constant VFX_??? you wish to use for visual
//effects applied to the PC when the Equips the intelligent item.
const int VFX_ON_EQUIP = VFX_IMP_GOOD_HELP; //Default = VFX_IMP_GOOD_HELP

//Set this constant to the constant VFX_??? you wish to use for visual
//effects applied to the PC when the Un-Equips the intelligent item.
const int VFX_ON_UN_EQUIP = VFX_FNF_NATURES_BALANCE; //Default = VFX_FNF_NATURES_BALANCE

////////////////////////////////////////////////////////////////////////////////////
//Special Settings..  (Controlling Resistance / Dmg Immunity / Dmg Reduction)

//Set this to 0 to NOT use any Damage Immunity or Resistance On Items.
//Set this to 1 to use Damage Immunity on items (3 Items Used!)
//Set this to 2 to use Damage Resistance on items  (Divided between items)
const int DAMAGE_PROTECTION_TYPE = 1;  //Default = 1 (Use Damage Immunity)

//Set this to the maximum damage resistance for PHYSICAL & ELMENTAL ONLY
//Max damage resistance on all other types = 5 Resist (see switch below)
//Note this is increments by level!  (so if you set it to IP_CONST_DAMAGERESIST_30)
//then at level 20 they would get IP_CONST_DAMAGERESIST_15 (1/2 of max)
//Default = IP_CONST_DAMAGERESIST_20  (Max Resistance Possible
const int DAMAGE_RESISTANCE_MAX = IP_CONST_DAMAGERESIST_20;

//Set this to FALSE if you do NOT wish to allow damage immunity or resistance
//for the Damages of Magical / Divine / Positive & Negative
//NOTE: Max Dmg Resist for these types = 5 (dmg immunity is set below)
const int USE_SPECIAL_DAMAGE_PROTECTION = TRUE; //Default = TRUE (Use Special Damages)

//Set this to Maximum Damage Immunity to use each 3 items! (e.g. 10% x3 = 30% max)
//Damage immunity will be distributed amoung 3 different types of items!
//Therefore Maximum = X3 Item (therefore 25% = 75% maximum Immunity)
//NOTE Damage immunity to physical uses 4 Items (2 rings, therefore if 10% = 40% Max)
const int DAMAGE_IMMUNITY_MAX = IP_CONST_DAMAGEIMMUNITY_10_PERCENT; //MAX @ 30%)

//Set this to FALSE if you do NOT wish to use Damage Reduction on ONE ITEM! (Armor)
//Damage Reducation is only used on the Boots worn by the PC..
const int USE_DAMAGE_REDUCTION = TRUE; //Default = TRUE (Use Damage Reducation)

//Set this value to the Max Damage Reduction  Power To Use!
//Default = DAMAGE_POWER_PLUS_FIVE (+5 DR Max)
const int DMG_REDUCTION_POWER_MAX = DAMAGE_POWER_PLUS_FIVE; //(+5 Max DR)

//Set this to the Max Damage to Absorb by Damage Reduction;
//Default = IP_CONST_DAMAGESOAK_20_HP
const int MAX_DMG_REDUCTION_SOAK = IP_CONST_DAMAGESOAK_20_HP; //(-/20 DR)


///////////////////////////////////////////////////////////////////////////////
////////****WARNING: DON'T TOUCH ANYTHING BELOW THIS LINE*****////////////////
/////////////////////////////////////////////////////////////////////////////

//Required Include
#include "x2_i0_spells"

//Declare all PROTOTYPES
int GetItemType(object oItem);
void GetAllProperties(object oPC, object oItem);
void RemoveAllProperties(object oPC, object oItem);
void ApplyVFX(object oPC, int nInt);

//////////////////////////////////////////////////////////////////////////////
//Define PROTOTYPE
int GetItemType(object oItem)
{
 int i = 0;
 int nType = GetBaseItemType(oItem);

 if(nType == BASE_ITEM_AMULET || nType == BASE_ITEM_ARMOR ||
    nType == BASE_ITEM_BELT || nType == BASE_ITEM_BOOTS ||
    nType == BASE_ITEM_BRACER || nType == BASE_ITEM_CLOAK ||
    nType == BASE_ITEM_HELMET || nType == BASE_ITEM_LARGESHIELD ||
    nType == BASE_ITEM_SMALLSHIELD || nType == BASE_ITEM_TOWERSHIELD ||
    nType == BASE_ITEM_RING)
 {
  i = 1; //Tell the script that the item is an Equipment Item
 }
 //Otherwise it's a weapon!
 else
 {
    i = 2; //Tell the script that the item is a Weapon
 }
 return i;
}
//////////////////////////////////////////////////////////////////////////////
//Define PROTOTYPE
void GetAllProperties(object oPC, object oItem)
{
  //Declare All Major Variables.
  int nLvl = GetHitDice(oPC);
  int nAC, nAB, nInt, nMC, nSB, nRB, nDB, nMIGHTY, nVR, nIB, nDR, nIR, nDRB;

  int nAdj = 0; //Default = No Bonus unless told otherwise..
  itemproperty iProp;
  int nType = GetItemType(oItem);
  int nBase = GetBaseItemType(oItem);
  int nWeapon = GetMeleeWeapon(oItem); //Tell us if the item is a melee wpn...

  //Determine if there are bonuses to be applied...
  if(nLvl >= BONUS_INCREMENT)
  {
    //How we will determine how many bonuses to apply to items..
    nAdj = nLvl / BONUS_INCREMENT;
  }


  //All other bonsuses are checked at every 3 levels..
  //Bonuses applied vary based upon the power of the bonus!
  if(nLvl >=3)
  {
   //Set Defaults here..
   nMIGHTY = 1;
   nSB = 1;
   nRB = 1;
   nVR = 1;
   nDB = DAMAGE_BONUS_1d4;
   nMC = DAMAGE_BONUS_1d4;
   nIB = IP_CONST_DAMAGEIMMUNITY_5_PERCENT;
   nDR = IP_CONST_DAMAGESOAK_5_HP;
   nDRB = IP_CONST_DAMAGEREDUCTION_1;
   nIR =  IP_CONST_DAMAGERESIST_5;


   nInt = nLvl/3; //Determine the bonuses that will be applied
   switch(nInt)
   {
    case 1:
    {
     nMIGHTY = 1;
     nMC = 1;
     nSB = 1;
     nRB = 1;
     nVR = 1;
     nDB = DAMAGE_BONUS_1d4;
     nMC = DAMAGE_BONUS_1d4;
     nIB = IP_CONST_DAMAGEIMMUNITY_5_PERCENT;
     nDR = IP_CONST_DAMAGESOAK_5_HP;
     nDRB = IP_CONST_DAMAGEREDUCTION_1;
     nIR =  IP_CONST_DAMAGERESIST_5;
    }break;
    case 2:
    {
     nMIGHTY = 2;
     nMC = 1;
     nSB = 1;
     nRB = 1;
     nVR = 1;
     nDB = DAMAGE_BONUS_1d6;
     nMC = DAMAGE_BONUS_1d6;
     nIB = IP_CONST_DAMAGEIMMUNITY_5_PERCENT;
     nDR = IP_CONST_DAMAGESOAK_5_HP;
     nDRB = IP_CONST_DAMAGEREDUCTION_1;
     nIR =  IP_CONST_DAMAGERESIST_5;
    }break;
    case 3:
    {
     nMIGHTY = 3;
     nMC = 2;
     nSB = 2;
     nRB = 2;
     nVR = 2;
     nDB = DAMAGE_BONUS_1d8;
     nMC = DAMAGE_BONUS_1d8;
     nIB = IP_CONST_DAMAGEIMMUNITY_10_PERCENT;
     nDR = IP_CONST_DAMAGESOAK_5_HP;
     nDRB = IP_CONST_DAMAGEREDUCTION_2;
     nIR =  IP_CONST_DAMAGERESIST_10;
    }break;
    case 4:
    {
     nMIGHTY = 4;
     nMC = 2;
     nSB = 2;
     nRB = 2;
     nVR = 2;
     nDB = DAMAGE_BONUS_1d10;
     nMC = DAMAGE_BONUS_1d10;
     nIB = IP_CONST_DAMAGEIMMUNITY_10_PERCENT;
     nDR = IP_CONST_DAMAGESOAK_10_HP;
     nDRB = IP_CONST_DAMAGEREDUCTION_2;
     nIR =  IP_CONST_DAMAGERESIST_10;
    }break;
    case 5:
    {
     nMIGHTY = 5;
     nMC = 3;
     nSB = 3;
     nRB = 3;
     nVR = 3;
     nDB = DAMAGE_BONUS_2d6;
     nMC = DAMAGE_BONUS_2d6;
     nIB = IP_CONST_DAMAGEIMMUNITY_10_PERCENT;
     nDR = IP_CONST_DAMAGESOAK_10_HP;
     nDRB = IP_CONST_DAMAGEREDUCTION_3;
     nIR =  IP_CONST_DAMAGERESIST_15;
    }break;
    case 6:
    {
     nMIGHTY = 6;
     nMC = 3;
     nSB = 3;
     nRB = 3;
     nVR = 3;
     nDB = DAMAGE_BONUS_2d6;
     nMC = DAMAGE_BONUS_2d6;
     nIB = IP_CONST_DAMAGEIMMUNITY_25_PERCENT;
     nDR = IP_CONST_DAMAGESOAK_15_HP;
     nDRB = IP_CONST_DAMAGEREDUCTION_4;
     nIR =  IP_CONST_DAMAGERESIST_15;
    }break;
    //NOTE: This is where the weapons & armor start to lose their luster!
    //The PC may simply not use the item after obtaining level 18 or higher
    //Depending upon the module items available..
    case 7:
    {
     nMIGHTY = 7;
     nMC = 4;
     nSB = 4;
     nRB = 4;
     nVR = 4;
     nDB = DAMAGE_BONUS_2d8;
     nMC = DAMAGE_BONUS_2d8;
     nIB = IP_CONST_DAMAGEIMMUNITY_25_PERCENT;
     nDR = IP_CONST_DAMAGESOAK_15_HP;
     nDRB = IP_CONST_DAMAGEREDUCTION_5;
     nIR =  IP_CONST_DAMAGERESIST_20;
    }break;
    case 8:
    {
     nMIGHTY = 8;
     nMC = 5;
     nSB = 5;
     nRB = 5;
     nVR = 5;
     nDB = DAMAGE_BONUS_2d8;
     nMC = DAMAGE_BONUS_2d8;
     nIB = IP_CONST_DAMAGEIMMUNITY_25_PERCENT;
     nDR = IP_CONST_DAMAGESOAK_20_HP;
     nDRB = IP_CONST_DAMAGEREDUCTION_6;
     nIR =  IP_CONST_DAMAGERESIST_20;
    }break;
    case 9:
    {
     nMIGHTY = 8;
     nMC = 6;
     nSB = 6;
     nRB = 6;
     nVR = 6;
     nDB = DAMAGE_BONUS_2d10;
     nMC = DAMAGE_BONUS_2d6;
     nIB = IP_CONST_DAMAGEIMMUNITY_50_PERCENT;
     nDR = IP_CONST_DAMAGESOAK_20_HP;
     nDRB = IP_CONST_DAMAGEREDUCTION_6;
     nIR =  IP_CONST_DAMAGERESIST_25;
    }break;
    case 10:
    {
     nMIGHTY = 9;
     nMC = 7;
     nSB = 7;
     nRB = 7;
     nVR = 7;
     nDB = DAMAGE_BONUS_2d10;
     nMC = DAMAGE_BONUS_2d10;
     nIB = IP_CONST_DAMAGEIMMUNITY_50_PERCENT;
     nDR = IP_CONST_DAMAGESOAK_25_HP;
     nDRB = IP_CONST_DAMAGEREDUCTION_7;
     nIR =  IP_CONST_DAMAGERESIST_25;
    }break;
    case 11:
    {
     nMIGHTY = 9;
     nMC = 8;
     nSB = 8;
     nRB = 8;
     nVR = 8;
     nDB = DAMAGE_BONUS_2d12; //Capped at Maximum 2d12 damage bonus!
     nMC = DAMAGE_BONUS_2d12; //Capped at Maximum 2d12 damage bonus!
     nIB = IP_CONST_DAMAGEIMMUNITY_50_PERCENT;
     nDR = IP_CONST_DAMAGESOAK_25_HP;
     nDRB = IP_CONST_DAMAGEREDUCTION_7;
     nIR =  IP_CONST_DAMAGERESIST_30;
    }break;
    case 12:
    {
     nMIGHTY = 10;
     nMC = 9;
     nSB = 9;
     nRB = 9;
     nVR = 9;
     nDB = DAMAGE_BONUS_2d12;
     nMC = DAMAGE_BONUS_2d12; //Capped at Maximum 2d12 damage bonus!
     nIB = IP_CONST_DAMAGEIMMUNITY_75_PERCENT; //Max Possible..
     nDR = IP_CONST_DAMAGESOAK_30_HP; //Max Possible
     nDRB = IP_CONST_DAMAGEREDUCTION_9;
     nIR =  IP_CONST_DAMAGERESIST_35;
    }break;
    case 13: //Level 39 max level used here..
    {
     nMIGHTY = 10;  //Capped at 10 Maximum!
     nMC = 10;
     nSB = 10;
     nRB = 10;
     nVR = 10;
     nDB = DAMAGE_BONUS_2d12;
     nMC = DAMAGE_BONUS_2d12; //Capped at Maximum 2d12 damage bonus!
     nIB = IP_CONST_DAMAGEIMMUNITY_75_PERCENT; //Max Possible..
     nDR = IP_CONST_DAMAGESOAK_30_HP; //Max Possible
     nDRB = IP_CONST_DAMAGEREDUCTION_10; //Max Possible..
     nIR =  IP_CONST_DAMAGERESIST_40; //Max Possible..
    }break;

   //End Switch Statement
   }

    //Cap all Properties here...
    if(nSB >= MAX_SAVE_BONUS) { nSB = MAX_SAVE_BONUS;}
    if(nRB >= MAX_REGENERATION_BONUS) { nRB = MAX_REGENERATION_BONUS;}
    if(nVR>=MAX_VAMP_REGEN) { nVR = MAX_VAMP_REGEN; }
    if(nDB>=MAX_DAMAGE_BONUS) { nDB = MAX_DAMAGE_BONUS;}
    if(nMC>=MAX_MASS_CRITICALS) { nMC = MAX_MASS_CRITICALS;}
    if(nIB>=DAMAGE_IMMUNITY_MAX) { nIB = DAMAGE_IMMUNITY_MAX;}
    if(nIR>=DAMAGE_RESISTANCE_MAX) {nIR = DAMAGE_RESISTANCE_MAX;}
    if(nDR>=MAX_DMG_REDUCTION_SOAK) { nDR = MAX_DMG_REDUCTION_SOAK;}
    if(nDRB>= DMG_REDUCTION_POWER_MAX) { nDRB = DMG_REDUCTION_POWER_MAX;}

  //End If Statement
  }


  //Ensure the AC/AB Bonuses are capped..
  if(nAdj>MAX_AC_BONUS)   {    nAC = MAX_AC_BONUS;   }
  if(nAdj>MAX_AB_BONUS)   {    nAB = MAX_AB_BONUS;   }

  //Only continue if we are in fact suppose to apply a bonus..
  if(nLvl >= 3) //Level 3 is the minimum requirement to change item..
  {
   //If it's an Equipment Item we are dealing with here..
   if(nType == 1)
   {
     //If it's an item that gets AC...
     if(nBase == BASE_ITEM_AMULET || nBase == BASE_ITEM_ARMOR ||
        nBase == BASE_ITEM_BOOTS || nBase == BASE_ITEM_CLOAK ||
        nBase == BASE_ITEM_LARGESHIELD || nBase == BASE_ITEM_SMALLSHIELD ||
        nBase == BASE_ITEM_TOWERSHIELD)
     {
      iProp = ItemPropertyACBonus(nAC);
      AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
     }
     //If it's an item that gets Regeneration
     if(nBase == BASE_ITEM_HELMET || nBase == BASE_ITEM_BOOTS || nBase == BASE_ITEM_RING)
     {
      iProp = ItemPropertyRegeneration(nRB);
      AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
     }
     //If it's an item that gets a Bonus Save
     if(nBase == BASE_ITEM_AMULET || nBase == BASE_ITEM_CLOAK)
     {
      iProp = ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_UNIVERSAL, nSB);
      AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
     }
     //If it's an item that gets Magical Damage Immunity or Resistance
     //For immunity we will use all these of these items..
     if(nBase == BASE_ITEM_CLOAK || nBase == BASE_ITEM_BRACER || nBase == BASE_ITEM_HELMET)
     {
       //If we are applying Damage Immunity
       if(DAMAGE_PROTECTION_TYPE==1)
       {
         //If we are suppose to use special damage types
         if(USE_SPECIAL_DAMAGE_PROTECTION==TRUE)
         {
           iProp = ItemPropertyDamageImmunity(IP_CONST_DAMAGETYPE_DIVINE, nIB);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageImmunity(IP_CONST_DAMAGETYPE_MAGICAL, nIB);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageImmunity(IP_CONST_DAMAGETYPE_NEGATIVE, nIB);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageImmunity(IP_CONST_DAMAGETYPE_POSITIVE, nIB);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
         }
       }
       //If we are applying Damage Resistance (to one item only!)
       else if(DAMAGE_PROTECTION_TYPE==2)
       {
         //Only applies to a cloak only!
         if(nBase == BASE_ITEM_CLOAK)
         {
          //If we are suppose to use special damage types
          if(USE_SPECIAL_DAMAGE_PROTECTION==TRUE)
          {
           //We cap damage resistance to 5 resist for these damage types..
           iProp = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_DIVINE, IP_CONST_DAMAGERESIST_5);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_MAGICAL, IP_CONST_DAMAGERESIST_5);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_NEGATIVE, IP_CONST_DAMAGERESIST_5);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_POSITIVE, IP_CONST_DAMAGERESIST_5);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
          }
         }
       }
     }
     //If it's an item that get Elemental Damage Immunity or Resistance
     //We will apply this to 3 items (resistance only applies to an amulet)
     //We use Amulet / Boots & Shield (because mages don't usually use a shield)
     if(nBase == BASE_ITEM_AMULET || nBase == BASE_ITEM_BOOTS || nBase == BASE_ITEM_TOWERSHIELD ||
        nBase == BASE_ITEM_SMALLSHIELD || nBase == BASE_ITEM_LARGESHIELD)
     {
       //If we are applying Damage Immunity
       if(DAMAGE_PROTECTION_TYPE==1)
       {
           iProp = ItemPropertyDamageImmunity(IP_CONST_DAMAGETYPE_ACID, nIB);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageImmunity(IP_CONST_DAMAGETYPE_COLD, nIB);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageImmunity(IP_CONST_DAMAGETYPE_ELECTRICAL, nIB);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageImmunity(IP_CONST_DAMAGETYPE_FIRE, nIB);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageImmunity(IP_CONST_DAMAGETYPE_SONIC, nIB);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
       }
       //If we are applying Damage Resistance
       else if(DAMAGE_PROTECTION_TYPE==2)
       {
         if(nBase == BASE_ITEM_AMULET)
         {
           iProp = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_ACID, nIR);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_COLD, nIR);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_ELECTRICAL, nIR);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_FIRE, nIR);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_SONIC, nIR);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
         }
       }
     }
     //If it's an item that gets Physical Damage Immunity or Resistance
     //We will apply Physical damage immunity to 4 types!  (including 2 rangs possible)

     if(nBase == BASE_ITEM_BELT || nBase == BASE_ITEM_ARMOR || nBase == BASE_ITEM_RING)
     {
      //If we are applying Damage Immunity
       if(DAMAGE_PROTECTION_TYPE==1)
       {
           iProp = ItemPropertyDamageImmunity(IP_CONST_DAMAGETYPE_BLUDGEONING, nIB);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageImmunity(IP_CONST_DAMAGETYPE_PIERCING, nIB);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageImmunity(IP_CONST_DAMAGETYPE_SLASHING, nIB);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
       }
       //If we are applying Damage Resistance
       if(DAMAGE_PROTECTION_TYPE==2)
       {
           iProp = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_BLUDGEONING, nIR);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_PIERCING, nIR);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
           iProp = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_SLASHING, nIR);
           AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
       }
     }

     //If we are suppose to apply Damage Reduction on Armor (only)..
     if(USE_DAMAGE_REDUCTION==TRUE)
     {
      if(nBase == BASE_ITEM_ARMOR)
      {
       iProp = ItemPropertyDamageReduction(nDRB, nDR);
       AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
      }
     }

   }
   //Otherwise if it's a Weapon we are dealing with here..
   else if(nType == 2)
   {
     //If it's a melee weapon
     if(nWeapon==TRUE)
     {
      iProp = ItemPropertyEnhancementBonus(nAB);
      AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);

      iProp = ItemPropertyMassiveCritical(nMC);
      AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);

      iProp = ItemPropertyVampiricRegeneration(nVR);
      AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);

     //Apply All Damage To Be Applied (based upon  MAX_DAMAGE_TYPES Constant)
      if(MAX_DAMAGE_TYPES>=1)
     {
      iProp = ItemPropertyDamageBonus(DAMAGE_TYPE_TO_USE, nDB);
      AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
     }
     if(MAX_DAMAGE_TYPES>=2)
     {
      iProp = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_ACID, nDB);
      AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
     }
     if(MAX_DAMAGE_TYPES>=3)
     {
      iProp = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_COLD, nDB);
      AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
     }
     if(MAX_DAMAGE_TYPES>=4)
     {
      iProp = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_ELECTRICAL, nDB);
      AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
     }
     if(MAX_DAMAGE_TYPES>=5)
     {
      iProp = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_FIRE, nDB);
      AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
     }
     if(MAX_DAMAGE_TYPES>=6)
     {
      iProp = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_SLASHING, nDB);
      AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
     }
     if(MAX_DAMAGE_TYPES>=7)
     {
      iProp = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_PIERCING, nDB);
      AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
     }
     if(MAX_DAMAGE_TYPES>=8)
     {
      iProp = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_BLUDGEONING, nDB);
      AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
     }

      //Apply Keen if they are of the proper level..
      if(nLvl>=KEEN_GAINED_AT_LEVEL)
      {
       iProp = ItemPropertyKeen();
       AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
      }

     }
     //Otherwise it's a ranged weapon or gloves...
     else
     {
      iProp = ItemPropertyAttackBonus(nAdj);
      AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);

      iProp = ItemPropertyMassiveCritical(nMC);
      AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);

      iProp = ItemPropertyMaxRangeStrengthMod(nMIGHTY);
      AddItemProperty(DURATION_TYPE_PERMANENT, iProp, oItem);
     }
   }
   //Otherwise the item is an invalid type!
   else
   {
    FloatingTextStringOnCreature("This is not a valid Intelligent Item!", oPC, FALSE);
    return;
   }

  //End If PC is Level 3 Statement..
  }
  //Otherwise tell the PC we aren't adjusting anything this level..
  else
  {
   FloatingTextStringOnCreature("You recieved no equipment bonuses this level.", oPC, FALSE);
   return;
  }

  //If the enchantment was applied, then let's prevent spamming here
  //prevent reusing this system for 3 seconds
  SetLocalInt(oPC, "ENCHANTED_INTEL", 1);
  DelayCommand(3.0, SetLocalInt(oPC, "ENCHANTED_INTEL", 0));

//PROTOTYPE END
}

//////////////////////////////////////////////////////////////////////////////
//Define PROTOTYPE
void RemoveAllProperties(object oPC, object oItem)
{
 itemproperty iProp;
 iProp = GetFirstItemProperty(oItem);
 while(GetIsItemPropertyValid(iProp))
 {
   RemoveItemProperty(oItem, iProp);

  iProp = GetNextItemProperty(oItem);
 }

//PROTOTYPE END
}

//////////////////////////////////////////////////////////////////////////////
//Define PROTOTYPE
void ApplyVFX(object oPC, int nInt)
{
  effect eVis = EffectVisualEffect(VFX_ON_EQUIP, FALSE);
  effect eVis2 = EffectVisualEffect(VFX_ON_UN_EQUIP, FALSE);

  //If the PC is Equiping the item use this VFX
  if(nInt == 1)
  {
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC, 0.0);
  }
  //Otherwise they are taking the item off, use this VFX instead..
  else
  {
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis2, oPC, 0.0);
  }
//PROTOTYPE END
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////
& This is the script that control the weapon changing forge..
//////////////////////////////////////////////////////////////////////////////////////////////////////////

// gen_wc_inc
//////////////////////////////////////////////
//Created By: Genisys (Guile)
//Created On: 9/06/10
///////////////////////////////////////////////////////////////////////////////
/*
   This include script handles the changing of all weapons..
*/
///////////////////////////////////////////////////////////////////////////////
//IMPORTANT SETTING

//Set this to the cost to change a weapon based upon level of item..
//e.g. if you set this to 100 GP the cost will be 100 GP * Weapon level
const int GOLD_COST = 500; //Default = 500 GP / Item Level

///////////////////////////////////////////////////////////////////////////////
//Required Include
#include "x2_inc_itemprop"

//////////////////////////////////////////////////////////////////////////////
//Declare All Prototypes
int GetItemLevel(object oItem);
int GetGoldValue(object oPC);
void KillOriginal(object oForge);
void ReturnNewWeapon(object o2B, object oForge, object oPC);
void GetNewWeapon(object oItem, object o2B, object oPC);
void SetProperties(object oItem, object oAnvil, object oPC);
void ChangeWeapon(object oItem, object oForge, int nInt, object oPC);

//////////////////////////////////////////////////////////////////////////////
//Define Prototypes
int GetItemLevel(object oItem)
{

   int nLevel = 0;

   int nIC = GetGoldPieceValue(oItem);

   int gp = nIC;


    //Return the level..
    if (gp<1000)
        nLevel= 1;
    if (gp>1000 && gp<1500)
        nLevel= 2;
    if (gp>1499 && gp<2500)
        nLevel= 3;
    if (gp>2499 && gp<3500)
        nLevel= 4;
    if (gp>3499 && gp<5000)
        nLevel= 5;
    if (gp>4999 && gp<7000)
        nLevel= 6;
    if (gp>6999 && gp<9000)
        nLevel= 7;
    if (gp>8999 && gp<12000)
        nLevel= 8;
    if (gp>11999 && gp<15000)
        nLevel= 9;
    if (gp>14999 && gp<20000)
        nLevel= 10;
    if (gp>19999 && gp<25000)
        nLevel= 11;
    if (gp>24999 && gp<30000)
        nLevel= 12;
    if (gp>29999 && gp<35000)
        nLevel= 13;
    if (gp>34999 && gp<40000)
        nLevel= 14;
    if (gp>39999 && gp<50000)
        nLevel= 15;
    if (gp>49999 && gp<65000)
        nLevel= 16;
    if (gp>64000 && gp<75000)
        nLevel= 17;
    if (gp>74999 && gp<90000)
        nLevel= 18;
    if (gp>89999 && gp>110000)
        nLevel= 19;
    if (gp>109999 && gp<130000)
        nLevel= 20;
    if (gp>129999 && gp<250000)
        nLevel= 21;
    if (gp>249999 && gp<500000)
        nLevel= 22;
    if (gp>499999 && gp<750000)
        nLevel= 23;
    if (gp>749999 && gp<1000000)
        nLevel= 24;
    if (gp>999999 && gp<1200000)
        nLevel = 25;
    if (gp>1999999 && gp<1400000)
        nLevel = 26;
    if (gp>1399999 && gp<1600000)
        nLevel = 27;
    if (gp>1599999 && gp<1800000)
        nLevel = 28;
    if (gp>1799999 && gp<2000000)
        nLevel = 29;
    if (gp>1999999 && gp<2200000)
        nLevel = 30;
    if (gp>2199999 && gp<2400000)
        nLevel = 31;
    if (gp>2399999 && gp<2600000)
        nLevel = 32;
    if (gp>2599999 && gp<2800000)
        nLevel = 33;
    if (gp>2799999 && gp<3000000)
        nLevel = 34;
    if (gp>2999999 && gp<3200000)
        nLevel = 35;
    if (gp>3199999 && gp<3400000)
        nLevel = 36;
    if (gp>3399999 && gp<3600000)
        nLevel = 37;
    if (gp>3599999 && gp<3800000)
        nLevel = 38;
    if (gp>3799999 && gp<4000000)
        nLevel = 39;
    if (gp>3999999)
        nLevel = 40;

    return nLevel;

//Prototype End
}

/////////////////////////////////////////////////////////////////////////////
//Define Prototype
int GetGoldValue(object oPC)
{
   //Declare All Variables
   int iGold, pGold, iLvl, nGP;
   object oWpn;
   int nState;

   object oForge = GetNearestObjectByTag("gen_wpn_forge", oPC);
   iLvl = 1; //Minimum Level of Item..

   oWpn = GetFirstItemInInventory(oForge);
   while(GetIsObjectValid(oWpn))
   {
    if(GetIsObjectValid(oWpn))
    {
     //Get the Non-Plot Item Value of an item / then turn it back to a plot item.
     nState = GetPlotFlag(oWpn);
     if(nState == TRUE)
     {
      SetPlotFlag(oWpn, FALSE);
      DelayCommand(0.5, SetPlotFlag(oWpn, TRUE));
     }
     iLvl = GetItemLevel(oWpn);
    }

    oWpn = GetNextItemInInventory(oForge);
   }

 iGold = iLvl * GOLD_COST ; //The Cost to change the weapon


 return iGold;

 //Prototype End
}

/////////////////////////////////////////////////////////////////////////////
//Define Prototype
void KillOriginal(object oForge)
{
 object oItem = GetFirstItemInInventory(oForge);
 while(GetIsObjectValid(oItem))
 {
  DestroyObject(oItem, 0.0);

  oItem = GetNextItemInInventory(oForge);
 }
 //End Prototype
}

/////////////////////////////////////////////////////////////////////////////
//Define Prototype
void ReturnNewWeapon(object o2B, object oForge, object oPC)
{

  FloatingTextStringOnCreature("Weapon changed.", oPC, FALSE);

  //Show the PC the forge is done..
  effect eVis = EffectVisualEffect(VFX_FNF_GAS_EXPLOSION_FIRE, FALSE);
  ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oForge, 0.0);

  SetIdentified(o2B, TRUE);
  CopyItem(o2B, oForge, TRUE);
  //Kill the Copy Now..
  DestroyObject(o2B, 0.3);

//End Prototype
}

/////////////////////////////////////////////////////////////////////////////
//Define Prototype
void GetNewWeapon(object oItem, object o2B, object oPC)
{
  //Declare all Variables.
  object oAnvil = GetNearestObjectByTag("gen_wc_anvil", oPC);
  object oForge = GetNearestObjectByTag("gen_wpn_forge", oPC);

  itemproperty iProp;
  iProp = GetFirstItemProperty(oItem);
  while(GetIsItemPropertyValid(iProp))
  {
    //If the item property is permanent, then apply it to the new item..
    if(GetItemPropertyDurationType(iProp)==DURATION_TYPE_PERMANENT)
    {
     AddItemProperty(DURATION_TYPE_PERMANENT, iProp, o2B, 0.0);
    }

    iProp = GetNextItemProperty(oItem);
  }

  DelayCommand(0.8, KillOriginal(oForge));
  DelayCommand(1.8, ReturnNewWeapon(o2B, oForge, oPC));

//End Prototype
}

/////////////////////////////////////////////////////////////////////////////
//Define Prototype
void SetProperties(object oItem, object oAnvil, object oPC)
{

  object o2B;
  o2B = GetFirstItemInInventory(oAnvil);
  while(GetIsObjectValid(o2B))
  {
    GetNewWeapon(oItem, o2B, oPC);
    o2B = GetNextItemInInventory(oAnvil);
  }

}
/////////////////////////////////////////////////////////////////////////////
//Define Prototype
void ChangeWeapon(object oItem, object oForge, int nInt, object oPC)
{
  //Declare all Variables.
  object oAnvil = GetNearestObjectByTag("gen_wc_anvil", oPC);
  int nType;
  string sRef;
  string sTag = GetTag(oItem);

  //Tell us the resref of a basic weapon we are changing the weapon to
  switch(nInt)
  {
   case 1: { sRef = "nw_wswbs001"; } break; //Bastard Sword
   case 2: { sRef = "nw_wswdg001"; } break; //Dagger
   case 3: { sRef = "nw_wswgs001"; } break; //Greatsword
   case 4: { sRef = "nw_wspka001"; } break; //Kama
   case 5: { sRef = "nw_wswka001"; } break; //Katana
   case 6: { sRef = "nw_wspku001"; } break; //Kukri
   case 7: { sRef = "nw_wswls001"; } break; //Longsword
   case 8: { sRef = "nw_wswrp001"; } break; //Rapier
   case 9: { sRef = "nw_wswsc001"; } break; //Scimitar
   case 10: { sRef = "nw_wswss001"; } break; //Shortsword
   case 11: { sRef = "nw_wspsc001"; } break; //Sickle
   case 12: { sRef = "x2_it_wpwhip"; } break; //Whip
   case 13: { sRef = "nw_wblcl001"; } break; //Club
   case 14: { sRef = "nw_wblfh001"; } break; //Heavy Flail
   case 15: { sRef = "nw_wblml001"; } break; //Mace
   case 16: { sRef = "nw_wblms001"; } break; //Morning Star
   case 17: { sRef = "nw_wblhl001"; } break; //Light Hammer
   case 18: { sRef = "nw_wblfl001"; } break; //Light Flail
   case 19: { sRef = "nw_wblhw001"; } break; //Warhammer
   case 20: { sRef = "nw_wdbax001"; } break; //Double Axe
   case 21: { sRef = "nw_wdbma001"; } break; //Dire Mace
   case 22: { sRef = "nw_wplhb001"; } break; //Halberd
   case 23: { sRef = "nw_wdbqs001"; } break; //Quarterstaff
   case 24: { sRef = "nw_wplsc001"; } break; //Scythe
   case 25: { sRef = "nw_wplss001"; } break; //Spear
   case 26: { sRef = "nw_wpltr001"; } break; //Trident
   case 27: { sRef = "nw_wswbs001"; } break; //Two-Bladed Sword
   case 28: { sRef = "nw_waxgr001"; } break; //Great Axe
   case 29: { sRef = "x2_wdwraxe001"; } break; //Dwarven Waraxe
   case 30: { sRef = "nw_waxbt001"; } break; //Battleaxe
   case 31: { sRef = "nw_waxhn001"; } break; //Handaxe
   case 32: { sRef = "nw_wbwxh001"; } break; //Heavy Crossbow
   case 33: { sRef = "nw_wbwxl001"; } break; //Light Crossbow
   case 34: { sRef = "nw_wbwln001"; } break; //Longbow
   case 35: { sRef = "nw_wbwsh001"; } break; //Shortbow
  }

  CreateItemOnObject(sRef, oAnvil, 1, sTag);

  DelayCommand(0.3, SetProperties(oItem, oAnvil, oPC));

}


So, is something NOT original about those two scripts I made yesterday & today?

I made others as well, but you won't find them on any boards or other modules, of that I'm fairly confident, unless I made it much like some other builder's style of coding. (doubtful considering my coding skills are rather weak by some people's opinion)
               
               

               


                     Modifié par Genisys, 08 septembre 2010 - 03:43 .