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?
derekofcourse
Recent community posts
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]))
}
}
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
}
Hello again Yal! Do you know if this engine works OK with the most current versions of GM that have come out? I mainly ask because I know there are some retired functions (like arraysize 1D) used. I haven't updated it in forever just in case haha
also a general GM question i'm trying to figure out, I've noticed you use var c for most of you "for" loops. Does that 'c' value get carried over and iterated on in scripts that use multiple 'fors' or is the 'c' reset upon a new 'for'?
Thanks! ^.^
Hello again Yal! Hope you're having a good summer,
I've been working on a shield system by copying how HP works and changing all the variables to ShieldHP essentially. I'm having trouble figuring out how to get the damage to "jump" over to reducing normal HP after the shield bar has been destroyed. ( I have separate dmgapply scripts for shield dmg and normal dmg below) It seems like the damage is stuck on trying to take from the sheildHP pool even after it has reached zero. Probably some simple thing i've overlooked :) Here's what I'm working with:
//Damage
if(pow > 0){
var dmgdata = compute_damage(a_user,trg,a_comm);
if(sheildcheck >0){
n = instance_create_depth(trg.x,trg.y,depth,obj_dmgapplyshld)
n.my_dmg = ceil(dmgdata[0]*ail_power_multiplier)
n.my_mul = dmgdata[1]
n.my_eff = dmgdata[2]
n.my_mon = trg
n.my_user = a_user
n.my_move = a_comm
n.this_is_an_attack = true
}
//********************
if(sheildcheck < 1){
n = instance_create_depth(trg.x,trg.y,depth,obj_damageapply)
n.my_dmg = ceil(dmgdata[0]*ail_power_multiplier)
n.my_mul = dmgdata[1]
n.my_eff = dmgdata[2]
n.my_mon = trg
n.my_user = a_user
n.my_move = a_comm
n.this_is_an_attack = true
//User might hold an item that improves attack effectiveness
if(battle_item_might_affect_this(a_user.amp_id,itemvalidflag_AUTO_ATTACKING)){
var it = amp_read_var(a_user.amp_id,amp_HELDITEM)
n.my_mul *= script_execute(global.item_data[it,id_USESCRIPT],[a_user.amp_id,trg.amp_id,a_comm],global.item_data[it,id_USEARG])
}
}
}
Thanks!!
Hello again Yal, happy July :) Here's some things I've been having trouble understanding lately:
How to use properly reference a AMP (friend and foe) within obj_battlecontrol. I'm working on shield system, (where mons have to break through a shield before being able to attack the enemies HP)
I'm trying to do a check on a new stat (shieldHP) and if the AMP's shieldHP stat is >1, a visual shield object will appear in front of a mon after it's summoned.
My problem is simply trying to understand how you have been using the amp.id variable in obj_battlecontrol do to similar stat checks. I've tried a few things and placing the code in a few spots. I don't think I quite get what variable to place in front of it (with the period separating amp_id.
Here's the current code I'm trying in bcontrolstate_ACTIONSELECT_STEP 1 (around line 320)
var getshld = monster_get_maxshld_hp(action_monster.amp_id);
if(getshld > 1) {
instance_create_depth(cx,cy,d_player + -100,obj_battlemonster_sheild)}
the error messages basically keep saying the xyz.amp_id variable is undefined. Any help understanding this is greatly appreciated as always :)
Actually, the reverse is working (horde battles working, 1v1 battles are not) but I tried adding that condition but then got a similar error to what I have been getting:
##############################################
ERROR in
action number 1
of Draw Event
for object obj_battlemonsterhud:
Push :: Execution Error - Variable Index [-12341] out of range [419] - -5.active_monster_party(100075,-12341)
at gml_Script_amp_read_var (line 3) - return global.active_monster_party[argument0,argument1];
##############################################
gml_Script_amp_read_var (line 3)
gml_Script_monster_get_name (line 4) - var s = amp_read_var(amp_id,amp_NICKNAME);
gml_Object_obj_battlemonsterhud_Draw_0 (line 12) - draw_text(xx,yy,monster_get_name(amp))
sorry for the trouble! I really appreciate your help as I am still trying to make sense of the ins and outs of the battle system
Hi Yal, any idea why I'm getting errors in global.active_monster_party? I've been so tied up in working on totems and menus, when I went back to look at battles, this happened :( Something to do with the Macro NONE i'm sure, but I cant figure out what.
ERROR in
action number 1
of Step Event0
for object obj_battlecontrol:
Push :: Execution Error - Variable Index [-12341] out of range [419] - -5.active_monster_party(100075,-12341)
at gml_Object_obj_battlecontrol_Step_0 (line 110) - var montype = global.active_monster_party[n.amp_id,amp_MONID];
#########################################################gml_Object_obj_battlecontrol_Step_0 (line 110)
If I comment out the block starting from line 110, then I just get the same message in the obj_monster HUD
Push :: Execution Error - Variable Index [-12341] out of range [419] - -5.active_monster_party(100075,-12341)
at gml_Script_amp_read_var (line 3) - return global.active_monster_party[argument0,argument1];
#########################################################
gml_Script_amp_read_var (line 3)
gml_Script_monster_get_name (line 4) - var s = amp_read_var(amp_id,amp_NICKNAME);
gml_Object_obj_battlemonsterhud_Draw_0 (line 12) - draw_text(xx,yy,monster_get_name(amp))
Thanks so much!
Hello again Yal! This time i'm back with more general questions that I can't seem to figure out yet.
I'm using the framework of msh_spawn_inventory and how it conveniently lets players tab through multiple pages. The way i'm trying to use it, I need certain items to be different font colors but I cant seem to figure out how as this uses ggui_fill_arbtext. any advice appreciated :)
Also, could you give tips on how we might be able to display animated sprites within the menus/cutscenes. They all seem static from what I can tell.
Thanks so much as usual!
Thanks so much Yal! I am still familiarizing myself with the engine, but as i've taken your above advice into action, I realize I may be in over my head with a this rather complicated totem mechanic and may need to revisit it later. BUT if you have time, these are a few things I'm running into:
- Not sure where in the init moves to put amp_generate_monster(1,monster_totem_1,1)
I've tried placing it in a few of the argument fields there with no success. Maybe I need to create a "status" with 100% acc and code it to create totems that way?
- I have tested forcing a mon to appear in battle by just doing a press key event in obj_battle_control. I can't get it to pop in a duo battle (with one mon on my team) but it will pop into my party (and can be swapped into lol) I wonder if creating a designated slot for totems might be the way to go, unless I'm missing something which is likely lol.
Thanks a bunch as usual!!
Hi Yal! Hope you've been well. Any ideas on the best way to implement a "totem" system?
Basically, certain moves create totems - essentially a temporary, targetable object that gives buffs, etc until they are destroyed.
I thought the best way would be to add them to the Dex .Then have them sent out, then destroy the instance when they reach 0 HP or at the end of battle.
I'm not sure how to approach adding a temporary mons to the battlefield (also considering the opposing team could use this move!) I'm thinking the move would have to temporarily increase the max team size to work.
Any thoughts are appreciated :)