Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Random treasure contents?

MarisaG

Villager
Xy$
0.00
Does anyone have script to give random treasure contents? That is, i can set what can possibly be granted and a quantity of each so both gold and potions can be granted at the same time. Anyone have this yet?
 

Dad3353

Praised Adventurer
@MarisaG ...

Not a Script, but a Common Event (or rather, a few Common Events...). I have random Rewards distributed as either various Foods, depending on Level, or Gold, or various Minerals, maybe even a Bite from a Jackanapes if one is unlucky..! Here's the main Common Event, with Comments; I'd gladly explain more if it suits your needs...
◆Comment:Decides random freebie given by elements of decor, then disappears.
: :Returns on next entering Map.

◆If:Bad_Luck > Out_Of_Luck_Limi
◆Comment:If too much Bad Luck of late, limit the rewards to good ones...
◆Control Variables:#0020 Dumm_Rand = Random 5..8

:Else
◆Comment:All rewards, even bad ones...
◆Control Variables:#0020 Dumm_Rand = Random 1..10

:End
◆If:Dumm_Rand ≤ 5
◆Comment:Maybe Food..?
◆If:Bad_Luck > Out_Of_Luck_Limi
◆Comment:If too much Bad Luck of late, find food...
◆Common Event:Foun_Food
◆Control Variables:#0010 Bad_Luck = 0
◆Erase Event
◆Jump to Label:End_One_Shot_Deci_Food

:Else
◆Comment:Find food, or nothing...
◆Control Variables:#0020 Dumm_Rand = Random 1..3
◆If:Dumm_Rand > 2
◆Control Variables:#0010 Bad_Luck = 0
◆Common Event:Foun_Food
◆Erase Event
◆Jump to Label:End_One_Shot_Deci_Food

:Else
◆Comment:Finds Nothing, this time; Bad Luck incremented...
◆Control Variables:#0010 Bad_Luck += 1
◆Text:None, Dim, Bottom
: :\N[1] finds nothing..!
◆Erase Event
◆Jump to Label:End_One_Shot_Deci_Food

:End

:End
◆Jump to Label:End_One_Shot_Deci_Food

:End
◆If:Dumm_Rand ≤ 7
◆Comment:Finds Gold, Bad Luck is reset...
◆Control Variables:#0010 Bad_Luck = 0
◆Control Variables:#0020 Dumm_Rand = Random 5..25
◆Change Gold:+ {Dumm_Rand}
◆Text:None, Dim, Bottom
: :\N[1] uncovers \V[20] \G..!
◆Erase Event
◆Jump to Label:End_One_Shot_Deci_Food

:End
◆If:Dumm_Rand = 8
◆Comment:Finds Mineral, but which one..?
◆Control Variables:#0020 Dumm_Rand = Random 1..6
◆If:Dumm_Rand = 1
◆Comment:Finds Mithril.
◆Change Items:Mithril + {Dumm_Rand}
◆Text:None, Dim, Bottom
: :\N[1] discovers \V[20] Mithril..!
◆Control Variables:#0008 Dumm_Value = The number of Mithril
◆If:Dumm_Value ≥ 99
◆Comment:Too much already found, no room for more...
◆Text:None, Dim, Bottom
: :\N[1] can't carry any more.
: :Maybe put them into Store..?

:End
◆Erase Event
◆Jump to Label:End_One_Shot_Deci_Food

:Else
◆If:Dumm_Rand ≤ 3
◆Comment:Finds Zircon.
◆Control Variables:#0020 Dumm_Rand -= 1
◆Change Items:Zircon + {Dumm_Rand}
◆Text:None, Dim, Bottom
: :\N[1] discovers \V[20] Zircon..!
◆Control Variables:#0008 Dumm_Value = The number of Zircon
◆If:Dumm_Value ≥ 99
◆Comment:Too much already found, no room for more...
◆Text:None, Dim, Bottom
: :\N[1] can't carry any more.
: :Maybe put them into Store..?

:End
◆Erase Event
◆Jump to Label:End_One_Shot_Deci_Food

