RPG Crisis Community Forums: Make an enemy that gives random Treasures - RPG Maker XP - Tutorials/Scripts - RPG Crisis Community Forums

Jump to content

Make an enemy that gives random Treasures Bookmark

User is offline Jayje Athravein 

  • Member
  • PipPip
    • Group: Members
    • Posts: 13
    • Joined: 29-June 10
    • Locationwhere you least expect me
    • Time Online: 4s

    2
    0/120
    Hit Points
    0/30
    Magic Points
    80%
    Experience
    : NOVICE


    Tutorial/Script info

    • Added on: 29 July 2010 - 03:20 PM
    • Date Updated: 29 July 2010 - 03:41 PM
    • Views: 347
    Description: The quick and easy way to have an enemy that gives out random loot.

    Author:Jayje Athravein(darkcieran elsewhere)

    Difficulty: Took me about 30 mins from idea to completion



    Hey folks! I'm not sure if anyone something similar to this or not, but here goes anyway.

    Have you ever wanted to make an enemy drop random items after you beat them WITHOUT;

    A. Looking for a script?

    B. Requesting a script?

    C. Learning to script?

    This is how! It's so easy, you wonder why no one thought of this first!

    Step 1. Creating an Item Giver(IG) (monster that will be giving the random item).

    Go through the standard steps used to make your other enemies. Choose the battler, set the stats, etc. But don't, DO NOT, give it an item. (This will be cover later). make sure to remember the IG's ID

    Step 2. The Setup.

    Here's where things get interesting. Go to the Monster Group(Troops) tab in the editor, expand the array by one and create a new Troop containing you IG (call it whatever you want). Next, in the Battle Event editor, click the "Trigger" menu. Select where is says "turn" and leave it as is(which is 0 x 0) and set the frequency to "Battle Turn"

    Step 3. The System.

    Now the easy part. First set up a variable(we'll call it 'treasure') and set it to a random number between 0 and 3. Make four Conditional Branches, one for each number(0-3). The first one you leave blank, you get nothing. The second one is where you'll need to do a bit of light scripting.

    Select the Call Script function in your event editor(its the last item on the Page 3) and type in this little code snippet
    $data_enemies[enemy id].item_id = 

    Where it says enemy id, put in the IG's ID and at the right of the equal sign, put in the ID number of the item you want to give(we'll make it '1' for a potion). Repeat this step for the other number branches while changing the item ID's to whatever you choose. Try it out.

    And VIOLA! Congratulations, you've just made yourself a monster that gives different items when you beat it.

    NOTE: THIS WILL ONLY WORK ONCE PER BATTLE!!! IF YOU HAVE TWO OR MORE OF THE SAME MONSTER IN THE TROOP, YOU WILL ONLY GET TWO OF THE SAME ITEM!!!


    The good news is, you can set another monster to give away random items as well. So you can two different monsters give in two different items.

    I'll see if I can come up with a way for two of the same monster to give different random items. Unless someone beats me to it.

    I have a link to the demo showing how it works. If used, credit would be nice. Any questions feel free to hit me up. Any critiques welcome.

    http://www.4shared.c..._Item_Drop.html

    TTFN
    0
    • View members tutorials/scripts
    • RPG Maker XP

    Share:

    Powered by (IM) Tutorials 1.1.2 © 2011, by Michael McCune