The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX Ace => VXA Scripts Database => Topic started by: D&P3 on July 22, 2012, 08:31:47 PM

Title: Random Battle Themes
Post by: D&P3 on July 22, 2012, 08:31:47 PM
Random Battle Themes
Version: 1.1
Author: DiamondandPlatinum3
Date: July 23, 2012



Planned Future Versions

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

Screenshots

Cannot Screenshot Audio, I'm afraid :o


Instructions

Script


Get it from here (http://www.diamondandplatinum3.net/rpg-maker-scripts/rgss3-vxa/battle-scripts/random-battle-theme-rgss3/)

Credit




Thanks





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 (http://www.diamondandplatinum3.net/rpg-maker-scripts/terms-of-use/).
Title: Re: Random Battle Themes
Post by: Helladen on July 23, 2012, 09:38:02 AM
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.
Title: Re: Random Battle Themes
Post by: pacdiggity on July 23, 2012, 09:59:58 AM
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!!!!!! !!!!! !!!! !!! !! !
Title: Re: Random Battle Themes
Post by: D&P3 on July 23, 2012, 10:40:23 AM
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).
Title: Re: Random Battle Themes
Post by: Helladen on July 23, 2012, 10:57:09 AM
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.
Title: Re: Random Battle Themes
Post by: pacdiggity on July 23, 2012, 11:21:18 AM
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.
Title: Re: Random Battle Themes
Post by: D&P3 on July 23, 2012, 11:30:27 AM
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
Title: Re: Random Battle Themes
Post by: D&P3 on July 23, 2012, 11:58:56 AM
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:
Title: Re: Random Battle Themes
Post by: D&P3 on August 03, 2012, 08:18:33 AM
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