Announcement

Collapse
No announcement yet.

Super Efficient Random Treasure System

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Super Efficient Random Treasure System

    I would like to present my super memory efficient random treasure system. It is featured in the game I recently uploaded "Runewind Saga 1" With this system you can easily have 300+ random treasures and spend hardly any memory on them. Its also safe from exploits.

    The random treasure itself is just rolling the item number variable or a couple ranges of the item number variable. This is saved in a temp variable and put between display buy list and buy item in a merchant script specifically designed for this. You need to make a bogus item called "Take Treasure."

    But theres more. This system is so efficient we can safely do away with having a flag for every chest, except your specific treasures that is. Basically we use a flag for each actual chest event and a variable that counts the number of random loot in a dungeon. You still can't open the same chest again unless you leave the dungeon, enter a whole new dungeon, then come back. You still need to explore the whole dungeon to find special treasures that might be intermingled with the random ones, so going to a new dungeon and then coming back just to exploit this is really a stupid idea.


    Lets start with what you will need:

    flags:
    1 for each chest event
    5 or more temp flags for when 1 chest is used more then once in same place.

    Variables:
    1 for every dungeon. It begins at the max number of random treasure in that dungeon.
    1 temp variable for the calculation of whether there are treasures left to find.
    1 "last world" variable to organize when chest flags are reset.

    Scripts:
    1 for each chest event.
    1 to sort the world, reduce each dungeons variable, give the ok for treasure
    1 random treasure script that sets up the item number
    1 called script that resets all flags. (or just use the command in each enter map)
    1 chest closing script called at the end of each chest script.
    1 special merchant script designed for treasures

    Events: 1 for each chest.


    Script: enter map (add the following condition)

    Condition: Last world is different then current world
    Reset all random chest flags to off.
    Variable: Last world = current world
    Condition end.

    (use this condition only when you enter dungeons. Do not use it on your enter world, or enter town. If you use a single enter you need to disqualify the number of your world map. If you don't use a world map you may need to make this even more complicated.)


    Script: random chest

    temp variable = -1
    Sort: world number
    apply if 1
    variable: dungeon 1 = dungeon 1 - 1
    temp variable = dungeon 1
    to end
    (other branches)
    branch end
    Condition: temp variable is 0 or higher
    script call: random treasure
    Condition end

    (This reduces a dungeon variable, copies it to temp, then checks if there is random treasure left in that dungeon. If there is random treasure is called)


    script: random treasure

    Treasure = 1 ? 1000
    Condition: Treasure is higher then 980
    item number 1 ? 10 (item numbers of rare treasures)
    force script to end
    condition end
    Condition: treasure is higher then 700
    item number 20 ? 30 (item numbers of good treasures)
    force script to end
    condition end
    (other conditions like these two)
    item number 50 ? 80 (common items)


    Script: Chest 1 (and another for each chest event you have)

    item number = 0 (item 0 should be a bogus item called nothing)
    sound effects
    event: change direction leader
    event single action (chest opening)

    sort: world number (for specific chests found in that dungeon)
    apply if
    conditon: specific flag is off
    specific flag turns on
    item number = specific treasure
    conditon end
    to end
    apply if
    conditon: room in dungeon = number. (for multiple uses of chest 1)
    conditon: specific flag is off
    specific flag turns on
    item number = specific treasure
    conditon end
    condition end
    to end
    branch end

    Condition: item number is still 0
    Conditon: chest 1 flag is off
    chest 1 flag turns on
    script call: random chest
    conditon end
    condition end

    merchant script: 4 items (0 buy/sell price. use special merchant script)
    *wait for script to end (Trust me, use this command here)
    script call: chest closure
    event control: start off

    script: chest closure

    item info load
    get item name
    display common name
    text: was found.


    Script: merchant script

    Temp Variable = Item Number
    Display Buy list

    Repeat Branch - if Quantity is 2 or higher
    Display Buy List
    Condition end (to prevent taking more then 1 item)

    Item Number = Temp Variable
    Display Who List
    (add branches for if member is carrying too many things)
    Buy Item

    (Thats the basic version of my merchant script. Mine sorts the items Take Treasure, give treasure, destroy chest, and nothing, as well as locked chests where these options come before the chest opened as well as after it. "Give treasure" sells a treasure its used for when the chest is a mimic and you don't want to fight it. "Destroy chest" is used when the chest is blocking your way. It will destroy the item inside. Ideally its used after the item is taken. "Nothing" leaves the chest alone. When the chest is locked you can leave it alone till you have a thief. If you try to bash it open the item inside might be destroyed.)

    * wait for script to end: without this command the script will continue while you are still buying things. Its interesting to note, if you have a battle after a merchant list the merchant list will be active and happening at the same time as the battle. When you select an item to buy you will also be telling your team mates to attack lol. I've yet to find anything useful to do with this and it only works for event battles.


    HOW MUCH MEMORY DID I USE:

    Random Chest 2928 (sorting 39 dungeons)
    Random Treasure 1030
    Merchant Script 1248
    Chest 1 1360
    Chest 2 464
    Chest 3 1184
    Chest 4 1344
    Chest 5 672
    Chest 6 656
    Chest 7 1392
    Chest 8 528
    Chest 9 1312 (locked)
    Chest 10 1088 (locked)

    Total dungeons: 39
    Estimated Treasures: 400+
    Total Memory: 15,206

    Compared to the standard method for 400 chests:
    Flag, condition, and giving the item for 400 chests: 64x400= 25600
    Standard sorting for 39 dungeons: 26x39+14= 1028 x 10 chests = 10280
    (If you don't use 10 chest scripts then to have more then 1 chest in a single place you would have to start sorting party direction anyway)

    Total memory of standard method for 400 chests: 35,880

    You save about 50%, but theres no limit for the amount of random treasure you can have with my system. If you have 1000 chests but the same number of dungeons compare 15,208 to 74,280. You save about 80%!
    Last edited by Catharsis; 09-03-2008, 04:44 AM. Reason: Minor corrections
    "Reality is merely an Illusion, albeit a persistent one." -Albert Einstein.

    #2
    Re: Super Efficient Random Treasure System

    I use RPGM3 almost exclusively, so I really cannot follow exactly what you've done, but I did want to give you props for arriving here and contributing to the community so quickly. I know you're not really a newbie pe se, as you've been at Doan's, and have been working on your game for some time (a year or more, right?), but it's refreshing to see a new member come in and try to help everyone else.


    Again, welcome, and I hope you enjoy your stay, and stick around for a while. Especially because your spelling and grammar seem to be impeccable, which is another rarity.

    Comment


      #3
      Re: Super Efficient Random Treasure System

      This sounds really cool cause we all need to conserve memory. My only question is does this draw on the whole item list? cause then in the first dungeon they could get some ultra mega end game item.

      Comment


        #4
        Re: Super Efficient Random Treasure System

        Very well done, kudos to you!

        Comment


          #5
          Re: Super Efficient Random Treasure System

          Originally posted by OrinMaxden View Post
          This sounds really cool cause we all need to conserve memory. My only question is does this draw on the whole item list? cause then in the first dungeon they could get some ultra mega end game item.
          Catharsis hasn't been around for a while, but my understanding is that you can roll within a certain "range of items," so you can either make a bunch of this type of script, for different dungeons/segments of the game, or just make sure nothing amazingly powerful is included in that range.


          How Badly Do You Want It? (VX Ace) is now available for download! - no outside software necessary.

          "I live and love in God's peculiar light." - Michelangelo

          Comment

          Working...
          X