Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Hi Yal, hope you had a great Summer. I've been trying to setup a 'shop' that displays the monsters seen, and purchase/craft monsters from a list that of them you've caught. 

I've taken your UI of mev_pause_moncyclopedia for the shop layout, and am attempting to use the item purchasing goodness from  msh_spawn_shop_list and its menu event accomplish this. 

The thing I think I'm currently stuck on is using the proper code  to set up the var it which I want to be the specific ID of the monster you're hovering over .Then carrying over that info with shop_item variable to the shop menu event. 

I've been using it  =  global.monsters_seen[d] but after starting to use the debug feature, I realized this is not giving me what I need lol.

 Here's the code block I'm struggling with to accomplish that. Its the block for the mon's you've caught and thus should be purchasable.  I'll link the full script code in a comment below if that helps. Thanks!!!

//Add meta data as well, based on how much info the player has about the monster.

var d, mev, it;

draw_set_font(font_n)//Needed by string_wrap

for(d = 0; d <= maxmon; d++){

vev= d

yy = lerp(0.05,0.95,d/cmax)

hh = lerp(0.05,0.95,(d+1)/cmax) - yy

// ggui_menu_region(0,vev,mev,0.05,yy,0.95,yy+hh)

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if(global.monsters_caught[d]){ 

//Wrap flavor text so it fits the box we add below

mev = argument0

it  =  global.monsters_seen[d]     //global.monsters_caught[d]

ggui_fill_meta(0,d,global.monster_data[d,mond_SPRITE_BATTLE],0,global.monster_data[d,mond_NAME],string_wrap(global.monster_data[d,mond_CRAFT_SLOT_SOUL_STRING],VIEW_W*0.6*0.8))

var soul = global.monster_data[d,mond_CRAFT_SLOT_SOUL] 

shop_item  = it

shop_cost  = soul

    

}

function msh_botsmith_spawn_monsterpurchse_list(argument0) {

//mev_pause_moncyclopedia()

//Make sure statistics are up-to-date

msh_recompute_seencaught()

//Find max monster

var maxmon = 0, c;

for(c = MONSTER_MAX-1; c >= 0; c--){

if(global.monsters_seen[c]){

maxmon = c // maxmon is arraylength

break

}

}

    show_debug_message(global.monster_data)

with(instance_create_depth(x,y,depth - 1,obj_gguimenu)){

ggui_menu_preallocate(1,maxmon +1)

//Left pane: monster list (scrollable)

ggui_frame(0,0,VIEW_W*0.4,VIEW_H,spr_messagebox)

ggui_frame_set_scrolling(false,true,1,10,false,true)

var cmax = 10, yy, hh, vev;

ggui_element_text_settings(font_mainmsg,c_white,0,1)

for(c = 0;c < cmax;c++){

vev= c

yy = lerp(0.05,0.95,c/cmax)

hh = lerp(0.05,0.95,(c+1)/cmax) - yy

ggui_element_text_scrollable(0.1,yy+hh*0.5,0,vev)

}

//Add meta data as well, based on how much info the player has about the monster.

var d, mev, it;

draw_set_font(font_n)//Needed by string_wrap

for(d = 0; d <= maxmon; d++){

vev= d

yy = lerp(0.05,0.95,d/cmax)

hh = lerp(0.05,0.95,(d+1)/cmax) - yy

// ggui_menu_region(0,vev,mev,0.05,yy,0.95,yy+hh)

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if(global.monsters_caught[d]){ 

//Wrap flavor text so it fits the box we add below

mev = argument0

it  =  global.monsters_seen[d]     //global.monsters_caught[d]

ggui_fill_meta(0,d,global.monster_data[d,mond_SPRITE_BATTLE],0,global.monster_data[d,mond_NAME],string_wrap(global.monster_data[d,mond_CRAFT_SLOT_SOUL_STRING],VIEW_W*0.6*0.8))

var soul = global.monster_data[d,mond_CRAFT_SLOT_SOUL] 

shop_item  = it

shop_cost  = soul

    

}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

else if(global.monsters_seen[d]){

mev = NONE

ggui_fill_meta(0,d,global.monster_data[d,mond_SPRITE_BATTLE],0,global.monster_data[d,mond_NAME],"???")

shop_item[d] = NONE

shop_cost[d] = 0

}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

else{

mev = NONE

ggui_fill_meta(0,d,spr_unknownmonster,0,"???","???")

shop_item[d] = NONE

shop_cost[d] = 0

}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ggui_menu_region(0,vev,mev,0.05,yy,0.95,yy+hh)

}

//Upper right pane: monster sprite + name

ggui_frame(VIEW_W*0.4,0,VIEW_W*0.6,VIEW_H*0.5,spr_messagebox)

ggui_element_sprite_current(0.5,0.8)

ggui_element_text_settings(font_mainmsg,c_white,1,0)

ggui_element_text_current(0.5,0.8)

//Lower right pane: flavor text

ggui_frame(VIEW_W*0.4,VIEW_H*0.5,VIEW_W*0.6,VIEW_H*0.4,spr_messagebox)

ggui_element_text_settings(font_n,c_white,0,0)

ggui_element_desc_current(0.1,0.1)

//Lowest right pane: total statistics

ggui_frame(VIEW_W*0.4,VIEW_H*0.9,VIEW_W*0.6,VIEW_H*0.1,spr_messagebox)

ggui_element_text_settings(font_nfat,c_white,1,1)

ggui_element_text(0.5,0.5,tsprintf("Species Witnessed: %          Species Possessed: %",global.monsters_seen_total,global.monsters_caught_total))

ggui_element_text(0.5,0.8,tsprintf("Required Parts: %",global.monster_data[d,mond_CRAFT_SLOT_SOUL_STRING]))

}

}

global.monsters_caught and global.monsters_seen are arrays of booleans, which means each slot is true if you have caught/seen that monster and false otherwise. In this case you'd just want to carry over the counter itself, since it's the monster ID - so menuvalue_y for the currently hovered item (since it's a vertical menu).

Also, in the moncyclopedia when setting up the events (ggui_menu_region statement) you'll see we give every line a NONE event (which means nothing happens if you press the "accept" button with it highlighted), for your case you'd maybe want to make this conditional - if the monster is available for purchase (global.monsters_caught[d] is true) you'll set up a shop event (which e.g. checks if you can afford the monster and if so proceeds, carrying over the current menu's menuvalue_y as the monster ID the next-level menu refers to), if it's not available (e.g. you haven't caught it yet) you create a NONE event instead.

