Author Topic: Random Item Properties  (Read 423 times)

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Random Item Properties
« on: February 03, 2015, 10:48:29 pm »


               

I would like to make a copy of a random item in a chest, then add a random number of random item properties on the item. 


 


Is this possible without CEP or nwnx? 


 


I'm grateful for any direction.


 


Thank you kindly!


 



               
               

               
            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Random Item Properties
« Reply #1 on: February 03, 2015, 11:07:25 pm »


               

Lexicon shows 


void main()
{
object oPC=GetPCSpeaker();

object oHelmet=GetItemInSlot(INVENTORY_SLOT_HEAD, oPC);

if (!GetIsObjectValid(oHelmet)) return;

itemproperty ipAddFeat=ItemPropertyBonusFeat(FEAT_TURN_UNDEAD);

AddItemProperty(DURATION_TYPE_PERMANENT, ipAddFeat, oHelmet);

}

 


But I don't see where I can find the list of itemproperty to add. hmmm...



               
               

               
            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Random Item Properties
« Reply #2 on: February 03, 2015, 11:21:37 pm »


               

Well, it's always right after I ask I finally find it. Ha. For those who don't know, in the script editor ITEMPROPERTY displays the 78+- properties available for all items.


               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Random Item Properties
« Reply #3 on: February 04, 2015, 06:04:28 pm »


               

Just FYI, itempropdef.2da is the place to look at for item props. The constants ITEM_PROPERTY_* that you see in the script editor each have the value of an index in itempropdef.2da.


 


 


Kato



               
               

               
            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Random Item Properties
« Reply #4 on: February 04, 2015, 11:33:17 pm »


               

Thanks Kato. I did make a case/switch for items to have properties added. I did have to break it into diff groups of item types (range weapons, armor, melee weapons etc. But it's working as intended now. 


switch(Random(14))
            {
 
            case 1: {
                        itemproperty ipAdd;
                        int charRoll = d2();    //Cha
                        ipAdd = ItemPropertyAbilityBonus(IP_CONST_ABILITY_CHA, charRoll);
                        IPSafeAddItemProperty(oItem, ipAdd);
                        break;
                    }
            case 2: {
                        itemproperty ipAdd;
                        int conRoll = d2();    //Con
                        ipAdd = ItemPropertyAbilityBonus(IP_CONST_ABILITY_CON, conRoll);
                        IPSafeAddItemProperty(oItem, ipAdd);
                        break;
                    }
 
etc etc


               
               

               
            

Legacy_Terrorble

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
Random Item Properties
« Reply #5 on: February 05, 2015, 05:56:38 am »


               

I add random enchantments the same way you show in your example.


 


I use Silicon Scout's treasure system to equip my mobs with random weapons, potions, ammo, scrolls or various other junk.  My scripts then add random enchantments to the weapons and ammo.


 


I also have random armor and item loot that is enchanted the same way and some mobs may drop it or it might be found in loot caches.


 


Add in ShadoOoW's boost system for random stats and effects and Sir Elric's random traps and the mobs, areas and loot stay interesting for quite some time.  My basic goblins are typically weak against something like Ghostly Visage because of the 5/+1 but then some goblins will start doing an energy damage type and another will have a +1AB or Enh weapon and whack you pretty good.


 


The enchantment scripts are long and a bit integrated into my module and its magic level but if you want to see them I could send you the erfs or post the code to copy.


 


T



               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
Random Item Properties
« Reply #6 on: February 05, 2015, 12:42:10 pm »


               

I have a random cursed item system that I'd be willing to share with you. Its a little different from what you're looking to do, but the core coding should be able to be easily modified for your needs. Send me a PM if interested.