How do I get a Room to spawn a Random amount of bolts?

Discussion in 'Modding' started by Arron Syaoran, Jul 23, 2014.

  1. Arron Syaoran

    Arron Syaoran Member

    Code:
    <!-- might need amount flag -->
    <loot type="bolts" x="18" y="2" />
    This only spawns 1 Random Typed Bolt. How do I spawn a random QUANTITY of bolts in a room?
     
  2. bluehinter

    bluehinter Member

    What do you have your maxstack set to in your itemDB file?

    I've hardly played around with bolts at all, but I thought if you left amount="10" or whatever out of your <loot /> line, then it should automatically default to a random amount between 1 and the number you set as your maxstack. (So if maxstack="3" then you should encounter random stacks of 1, 2, or 3 bolts.)

    If you left maxstack out, then it may just be defaulting to 1.
     
  3. Arron Syaoran

    Arron Syaoran Member

    When I said random bolts, I also meant random Kind of Bolt as well as Random Quantity.(Meaning it could use BOMD, Copper bolt, Barbed Steel Bolt, Plastic Bolt, Modded Bolts, Any Bolt. Quantity has to be somewhat random as well)

    EDIT: I'VE NOTICED THAT IN THE VANILLA ITEM.DB THAT MOST BOLTS DON'T HAVE A MAXSTACK TAG. This could prove problematic. I'll try amount="10" anyway.
     
    Last edited: Jul 27, 2014
  4. Bohandas

    Bohandas Member

    I don't know how to spawn a random quantity of bolts all in a single stack, but if you don't mind them showing up on the ground as seperate stacka you could simply have multiple stacks of bolts all on the same square or whatever that each have a chance of not spawning. So instead of, for instance, a stack of 1-3 bolts you could simply make 1-3 stacks of one bolt each (which for most purposes is functionally equivalent since they'll be grouped together once they're in your inventory) by giving the second and third stack a chance of not appearing.

    Edit:
    To randomize type as well, you would need to make several spells that do the above (one for each bolt type you want as possible outcomes) and another spell that randomly picks between them. To make a room do this, have it cast this last spell when the player enters.