Thanks Yal! That explains why the monster that keeps getting purchased is Charchne, who is ID no. 1 haha. Could you expand on how I can use these boolean arrays to carry over a counter to properly match the currently hovered mon?  

(1 edit)

To pass over a value, in the mev_ script you'd do something like this:

with(instance_create_depth(x,y,depth-1,obj_gguimenu)){
     daddy       = other.id
     my_monster  = other.menuvalue_y
     //Create frames, elements and events like normal
}

(Similar to the scripts for doing stuff to party monsters, but instead of referring to the AMP we refer to a raw monster ID)

Hi Yal

 Could you help me in the game gun 10 summer, because I have trouble finding a weapon to break the green and blue blocks.  I'm currently in Western Flat, after entering the room downstairs where I'm talking to someone there, I can't go back upstairs because the shotgun isn't enough.  When, after the fight, the firewall "A" opens, which I go through, and after entering the room, the computer asks for an ID that I don't have and I don't know where to get it.  In this room, my shotgun is also not enough to get to the top

 What should I do, what am I doing wrong

 I am asking you for help

Hi Yal

 Could you help me in the game gun 10 summer, because I have trouble finding a weapon to break the green and blue blocks.  I'm currently in Western Flat, after entering the room downstairs where I'm talking to someone there, I can't go back upstairs because the shotgun isn't enough.  When, after the fight, the firewall "A" opens, which I go through, and after entering the room, the computer asks for an ID that I don't have and I don't know where to get it.  In this room, my shotgun is also not enough to get to the top

 What should I do, what am I doing wrong

 I am asking you for help