Author Topic: Dynamic Item properties  (Read 392 times)

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Dynamic Item properties
« on: June 26, 2011, 08:51:29 pm »


               Im using Silicon Scouts Treasure System in my mod and works well for me. as you know the system pulls loot from stores.  Is it possible to create a store, fill it full of items with no properties and have some script / system add random properties on each item that is pulled from the store. and be able to set max and min properties.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Dynamic Item properties
« Reply #1 on: June 26, 2011, 09:14:46 pm »


               Possible? Sure. Simple to do? Not remotely. '<img'> NWNX for linux helps, since you can make item properties directly by inputting all 6 values (ip, subtype, cval table, cval, pval table, pval) using DirectIP, instead of using the somewhat clunky bioware functions. Creating a system that did this for our items took me a good 4 months, though you could make something simpler far faster. It depends on just how much you want it to do - how many types of random properties, range on the added props, and so on.

Funky
               
               

               


                     Modifié par FunkySwerve, 26 juin 2011 - 08:15 .
                     
                  


            

Legacy_Xardex

  • Sr. Member
  • ****
  • Posts: 414
  • Karma: +0/-0
Dynamic Item properties
« Reply #2 on: June 26, 2011, 10:07:24 pm »


               Creating random properties to put into an item is incredibly simple and doesn't require nwnx by a long shot.  I find nothing 'clunky' about the biowares functions.


The most simple system that works well enough is one that creates first the number of properties, then which properties, checking that there wont be doubles, and then values for those properties. All of them can be made to scale by variable X, which can be the NPC level, time of day or whatever. (your min/max)

Its repetitive job, but wont take a day. The thing that will take time is balancing it, but one hint that I can give you is that you have to allow it to create utterly useless items. If you do that, players wont mind since they will still find their good items often enough, but it will save you a boatload of trouble.
               
               

               
            

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Dynamic Item properties
« Reply #3 on: June 26, 2011, 10:08:57 pm »


               Thanks Funky but well over my head i'm affraid
               
               

               
            

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Dynamic Item properties
« Reply #4 on: June 26, 2011, 10:12:44 pm »


               Xardex,
Im no scripter by a long shot, where would I even begin
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Dynamic Item properties
« Reply #5 on: June 27, 2011, 12:00:18 am »


               Firstly decide what properties you want to allow, then open, I think, nwscript. It is a script, DONT CHANGE THAT SCRIPT, didn't want to holler, just wanted to impress the idea of not changing that script. You can use that script as a reference to the ip numbers. Then do something like this:

Melee Weapons:
prop 1
prop 2
prop 3
..............so on and so forth ............

Ranged Weapons:
prop 1
prop 2
prop 3
............so on and so forth...............................

Helms:
blah blah blah

Best to start out small, sorry I don't have the time to work anything up for you. Twixt school, being a single parent and all but here is a small sample.

void main()
{
int nRandom = Random(6);    //will give psuedorandom number
int nMelee = GetIsMeleeWeapong(Get_The_Item_To_Be_Tweaked); //will detemine if melee wep
int nRanged = GetIsRangedWep(blah, blah);
int nType  = GetObjectType(Same_as_above);

switch(object_type)
{//switch the different types you will allow for props
case helm:
    switch(random)
     {
       case 1:  add xxx prop;
                    break;
       case 2: add xxx prop;
                   break;
     }
     break;
 case ranged wep:
     switch(random)
     {
      case 1: add xxx prop;
                   break;
        so on and so forth
     }
}

}
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Dynamic Item properties
« Reply #6 on: June 27, 2011, 12:13:14 am »


               After making my own forge system and random property generator, I'm going to have to agree with Funky on this one. It completely depends on your module. What types of properties, how many properties(max amount), do you want the properties to reflect the players classes, do you want the number of properties to reflect the players current level? What about skill/attribute/ac/ab properties, and amounts of those, will these have anything to do with player level/class?

Sure for a super simple system it could take a day. But if you want something with a bit of life or detail it's not going to be simple and may take awhile.
               
               

               
            

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Dynamic Item properties
« Reply #7 on: June 27, 2011, 10:15:45 am »


               Well I was kinda hoping that there was something out there that could be tweeked, You guys know your stuff and if your saying it's gonna be a big project then I have no chance. '<img'>

Thnaks Anyway
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Dynamic Item properties
« Reply #8 on: June 27, 2011, 10:29:42 am »


               

Xardex wrote...

