Save-Point

Full Version: Save-Point
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Board Message
Sorry, you do not have permission to access this resource.
Save-Point - Random loot generation

Save-Point

Full Version: Random loot generation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok, I have been looking around for a script that can generate weapons/Armour/Items with random properties. I haven't been able to find any so I am hoping someone could turn my idea into a script.

Essentially the idea is to have a list of catagories each pertaining to a certain "part" of said item

Example
Base: (Weapon, Armour, Item)
Type: (Sword, spear, Axe, Staff, Bow)
Material: (Iron, Bronze, Mythril)
Quality: (Rusted, Normal, Well made, Superior, legendary)
Effect: (HP regen, Fire damage, Self damage, Weakening)

Of course in that example I went with weapon specific stuff after the Base. Items could have a different set up if they are selected as the Base.

Now these parts would have a different impact on the generated weapon.
Material sets the base stats
Quality effects the base stats
Effect would be enchantments and curses

So lets say you use the generator and you get A cursed rusted iron sword of Bleeding
Breaking this down it would be

Base: Weapon
Type: Sword
Material: Iron (base atk of 10)
Quality: Rusted (-3)
Effect: Bleeding (Actor takes damage when used)

I am also going to be using an item identification script by DerVVulfman and his Simple cursed equipment could probably be intergrated into this.
So cursed gear cannot be unequiped without a certain spell or NP and they don't appear as cursed until identified by an NPC.

If possible, the "Effect" part is a hidden value until the item is equipped or identified meaning the cursed rusted iron sword of bleeding would just appear to be a rusted iron sword. until the Player foolishly equips it.

I hope this makes sense.

Edit: Items wouldn't need the Material section and the quality section would use different words such as
poorly made, Normal, Well crafted, Expertly made, perfect
Sounds like a mix-n-match of a crafting system (combining the individual 'objects' to create an item) vs Diablo's Item Generation system that would entail bonuses based on the randomly generated name prefixes and suffixes.
Godly Mail of Sorcery - A suit of armor with +15 to all stats and bonus on Mana

You would likely need a lot of additional items already crafted and in your database for all the random variations.
Code:
$data_weapons       = load_data("Data/Weapons.rxdata")
    for weapon in $data_weapons
      if weapon.id > 100
        $data_weapons[weapon.id] = $data_weapons[weapon.id - (weapon.id%100)].clone
      end
      if weapon.id%100 == 1
        $data_weapons[weapon.id].str_plus = 10  # +10 strength
        $data_weapons[weapon.id].name += " of power"
      end
      if weapon.id%100 == 2
        $data_weapons[weapon.id].agi_plus = 10  # +10 agility
        $data_weapons[weapon.id].name += " of swiftness"
      end
      if weapon.id%100 == 3
        $data_weapons[weapon.id].dex_plus = 10  # +10 dexterity
        $data_weapons[weapon.id].name += " of nimbleness"
      end
      if weapon.id%100 == 4
        $data_weapons[weapon.id].int_plus = 10  # +10 intellect
        $data_weapons[weapon.id].name += " of magic"
      end
      if weapon.id%100 == 5
        $data_weapons[weapon.id].element_set = [1]  # Elemental attack is the 1st element in your game
        $data_weapons[weapon.id].name = "Blazing " + $data_weapons[weapon.id].name
      end
      if weapon.id%100 == 6
        $data_weapons[weapon.id].element_set = [2]  # Elemental attack is the 2nd element in your game
        $data_weapons[weapon.id].name = "Freezing " + $data_weapons[weapon.id].name
      end
    end
So while not exactly what my idea was, it saves time so I don;t have to enter every item manually and I can randomize via variable. Berhaps I could even set up variable/conditions on a common event to emulate the selection process I explained.