Fixed version done, added the option I needed too.
//Lorgan's /Updated/ Damage Indicator Plugin (some stuff from Vindicator)
ini_open("gg2.ini");
global.indicator_style = ini_read_real("Plugins","DmgInd_indicator_style",1);
global.indicator_playding = ini_read_real("Plugins","DmgInd_sound",1);
global.indicator_move = ini_read_real("Plugins","DmgInd_place",0);
ini_close();
//make a new menu for plugin options
if !variable_global_exists("pluginOptions") {
global.pluginOptions = object_add();
object_set_parent(global.pluginOptions,OptionsController);
object_set_depth(global.pluginOptions,-130000);
object_event_add(global.pluginOptions,ev_create,0,'
menu_create(40, 140, 300, 200, 30);
if room != Options {
menu_setdimmed();
}
menu_addback("Back", "
instance_destroy();
if(room == Options)
instance_create(0,0,MainMenuController);
else
instance_create(0,0,InGameMenuController);
");
');
object_event_add(InGameMenuController,ev_create,0,'
menu_addlink("Plugin Options", "
instance_destroy();
instance_create(0,0,global.pluginOptions);
");
');
}
object_event_add(global.pluginOptions,ev_create,0,'
//very dumb workaround
section = "Plugins";
key1 = "DmgInd_indicator_style";
key2 = "DmgInd_sound";
key3 = "DmgInd_place";
//even dumber workaround
quote = chr(39);
menu_addedit_select("Damage indicator style", "global.indicator_style", "
gg2_write_ini(section, key1, argument0);
");
menu_add_option(0, "Wareya"+quote+"s");
menu_add_option(1, "Lorgan"+quote+"s");
menu_addedit_boolean("Ding sound on hit", "global.indicator_playding", "
gg2_write_ini(section, key2, argument0);
");
menu_addedit_boolean("Move counter for HUDs", "global.indicator_move", "
gg2_write_ini(section, key3, argument0);
");
');
if file_exists("Plugins/Resources/dingaling.wav") {
global.indicator_ding = sound_add("Plugins/Resources/dingaling.wav",0,1);
} else exit;
global.indicator = object_add();
global.indicator2 = object_add();
global.indicator_offwhite = make_color_rgb(217,217,183);
object_event_add(global.indicator,ev_create,0,"dmg = 127; alpha = 1;");
object_event_add(global.indicator,ev_step,0,"y -= 5; alpha-=0.05;if(alpha < 0) instance_destroy();");
object_event_add(global.indicator,ev_draw,0,"
//set up vars (TODO remove duplication SOMEHOW/pb hard)
if(global.indicator_move)
{
size = 2;
xoffset = 64;
yoffset = 547;
}
else
{
size = 3;
xoffset = 64+25;
yoffset = 547+20;
}
draw_set_halign(fa_center);
draw_set_valign(fa_bottom);
if global.indicator_style draw_text_transformed_color(x,y,'-' + string(dmg),1 + dmg/100,1 + dmg/100,0,c_red,c_red,c_red,c_red,alpha);
else {
draw_text_transformed_color(x+1,y+1,'-' + string(dmg),1 + dmg/100,1 + dmg/100,0,global.indicator_offwhite,global.indicator_offwhite,global.indicator_offwhite,global.indicator_offwhite,alpha);
draw_text_transformed_color(x,y,'-' + string(dmg),1 + dmg/100,1 + dmg/100,0,c_green,c_green,c_green,c_green,alpha);
}
");
object_event_add(global.indicator2,ev_create,0,"dmg = 127; alpha = 1; a = 0;");
object_event_add(global.indicator2,ev_step,0,"a -= 5; alpha-=0.05;if(alpha < 0) instance_destroy();");
object_event_add(global.indicator2,ev_draw,0,"
//set up vars
if(global.indicator_move)
{
size = 2;
xoffset = 64;
yoffset = 547;
}
else
{
size = 3;
xoffset = 64+25;
yoffset = 547+20;
}
draw_set_halign(fa_left);
draw_set_valign(fa_bottom);
/*if global.indicator_style draw_text_transformed_color(view_xview[0]+64+25, view_yview[0]+547+a,'-' + string(dmg),3,3,0,c_red,c_red,c_red,c_red,alpha);
else {
draw_text_transformed_color(view_xview[0]+64+25+3, view_yview[0]+547+a+3,'-' + string(dmg),3,3,0,global.indicator_offwhite,global.indicator_offwhite,global.indicator_offwhite,global.indicator_offwhite,alpha);
draw_text_transformed_color(view_xview[0]+64+25, view_yview[0]+547+a,'-' + string(dmg),3,3,0,c_green,c_green,c_green,c_green,alpha);
}*/
draw_set_alpha(alpha);
if(global.indicator_style)
{
draw_set_color(c_red);
draw_text_transformed(view_xview[0]+xoffset, view_yview[0]+yoffset+a, '-' + string(dmg),size,size,0);
}
else
{
draw_set_color(global.indicator_offwhite);
draw_text_transformed(view_xview[0]+xoffset+size, view_yview[0]+yoffset+size+a, '-' + string(dmg),size,size,0);
draw_set_color(c_green);
draw_text_transformed(view_xview[0]+xoffset, view_yview[0]+yoffset+a, '-' + string(dmg),size,size,0);
}
draw_set_alpha(1);
");
object_event_add(Character,ev_step,ev_step_end,"
if (!variable_local_exists('lasthp')) lasthp = hp;
if (!variable_local_exists('dmg')) dmg = 123;
if hp < lasthp && !cloak{
if floor(lasthp-hp) > 1 {
if lastDamageDealer != -1 && instance_exists(lastDamageDealer) {
if lastDamageDealer.object != -1 && instance_exists(lastDamageDealer.object) && lastDamageDealer != player {
if (lastDamageDealer == global.myself or lastDamageDealer.object.healer == global.myself) {
if instance_exists(dmg) {
if dmg.alpha > 0.8 && dmg.owner == id {
dmg.dmg+=floor(lasthp-hp);
global.totalDamage += floor(lasthp - hp);
global.RollDmg.alarm[0] = 60;
dmg.x = x;
dmg.y = y;
} else {
dmg = instance_create(x,y,global.indicator);
dmg.dmg = floor(lasthp - hp);
dmg.owner = id;
global.RollDmg.alarm[0] = 60;
global.totalDamage += floor(lasthp - hp);
if global.indicator_playding sound_play(global.indicator_ding);
}
} else {
dmg = instance_create(x,y,global.indicator);
dmg.dmg = floor(lasthp - hp);
dmg.owner = id;
global.RollDmg.alarm[0] = 60;
global.totalDamage += floor(lasthp - hp);
if global.indicator_playding sound_play(global.indicator_ding);
}
}
}
}
lasthp = hp;
}
} else lasthp = hp;
");
object_event_add(Sentry,ev_step,ev_step_end,"
if (!variable_local_exists('lasthp')) lasthp = hp;
if (!variable_local_exists('dmg')) dmg = 123;
if hp < lasthp {
if floor(lasthp-hp) > 1 {
if lastDamageDealer != -1 && instance_exists(lastDamageDealer) {
if lastDamageDealer.object != -1 && instance_exists(lastDamageDealer.object) {
if (lastDamageDealer == global.myself or lastDamageDealer.object.healer == global.myself) {
if instance_exists(dmg) {
if dmg.alpha > 0.8 && dmg.owner = id {
dmg.dmg+=floor(lasthp-hp);
global.totalDamage += floor(lasthp - hp);
global.RollDmg.alarm[0] = 60;
dmg.x = x;
dmg.y = y;
} else {
dmg = instance_create(x,y,global.indicator);
dmg.dmg = floor(lasthp - hp);
dmg.owner = id;
global.totalDamage += floor(lasthp - hp);
global.RollDmg.alarm[0] = 60;
if global.indicator_playding sound_play(global.indicator_ding);
}
} else {
dmg = instance_create(x,y,global.indicator);
dmg.dmg = floor(lasthp - hp);
dmg.owner = id;
global.totalDamage += floor(lasthp - hp);
global.RollDmg.alarm[0] = 60;
if global.indicator_playding sound_play(global.indicator_ding);
}
}
}
}
lasthp = hp;
}
} else lasthp = hp;
");
global.RollDmg = object_add();
object_event_add(global.RollDmg,ev_create,0,"global.totalDamage = 0;");
object_event_add(global.RollDmg,ev_alarm,0,"
dmg = instance_create(0,0,global.indicator2);
dmg.dmg = floor(global.totalDamage);
dmg.owner = id;
global.totalDamage = 0;
");
object_event_add(global.RollDmg,ev_draw,0,"
draw_set_halign(fa_left);
draw_set_valign(fa_bottom);
//set up vars
if(global.indicator_move)
{
size = 2;
xoffset = 64;
yoffset = 547;
}
else
{
size = 3;
xoffset = 64+25;
yoffset = 547+20;
}
if(global.indicator_style)
{
draw_set_color(c_red);
draw_text_transformed(view_xview[0]+xoffset, view_yview[0]+yoffset, '-' + string(floor(global.totalDamage)),size,size,0);
}
else
{
draw_set_color(global.indicator_offwhite);
draw_text_transformed(view_xview[0]+xoffset+size, view_yview[0]+yoffset+size, '-' + string(floor(global.totalDamage)),size,size,0);
draw_set_color(c_green);
draw_text_transformed(view_xview[0]+xoffset, view_yview[0]+yoffset, '-' + string(floor(global.totalDamage)),size,size,0);
}
");
object_event_add(HealthHud,ev_create,0,"instance_create(0,0,global.RollDmg);");
object_event_add(HealthHud,ev_destroy,0,"with(global.RollDmg) instance_destroy();");
//this needs to be done or desync spams random '-5' messages when you damage medics
object_event_clear(Medic,ev_alarm,11);
object_event_add(Medic,ev_alarm,11,"
if(global.isHost)
{
hp += 5;
alarm[11] = 30;
}
");
You should probably remove the dead code, it was confusing me when I was fixing it.