Creating random properties to put into an item is incredibly simple and doesn't require nwnx by a long shot. I find nothing 'clunky' about the biowares functions.

If you read my post, you saw that I didn't say this required nwnx. I simply said that it helps, and it does - immensely. What I said would not confuse you in the least had you actually used the functionality I was talking about. It saves you having to write CLUNKY functions like this one, which is both rediculously long and forces you to check what each parameter is:


itemproperty ItemPropertyDynamic (int nType, int nParam1=0, int nParam2=0, int nParam3=0) {
    switch (nType) {
        case ITEM_PROPERTY_ABILITY_BONUS:
            return ItemPropertyAbilityBonus(nParam1, nParam2);

        case ITEM_PROPERTY_AC_BONUS:
            return ItemPropertyACBonus(nParam1);

        case ITEM_PROPERTY_AC_BONUS_VS_ALIGNMENT_GROUP:
            return ItemPropertyACBonusVsAlign(nParam1, nParam2);

        case ITEM_PROPERTY_AC_BONUS_VS_DAMAGE_TYPE:
            return ItemPropertyACBonusVsDmgType(nParam1, nParam2);

        case ITEM_PROPERTY_AC_BONUS_VS_RACIAL_GROUP:
            return ItemPropertyACBonusVsRace(nParam1, nParam2);

        case ITEM_PROPERTY_AC_BONUS_VS_SPECIFIC_ALIGNMENT:
            return ItemPropertyACBonusVsSAlign(nParam1, nParam2);

        case ITEM_PROPERTY_ADDITIONAL:
            return ItemPropertyAdditional(nParam1);

        case ITEM_PROPERTY_ENHANCEMENT_BONUS:
            return ItemPropertyEnhancementBonus(nParam1);

        case ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_ALIGNMENT_GROUP:
            return ItemPropertyEnhancementBonusVsAlign(nParam1, nParam2);

        case ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_RACIAL_GROUP:
            return ItemPropertyEnhancementBonusVsRace(nParam1, nParam2);

        case ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_SPECIFIC_ALIGNEMENT:
            return ItemPropertyEnhancementBonusVsSAlign(nParam1, nParam2);

        case ITEM_PROPERTY_DECREASED_ENHANCEMENT_MODIFIER:
            return ItemPropertyEnhancementPenalty(nParam1);

        case ITEM_PROPERTY_BASE_ITEM_WEIGHT_REDUCTION:
            return ItemPropertyWeightReduction(nParam1);

        case ITEM_PROPERTY_BONUS_FEAT:
            return ItemPropertyBonusFeat(nParam1);

        case ITEM_PROPERTY_BONUS_SPELL_SLOT_OF_LEVEL_N:
            return ItemPropertyBonusLevelSpell(nParam1, nParam2);

        case ITEM_PROPERTY_CAST_SPELL:
            return ItemPropertyCastSpell(nParam1, nParam2);

        case ITEM_PROPERTY_DAMAGE_BONUS:
            return ItemPropertyDamageBonus(nParam1, nParam2);

        case ITEM_PROPERTY_DAMAGE_BONUS_VS_ALIGNMENT_GROUP:
            return ItemPropertyDamageBonusVsAlign(nParam1, nParam2, nParam3);

        case ITEM_PROPERTY_DAMAGE_BONUS_VS_RACIAL_GROUP:
            return ItemPropertyDamageBonusVsRace(nParam1, nParam2, nParam3);

        case ITEM_PROPERTY_DAMAGE_BONUS_VS_SPECIFIC_ALIGNMENT:
            return ItemPropertyDamageBonusVsSAlign(nParam1, nParam2, nParam3);

        case ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE:
            return ItemPropertyDamageImmunity(nParam1, nParam2);

        case ITEM_PROPERTY_DECREASED_DAMAGE:
            return ItemPropertyDamagePenalty(nParam1);

        case ITEM_PROPERTY_DAMAGE_REDUCTION:
            return ItemPropertyDamageReduction(nParam1, nParam2);

        case ITEM_PROPERTY_DAMAGE_RESISTANCE:
            return ItemPropertyDamageResistance(nParam1, nParam2);

        case ITEM_PROPERTY_DAMAGE_VULNERABILITY:
            return ItemPropertyDamageVulnerability(nParam1, nParam2);

        case ITEM_PROPERTY_DARKVISION:
            return ItemPropertyDarkvision();

        case ITEM_PROPERTY_DECREASED_ABILITY_SCORE:
            return ItemPropertyDecreaseAbility(nParam1, nParam2);

        case ITEM_PROPERTY_DECREASED_AC:
            return ItemPropertyDecreaseAC(nParam1, nParam2);

        case ITEM_PROPERTY_DECREASED_SKILL_MODIFIER:
            return ItemPropertyDecreaseSkill(nParam1, nParam2);

        case ITEM_PROPERTY_ENHANCED_CONTAINER_REDUCED_WEIGHT:
            return ItemPropertyContainerReducedWeight(nParam1);

        case ITEM_PROPERTY_EXTRA_MELEE_DAMAGE_TYPE:
            return ItemPropertyExtraMeleeDamageType(nParam1);

        case ITEM_PROPERTY_EXTRA_RANGED_DAMAGE_TYPE:
            return ItemPropertyExtraMeleeDamageType(nParam1);

        case ITEM_PROPERTY_HASTE:
            return ItemPropertyHaste();

        case ITEM_PROPERTY_HOLY_AVENGER:
            return ItemPropertyHolyAvenger();

        case ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS:
            return ItemPropertyImmunityMisc(nParam1);

        case ITEM_PROPERTY_IMPROVED_EVASION:
            return ItemPropertyImprovedEvasion();

        case ITEM_PROPERTY_SPELL_RESISTANCE:
            return ItemPropertyBonusSpellResistance(nParam1);

        case ITEM_PROPERTY_SAVING_THROW_BONUS:
            return ItemPropertyBonusSavingThrowVsX(nParam1, nParam2);

        case ITEM_PROPERTY_SAVING_THROW_BONUS_SPECIFIC:
            return ItemPropertyBonusSavingThrow(nParam1, nParam2);

        case ITEM_PROPERTY_KEEN:
            return ItemPropertyKeen();

        case ITEM_PROPERTY_LIGHT:
            return ItemPropertyLight(nParam1, nParam2);

        case ITEM_PROPERTY_MATERIAL:
            return ItemPropertyMaterial(nParam1);

        case ITEM_PROPERTY_MIGHTY:
            return ItemPropertyMaxRangeStrengthMod(nParam1);

        case ITEM_PROPERTY_MIND_BLANK:
            break;

        case ITEM_PROPERTY_NO_DAMAGE:
            return ItemPropertyNoDamage();

        case ITEM_PROPERTY_ON_HIT_PROPERTIES:
            return ItemPropertyOnHitProps(nParam1, nParam2, nParam3);

        case ITEM_PROPERTY_QUALITY:
            return ItemPropertyQuality(nParam1);

        case ITEM_PROPERTY_DECREASED_SAVING_THROWS:
            return ItemPropertyReducedSavingThrowVsX(nParam1, nParam2);

        case ITEM_PROPERTY_DECREASED_SAVING_THROWS_SPECIFIC:
            return ItemPropertyReducedSavingThrow(nParam1, nParam2);

        case ITEM_PROPERTY_REGENERATION:
            return ItemPropertyRegeneration(nParam1);

        case ITEM_PROPERTY_SKILL_BONUS:
            return ItemPropertySkillBonus(nParam1, nParam2);

        case ITEM_PROPERTY_IMMUNITY_SPECIFIC_SPELL:
            return ItemPropertySpellImmunitySpecific(nParam1);

        case ITEM_PROPERTY_IMMUNITY_SPELL_SCHOOL:
            return ItemPropertySpellImmunitySchool(nParam1);

        case ITEM_PROPERTY_THIEVES_TOOLS:
            return ItemPropertyThievesTools(nParam1);

        case ITEM_PROPERTY_ATTACK_BONUS:
            return ItemPropertyAttackBonus(nParam1);

        case ITEM_PROPERTY_ATTACK_BONUS_VS_ALIGNMENT_GROUP:
            return ItemPropertyAttackBonusVsAlign(nParam1, nParam2);

        case ITEM_PROPERTY_ATTACK_BONUS_VS_RACIAL_GROUP:
            return ItemPropertyAttackBonusVsRace(nParam1, nParam2);

        case ITEM_PROPERTY_ATTACK_BONUS_VS_SPECIFIC_ALIGNMENT:
            return ItemPropertyAttackBonusVsSAlign(nParam1, nParam2);

        case ITEM_PROPERTY_DECREASED_ATTACK_MODIFIER:
            return ItemPropertyAttackPenalty(nParam1);

        case ITEM_PROPERTY_UNLIMITED_AMMUNITION:
            return ItemPropertyUnlimitedAmmo(nParam1);

        case ITEM_PROPERTY_USE_LIMITATION_ALIGNMENT_GROUP:
            return ItemPropertyLimitUseByAlign(nParam1);

        case ITEM_PROPERTY_USE_LIMITATION_class:
            return ItemPropertyLimitUseByclass(nParam1);

        case ITEM_PROPERTY_USE_LIMITATION_RACIAL_TYPE:
            return ItemPropertyLimitUseByRace(nParam1);

        case ITEM_PROPERTY_USE_LIMITATION_SPECIFIC_ALIGNMENT:
            return ItemPropertyLimitUseBySAlign(nParam1);

        case ITEM_PROPERTY_USE_LIMITATION_TILESET:
            break;

        case ITEM_PROPERTY_REGENERATION_VAMPIRIC:
            return ItemPropertyVampiricRegeneration(nParam1);

        case ITEM_PROPERTY_TRAP:
            return ItemPropertyTrap(nParam1, nParam2);

        case ITEM_PROPERTY_TRUE_SEEING:
            return ItemPropertyTrueSeeing();

        case ITEM_PROPERTY_ON_MONSTER_HIT:
            return ItemPropertyOnMonsterHitProperties(nParam1, nParam2);

        case ITEM_PROPERTY_TURN_RESISTANCE:
            return ItemPropertyTurnResistance(nParam1);

        case ITEM_PROPERTY_MASSIVE_CRITICALS:
            return ItemPropertyMassiveCritical(nParam1);

        case ITEM_PROPERTY_FREEDOM_OF_MOVEMENT:
            return ItemPropertyFreeAction();

        case ITEM_PROPERTY_POISON:
            break;

        case ITEM_PROPERTY_MONSTER_DAMAGE:
            return ItemPropertyMonsterDamage(nParam1);

        case ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL:
            return ItemPropertyImmunityToSpellLevel(nParam1);

        case ITEM_PROPERTY_SPECIAL_WALK:
            return ItemPropertySpecialWalk(nParam1);

        case ITEM_PROPERTY_HEALERS_KIT:
            return ItemPropertyHealersKit(nParam1);

        case ITEM_PROPERTY_WEIGHT_INCREASE:
            return ItemPropertyWeightIncrease(nParam1);

        case ITEM_PROPERTY_ONHITCASTSPELL:
            return ItemPropertyOnHitCastSpell(nParam1, nParam2);

        case ITEM_PROPERTY_VISUALEFFECT:
            return ItemPropertyVisualEffect(nParam1);

        case ITEM_PROPERTY_ARCANE_SPELL_FAILURE:
            return ItemPropertyArcaneSpellFailure(nParam1);

        case ITEM_PROPERTY_INVIS_VALUE_DECREASE:
            return ItemPropertyInvisValueDecrease(nParam1);

        case ITEM_PROPERTY_INVIS_BONUS_FEAT:
            return ItemPropertyInvisBonusFeat(nParam1);
    }

    itemproperty ip;
    return ip;
}

