Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Hi Yal,

I'm having some trouble with this. It's probably my newb-ness. I'm trying to follow the example code that you gave in the previous comment, but I'm stuck. I think my problem is that I don't know where to put amp_GENDER to call it in monster_get_battlesprite. I'm declaring amp_GENDER in the init_constants. I want it to be 0=male and 1=female.


Could you help me with this? I apologize if I'm being dense.

(1 edit)

So first of all, amp_GENDER would be an array index so it's only going to have a single value by itself... you should put it at this spot in init_constants:

Set it to the value of AMP_MAX (which is the first unused value for the AMP array index), then increase AMP_MAX by 1. While you're editing the init_constants script, also add in two new gender macros gender_MALE and gender_FEMALE (set to 0 and 1 as you wanted)

Next, go to amp_generate_monster (which sets up a newly spawned monster's AMP data) and add a new line like this:

global.active_monster_party[argument0,amp_GENDER] = choose(gender_MALE,gender_FEMALE)

This should make a newly spawned monster have a 50% chance to be male and a 50% chance to be female.

Finally, in monster_get_battlesprite, you'd get the gender via amp_read_var(argument0,amp_GENDER) and then have an if statement: if gender is equal to gender_MALE, return global.monster_data[amp_read_var(argument0,amp_MONID),mond_SPRITE_BATTLE_MALE], otherwise return global.monster_data[amp_read_var(argument0,amp_MONID),mond_SPRITE_BATTLE_FEMALE].

(Changing the battle sprite index in the monster data array so there's more than one was the stuff I told you about last time, and with this change we use both those new sprites)

(1 edit)

Awesome, I got it working! I noticed, though, that it doesn't show the gender sprite when I look at my monster in the menu. Is there something I can change, for example in msh_spawn_monster_list, that will fix this?

Oh yeah, nice catch! Line 23 reads the sprite directly:

var spr = global.monster_data[global.active_monster_party[mon,amp_MONID],mond_SPRITE_BATTLE];

Changing this to

var spr = monster_get_battlesprite(mon);

should do the trick.


I did a quick search to see if there's any more direct reads that needs to be updated, there's a handful of other places where the sprite is read directly instead of using the monster_get_battlesprite script... searching for the string ",mond_SPRITE_BATTLE" (with the comma, but without quotes) should give you all the results so you can just click on them to instantly jump to the line that needs to be updated. You can ignore the starter select / nickname scripts and the moncyclopedia, but you probably want the shrine / terminal scripts, the evolution control, and normal nicknaming updated to use monster_get_battlesprite.

(2 edits)

Well, the first part worked, but changing those lines to monster_get_battlesprite isn't working. I have no idea what I'm doing wrong.

What's the result? Wrong sprite, no sprite at all, or errors?

I think I have an idea what the problem is - on a closer look, monster_get_battlesprite takes an AMP ID argument (AMP is short for Active Monster Party, an AMP ID is a reference to the data of one particular monster, like your Pikachu named Fred) but not all of the cases uses the AMP, some use the species directly and bypasses AMP:


(red underline = AMP ID, blue arrow = uses species directly, darked out = no need to care about this for now)

The easiest way to solve this probably would be to have a new "mon_species_get_sprite" function and move your gender-sprite logic to that, and then monster_get_battlesprite would just read the species and then return the mon_species_get_sprite result of that species. Now the lines that use the species directly can use mon_species_get_sprite (using the original species variables we used in the array accesses) and the ones using the AMP ID can use monster_get_battlesprite.