RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Random item gain

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 88
Your greatest flaw is that you have a soul.
Warm greetings.

I'm hoping someone will know what to do with this. Umm...I'm not sure if this is definitely a topic for this section but I thought it could be so I'm posting it here.

I got an idea of making an item gain different from a common way everpresent in jrpg. I'd like to know if anyone has an idea and could try making a script that would, upon player opening a chest, randomly select items he could gain. For example from 0 to 10 items at once with a specific rarity and so, perhaps based on a call script event (since that way it is easier to manipulate with). Something like a Diablo II item gain style. If something rings you a bell, give it a go. I'd try it myself but I have absolutely no idea (or knowledge) of advanced scripting at this matter, no clue what to do.

If you think there's no way, or have a specific opinion or solution, just type it down.

Alright, I'll leave you be now...  :lol:
« Last Edit: January 05, 2007, 02:45:09 PM by Decadent Sympozium »

***
Rep:
Level 88
Smarter than the average bear
Thatd be great for reply value :) Im not sure if theres a script for this, but you can do it with events...lots of conditional branches and triggers... I'll try to do this and post the events page for you soon ;D

[edit] here you go:


If you had something like an item that gets "more rare" items, Im not really thinking but just add another page with the same thing, thats only activated if "Rare Amulet" is equipped, and fill it with more rare items blah blal blah.

Or if you wanted to have a rare item in the mix, but with a lower percentage then the other *bulk* in the chest, the only way i can think of is make a conditional branch random variable inside the random variable...if you get what I'm saying :P

I'm sure theres easier/more clever ways of doing that, I just cant think of them right now ;9
« Last Edit: January 04, 2007, 10:23:07 PM by italianstal1ion »

***
Rep:
Level 88
Your greatest flaw is that you have a soul.
Oi, thanks for helping. Hmmm...I'm not sure if I got it right but with this I'm still supposed to write down every possible item one could get, no?

If yes, then, you see, I want to avoid that. The closest what I'd like to do would be something like, for example, setting a random gain from item 001 to 070 and 1 to 10 of them, for example. Let's say these are common potions and herbs item. So you walk to a chest, hit action, and the event rolls (or calls for script) a random of, say, 3 items: item 002, 010 and 045 -> Potion of Lesser Restortation, Axe of Spades and blueforge mushroom, for example - but I did not write a possible branch, you see, it selected it completely by itself. That's why I thought script would be useful because then you don't have to bother with bunch of conditional branches...

Or, the answer is no, and I misunderstood it.  :lol:

**
Rep: +0/-0Level 88
For the "lower percentage" problem:
Well, with very basic scripting you can specific intervalls in events.
Let's create, say, 70%-20%-10%.

Variable: [0001] = Random (1..10)   => the same randomizing, as above

Open a conditional branch, look for the entry "script" at the fourth page. Enter this:
( $game_variables[1] >= 1 ) && ( $game_variables[1] <= 7 )
Second condittion:
( $game_variables[1] >= 8 ) && ( $game_variables[1] <= 9 )
Third one:
$game_variables[1] == 10

Now, what does all this mean?
"$game_variables[1]" - the script "word" for the first variable, the [0001]. If you wanted to use [0006], write 6 in the brackets, and so on.
"$gamevariables[1] >= 1 "  >=    Easy. Greater than one.
( ) && ( )   --> "&&" means "and". The effect will be triggered only when both condition is met. This is the main reason for the script. There's no "and" in normal events (or just I didn't notice it...  :-\)

Adding all these elements together, we wrote:
"If variable [0001] is between 1 and 7"
"If variable [0001] is between 8 and 9"
"If variable [0001] is 10"

About scripting it:
As far as I know, in the basic system, there's no "treasure chest". It's just an event. You could script it, but you had to place it, trigger it, all the things events already can do. So you probably started with "Game_Event" as a parent class, then writing exactly the same thing what you wrote, just in methodes, and script language.
Of course, if you do "ohmygod, that's awfull much!!!" number of chests (like 2-3000  :D ), it's worth doing it. Otherwise, it's pretty pointless.
"Oh, mirror, how do i pity you!
Because when the men look at you, they see only themselves, not the mirror, who you really are..."
- Zelbess, Chrono Cross

**
Rep: +0/-0Level 88
Okay, sorry, you posted the above, while I was typing.
With events, your request goes like this, with items 1,2,3 (70%-20%-10%), and a random times between 1-10. (Attached)

Oh, and by the way: get some time and read the sripting tutorials. They are pretty nice. It's not that hard, trust me.  ;)
"Oh, mirror, how do i pity you!
Because when the men look at you, they see only themselves, not the mirror, who you really are..."
- Zelbess, Chrono Cross

***
Rep:
Level 88
Your greatest flaw is that you have a soul.
For the "lower percentage" problem:
Well, with very basic scripting you can specific intervalls in events.
Let's create, say, 70%-20%-10%.

Variable: [0001] = Random (1..10)   => the same randomizing, as above

Open a conditional branch, look for the entry "script" at the fourth page. Enter this:
( $game_variables[1] >= 1 ) && ( $game_variables[1] <= 7 )
Second condittion:
( $game_variables[1] >= 8 ) && ( $game_variables[1] <= 9 )
Third one:
$game_variables[1] == 10

Now, what does all this mean?
"$game_variables[1]" - the script "word" for the first variable, the [0001]. If you wanted to use [0006], write 6 in the brackets, and so on.
"$gamevariables[1] >= 1 "  >=    Easy. Greater than one.
( ) && ( )   --> "&&" means "and". The effect will be triggered only when both condition is met. This is the main reason for the script. There's no "and" in normal events (or just I didn't notice it...  :-\)

Adding all these elements together, we wrote:
"If variable [0001] is between 1 and 7"
"If variable [0001] is between 8 and 9"
"If variable [0001] is 10"

Lol, sorry for being dumb...I'm seeing what you're pointing at but I'm still confused...mainly because I didn't understand how to alter the percentage chances. do you think you could make an exact example, as if how would you do it? With actual example you'll fully help me.

For example: Lets say you make an event on chest. When character activates it, lets say there is a random item gain of 3 items from range itemID 001 to 020. 5% for each item, I guess that's how it would work. What do you do?

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
Easy, just make it look like this:

Variable Operation:
variable[0001] = Random (1..100)

Enter this event code:
Code: [Select]
> if var[0001] > 0
  > if var <= 5
    > gain item with ID 001
  > end
> end
> if var[0001] > 5
  > if var <= 10
    > gain item with ID 002
  > end
> end
etc.

Just play around with numbers and continue it like this. There is no need to script, you can make it all with conditional branches. You can make it a little bit different although:

Code: [Select]
> if var[0001] > 0
  > if var[0001] > 5
    > if var[0001] > 10
      > if var[0001] > 15
...
    > else
      > gain item with ID 003
    > end
  > else
    > gain item with ID 002
  > end
> else
  > gain item with ID 001
> end
« Last Edit: January 05, 2007, 12:37:52 PM by Blizzard »
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

***
Rep:
Level 88
Your greatest flaw is that you have a soul.
That appears useful but I don't understand what is exactly going on.

I'm also not sure what do you mean by "enter this event code". I can't enter this. O.o
« Last Edit: January 05, 2007, 02:49:32 PM by Decadent Sympozium »

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
I meant use the event commands like conditional branch and stuff (mainly conditional branch).
« Last Edit: January 05, 2007, 04:41:19 PM by Blizzard »
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!