:Else
◆If:Dumm_Rand ≤ 6
◆Comment:Finds Iron.
◆Control Variables:#0020 Dumm_Rand -= 3
◆Change Items:Iron + {Dumm_Rand}
◆Text:None, Dim, Bottom
: :\N[1] discovers \V[20] Iron..!
◆Control Variables:#0008 Dumm_Value = The number of Iron
◆If:Dumm_Value ≥ 99
◆Comment:Too much already found, no room for more...
◆Text:None, Dim, Bottom
: :\N[1] can't carry any more.
: :Maybe put them into Store..?

:End
◆Erase Event
◆Jump to Label:End_One_Shot_Deci_Food

:End

:End

:End
◆Jump to Label:End_One_Shot_Deci_Food

:End
◆If:Dumm_Rand = 9
◆Comment:Jackanapes takes Gold, or gives a bite..?
◆Change Parameter:Entire Party, Luck + 1
◆Control Variables:#0020 Dumm_Rand = Random 1..2
◆If:Dumm_Rand = 1
◆Comment:Bitten by a Jackanapes.
◆Play SE:Monster2 (25, 120, 0)
◆Control Variables:#0010 Bad_Luck += 1
◆Control Variables:#0020 Dumm_Rand = Random 5..25
◆Control Variables:#0020 Dumm_Rand *= Level of Actor1
◆Change HP:Entire Party, - {Dumm_Rand} (Allow Knockout)
◆Control Variables:#0013 HP_Held = HP of Actor1
◆If:HP_Held ≤ 0
◆Text:Pat_1(0), Dim, Bottom
: :Ouch..!\.
: :\N[1] receives a fatal bite from a
: :hidden Jackanapes, and collapses, lifeless.
: :The Game is up.
◆Play SE:Collapse3 (50, 70, 0)
◆Jump to Label:End_One_Shot_Deci_Food

:End
◆Text:Monster(4), Dim, Bottom
: :Ouch..!\.
: :\N[1] gets bitten by a hidden Jackanapes,
: :and loses \V[20] HP..!
: :The Jackanapes disappears.
◆Erase Event
◆Jump to Label:End_One_Shot_Deci_Food

:Else
◆Comment:Robbed by a Jackanapes.
◆Play SE:Devil3 (25, 120, 0)
◆Control Variables:#0010 Bad_Luck += 1
◆Control Variables:#0020 Dumm_Rand = Random 5..25
◆Control Variables:#0020 Dumm_Rand *= Level of Actor1
◆Change Gold:- {Dumm_Rand}
◆Text:Monster(4), Dim, Bottom
: :\N[1] gets robbed by a hidden Jackanapes,
: :and loses \V[20] \G..!
: :The Jackanapes disappears.
◆Erase Event
◆Jump to Label:End_One_Shot_Deci_Food

:End

:End
◆If:Dumm_Rand = 10
◆Comment:Finds Nothing, this time.
◆Control Variables:#0010 Bad_Luck += 1
◆Text:None, Dim, Bottom
: :\N[1] finds nothing..!
◆Erase Event
◆Jump to Label:End_One_Shot_Deci_Food

:End
◆Label:End_One_Shot_Deci_Food
 

Dad3353

Praised Adventurer
Do i do that by hand, or is there a way to cut & paste?
I like your thinking..! No, there's no Text-based cut'n'paste in the Event editor, but I could send you a 'js' file containing the code, if you know how to pop it into a 'dummy Project..? You could then cut'n'paste between two instances of RPG Maker. Do you want to try that..? The code will still need editing for your own needs, of course.
 

Dad3353

Praised Adventurer
Sure, i could try that. Thanks!
Here's a link to a stripped-down Project on my Google Drive, which contains the necessary elements for this (Map, Variables, Events, Common Events...) which you can play with, and copy/paste into your own Projects if you wish (that's how I created this Project, taking parts from my much bigger Rachdale Cheese Demo...)....

Rewards.zip (8 Mb...)...

Hope it helps; get back here if there are questions etc...
 
Top