Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(2 edits)

I think I might've never implemented that and forgotten to remove the constant... but here's what I'd do.

  • Scripts --> Data Mangling --> Item Use Effect, create a new "itemuse_evolve" script. You can use itemuse_healHP as a guideline.
  • If in battle (check if room == rm_battle), the script does nothing and creates a message that you can't evolve a monster mid-battle. (With msh_itemuse_show_party_effects)
  • Otherwise, get the global.active_monster_party[monamp,amp_MONID] and store in a variable "species" - that's the species of the monster we're trying to use the item on.
  • Check all the global.monster_evolution_type / global.monster_evolution_arg belonging to this species, and schedule an evolution if we can find an item evolution that uses this particular item:
foundone = false;
for(var c = 0; c < global.monster_data[species,mond_TOTALEVOLUTIONS]; c++){ 
  if(global.monster_evolution_type[species,c] == evotype_ITEM && global.monster_evolution_arg[ species,c] == my_item){
    ds_queue_enqueue(global.pending_evolutions_queue,[monamp,global.monster_evolution_mon[ species,c]]);
    inventory_lose_item(my_item,1); //Don't forget to consume the item
    room_goto_fade_dontdestroy(rm_evolution,60);
    foundone = true;
    break;//We don't need to loop through more evolutions
  }
}
if(!foundone){//Doesn't trigger an evolution for this species
  msh_itemuse_show_party_effects("It wouldn't have any effect.")
}
  • Now you can define the item in init_items so that it uses the  use_script itemuse_evolution, use_arg NONE, is of type itemtype_CONSUMABLE,  has valid flags itemvalidflag_FIELD, and it should just magically work.
  • Oh, yeah - and you should also store the player's coordinates before changing rooms like when they enter a battle. You can copy the code from cc_battlestart_trainer (the "load_" variables)

Sorry for the inconvenience, I hope this helps.