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 Battle Themes

0 Members and 1 Guest are viewing this topic.

*
*crack*
Rep:
Level 64
2012 Most Unsung Member2012 Best NewbieFor frequently finding and reporting spam and spam bots
Random Battle Themes
Version: 1.1
Author: DiamondandPlatinum3
Date: July 23, 2012



Planned Future Versions

  • None
Description

This script allows you to play a random battle theme upon starting a battle, it can be turned off before a boss battle via switch so that the appropriate battle theme still plays for them.

Features

  • Does not actually modify your battle theme but rather plays one selected at random when starting up a battle. Therefore, if you turn it off via an event switch (see Editable Region), it will play the Battle theme you have set to play in the system.
  • Can have as many random battle themes as you would like.
  • Can modify volume & pitch on each battle theme.
Screenshots

Cannot Screenshot Audio, I'm afraid :o


Instructions

  • Paste the script under your materials section in your script editor but above main.
  • Just take a look at the editable region and modify things appropriately.
Script


Get it from here

Credit


  • DP3 / DiamondandPlatinum3


Thanks


  • DoctorTodd ~ For showing me a nicer way to present some code.
  • Pacman ~ Same as Todd :)



Support


Post in this thread or PM me.

Known Compatibility Issues
I am unaware of any scripts it doesn't work with; if you find any, post in this thread.

Demo


A demo is unnecessary for a script such as this.

Author's Notes

This weeks scripting has been brought to you by the letter A, as in
'AAAHHHH, I'm so freaking far behind in my game developments that I'm opting to do some Ruby scripting'.

Terms of Use


You may find my Terms of Use Here.
« Last Edit: June 08, 2014, 07:51:55 PM by D&P3 »
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

**
Rep:
Level 86
Deviant Designer
It looks nice, but you should of made it an array, so people can add more than five or less if they don't want five. Even though, it probably won't add if the string is null, it is more friendly to the user.

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
You aliased a method and didn't call it!!! !! !
Also you created instance variables when you only needed to create local variables!!!! !!! !! !
Also you can't edit any of this stuff in-game!!!!! !!!! !!! !! !

(Those were my suggestions said in a really annoying way. Nice script.)

OMG!!!!!! !!!!! !!!! !!! !! !
it's like a metaphor or something i don't know

*
*crack*
Rep:
Level 64
2012 Most Unsung Member2012 Best NewbieFor frequently finding and reporting spam and spam bots
I know, I'm a terrible person; I don't call aliases cause :mad:

You can edit the stuff in-game though (I know you know how to do so, Pacman), changing it from an instance variable to a local would make it impossible to change in-game though.

Pacman is my hero once again ;D

It looks nice, but you should of made it an array, so people can add more than five or less if they don't want five. Even though, it probably won't add if the string is null, it is more friendly to the user.
Actually the entire script was a request from someone who asked for a way to change the battle theme and to make it random for five of their battle themes.
I originally wrote the script for VX, but it didn't work for them; because as always people fail to mention what goddamned maker they're using :mad:

I'm not sure about using an array for this, because that would require people to do some scripting if they exceed the limit (and shit always gets bad when this happens).
I can edit it to make it possible to have 30 random battles themes however (if you've got more than thirty battle themes, you should probably reevaluate your game).
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

**
Rep:
Level 86
Deviant Designer
I figure that using common events for this is more efficient, but I was saying that the array can be any size, not limited to the number you specify in the case select. It is easily customized, because I have seen Yanfly do it in many of his scripts.

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
You can have unlimited choices of themes by using this logic:
Code: [Select]
ary = ["an item", "another item", "moar itmz"]
num = rand(ary.size) + 1
get = ary[num]
str = "Audio/BGM/" + get
then the play music thing or whatever

You can edit the stuff in-game though (I know you know how to do so, Pacman), changing it from an instance variable to a local would make it impossible to change in-game though.

I actually don't. Because as far as I can see, you can't.
1. There's no way to access the variables from outside the instance.
2. The variables are redefined as the values set in the module every time the method is called.
3. Editing modules in-game is silly (this isn't really a setback, more of an observation).
I would do this by storing the values in Game_System or another like class (such that it is accessible at any given time during the game), and attr_accessor the variables. That way users can use simple script calls like:
Code: [Select]
$game_system.bgm_volume = 50
or super-complex ones like:
Code: [Select]
$game_system.battle_themes.reject! {|i|i.length >= 7}; $game_system.battle_themes.compact
even though that wouldn't fit in the box :D

Don't take any of this negatively. These are just ideas.
« Last Edit: July 23, 2012, 11:32:52 AM by Pacman »
it's like a metaphor or something i don't know

*
*crack*
Rep:
Level 64
2012 Most Unsung Member2012 Best NewbieFor frequently finding and reporting spam and spam bots
You can have unlimited choices of themes by using this logic:
Code: [Select]
ary = ["an item", "another item", "moar itmz"]
num = rand(ary.size) + 1
get = ary[num]
str = "Audio/BGM/" + get
then the play music thing or whatever
You know something, that looks a hell of a lot more easier (and better) than what I had in mind :)
I guess I'll put it in a somewhat dynamic array, then :D
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

*
*crack*
Rep:
Level 64
2012 Most Unsung Member2012 Best NewbieFor frequently finding and reporting spam and spam bots
Done, thanks a lot Pacman.

I absolutely did not know about that method and it's bound to make any future scripts a helluva lot more easier :) That's what I get for not looking up the basics of ruby :rolleyes:
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

*
*crack*
Rep:
Level 64
2012 Most Unsung Member2012 Best NewbieFor frequently finding and reporting spam and spam bots
It occurred to me that people might have battle themes with different volumes and/or pitch (thinking of Amkrogh's music here).

So I have updated the script to allow you to set individual volume and pitch per battle theme. I also think the code looks neater if that matters to anyone :P
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3