chasepeck
Member
Hello! This is my first post on GMC, and I need some help.
I am creating an RPG, and I want different enemies to have different music tracks. Since I will have quite a few enemies in my game, I decided to put the enemy data into a .ini file. One of the keys is the music asset name. What I tried to do was read the key, use asset_get_index, and play the music on loop, but it is not working. I used a debug message to check if the section Testman exists but for some reason it says that it doesn't. Am I doing something wrong?
I made an object that handles the audio:
Create Event:
The enemy file, data_enemies.ini:
The music key is the key I am trying to read.
This is my output:
The zero on the bottom line there is the debug message saying that it thinks the Testman section does not exist.
I apologize if I'm being stupid, I'm not the best with GameMaker.
Edit: btw, I am using IDE v2.2.5.481, and Runtime v2.2.5.378
I am creating an RPG, and I want different enemies to have different music tracks. Since I will have quite a few enemies in my game, I decided to put the enemy data into a .ini file. One of the keys is the music asset name. What I tried to do was read the key, use asset_get_index, and play the music on loop, but it is not working. I used a debug message to check if the section Testman exists but for some reason it says that it doesn't. Am I doing something wrong?
I made an object that handles the audio:
Create Event:
Code:
if(room==rm_battle){
ini_open(working_directory+"data_enemies.ini");
show_debug_message(ini_section_exists("Testman"));
audio_play_sound(asset_get_index(ini_read_string("Testman","music","snd_error")),0,true);
ini_close();
}
Code:
;Test enemy
[Testman]
name=Testman
bgsprite=spr_bg_pinklines
bgeffect=1
bgspeed=0.1
bgwavelength=32
sprite=spr_enemy_InsecureGarlic
music=mus_bat_conventionalBattle
hp=100
sp=100
off=5
def=5
speed=5
react=5
crit=5
miss=5
This is my output:
Code:
**********************************.
Entering main loop.
**********************************.
Texture #3 2048,2048
Audio group 1 -> Loading...
Audio_WAVs()
Audio group 2 -> Loading...
Audio_WAVs()
Audio group 1 -> Loaded
Audio group 2 -> Loaded
0
I apologize if I'm being stupid, I'm not the best with GameMaker.
Edit: btw, I am using IDE v2.2.5.481, and Runtime v2.2.5.378
Last edited: