Aller au contenu

Photo

Random Item Properties


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
Buddywarrior

Buddywarrior
  • Members
  • 256 messages

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!

 



#2
Buddywarrior

Buddywarrior
  • Members
  • 256 messages

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...



#3
Buddywarrior

Buddywarrior
  • Members
  • 256 messages

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.


  • kalbaern aime ceci

#4
Kato -

Kato -
  • Members
  • 392 messages

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



#5
Buddywarrior

Buddywarrior
  • Members
  • 256 messages

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


#6
Terrorble

Terrorble
  • Members
  • 194 messages

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



#7
Pstemarie

Pstemarie
  • Members
  • 2 745 messages

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.