// https://rathena.org/board/topic/115640-custom-guild-pot-npc/ - script guild_potion_invest_main -1,{ function func_GuildPotHealRate { .@total_invest = getarg(0, 0); if (.@total_invest >= 1000000000) return 20; else if (.@total_invest > 600000000) return 12; else if (.@total_invest > 400000000) return 8; else if (.@total_invest > 200000000) return 4; else if (.@total_invest > 100000000) return 2; else return 1; } OnInit: .item_id = 512; setitemscript .item_id, "{ doevent \"guild_potion_invest_main::OnConsume\"; }", 0; end; OnConsume: .@gid = getcharid(2); if (.@gid) { .@heal_rate = func_GuildPotHealRate(getd("$gid_pot_invest_"+.@gid)); percentheal .@heal_rate, .@heal_rate; } end; OnTalk: .@gid = getcharid(2); if (.@gid) { .@total_invest = getd("$gid_pot_invest_"+.@gid); mes "Current Investment: " + F_InsertComma(.@total_invest) + "z"; mes "Guild Potion Heal Rate: " + func_GuildPotHealRate(.@total_invest); if (.@total_invest < 1000000000) { mes " "; mes "Do you wish to invest in your guild?"; if (select("Yes", "Cancel") == 1) { mes "Input Zeny."; input .@zeny, 0, Zeny; if (select("Confirm", "Cancel") == 1) { Zeny -= .@zeny; setd("$gid_pot_invest_"+.@gid, getd("$gid_pot_invest_"+.@gid) + .@zeny); .@total_invest = getd("$gid_pot_invest_"+.@gid); mes "You have invested " + F_InsertComma(.@zeny) + " zeny"; mes "Guild Potion Heal Rate: " + func_GuildPotHealRate(.@total_invest); } } } } end; }