Instead, you can just do this, and know in advance what all 6 inputs are:


itemproperty ItemPropertyDirect (int nType, int nSubType, int nCostTable, int nCostValue, int nParamTable, int nParamValue) {
    itemproperty ip = ItemPropertyAdditional(0);

    SetItemPropertyInteger(ip, 0, nType);
    SetItemPropertyInteger(ip, 1, nSubType);
    SetItemPropertyInteger(ip, 2, nCostTable);
    SetItemPropertyInteger(ip, 3, nCostValue);
    SetItemPropertyInteger(ip, 4, nParamTable);
    SetItemPropertyInteger(ip, 5, nParamValue);

    return ip;
}
No, the vanilla way isn't clunky AT ALL. ':lol:' There's a reason the nwnx devs add the functions they do.

Funky
               
               

               


                     Modifié par FunkySwerve, 27 juin 2011 - 09:30 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Dynamic Item properties
« Reply #9 on: June 27, 2011, 10:40:34 am »


               

Madasahatter wrote...

Well I was kinda hoping that there was something out there that could be tweeked, You guys know your stuff and if your saying it's gonna be a big project then I have no chance. '<img'>

Thnaks Anyway


I don't normally like to scare people off from trying things, but I know how many things you're already juggling, and I seriously advise against messing with this right now. Aside from the setup time, what you do and how you do it will have consequences down the road. Suppose you want to add item banking to your mod. You'd have to go object-based rather than resref based, unless you store an encoding string on the item when you make your changes.

Funky