quest main_quest_lv2 begin state start begin end state run begin when login or levelup or enter with pc.get_level() >= 2 begin set_state ( gototeacher ) end when 20354.chat.gameforge.main_quest_lv2._10_npcChat with pc.get_level() < 2 begin say_title(gameforge.main_quest_lv1._60_sayTitle) say(gameforge.main_quest_lv2._20_say) end end state gototeacher begin when letter begin send_letter(gameforge.main_quest_lv2._30_sendLetter) local v=find_npc_by_vnum(20354) if 0==v then else target.vid("__TARGET__", v, gameforge.main_quest_lv2._40_targetVid) end end when button or info begin say_title(gameforge.main_quest_lv2._30_sendLetter) say_reward(gameforge.main_quest_lv2._50_sayReward) end when __TARGET__.target.click begin target.delete("__TARGET__") say_title(gameforge.main_quest_lv1._60_sayTitle) say(gameforge.main_quest_lv2._60_say) wait() say_title(gameforge.main_quest_lv1._60_sayTitle) say(gameforge.main_quest_lv2._70_say) wait() say_title(gameforge.buy_fishrod._210_sayTitle) say_reward(gameforge.main_quest_lv2._80_sayReward) say_reward(string.format(gameforge.main_quest_lv2._90_sayReward,item_name(27001), 15)) say_item(item_name(27001),27001,"") set_state ( killdog ) pc.setqf("state", 0) q.set_counter(gameforge.main_quest_lv2._95_counter, 0) end end state killdog begin when letter begin send_letter(gameforge.main_quest_lv2._100_sendLetter) end when button or info begin say_title(gameforge.main_quest_lv2._110_sayTitle) say(gameforge.main_quest_lv2._120_sayReward) say_reward(string.format(gameforge.main_quest_lv2._130_sayReward, pc.getqf("state"))) end when 101.kill begin local count = pc.getqf("state") + 1 if count <= 9 then pc.setqf("state", count) q.set_counter(gameforge.main_quest_lv2._135_counter, 9 - count) if count == 9 then say_title(gameforge.main_quest_lv2._140_sayTitle) say(gameforge.main_quest_lv2._150_sayReward) set_state (gototeacher2) end end end when 20354.chat.gameforge.main_quest_lv2._160_npcChat with pc.getqf("state") < 9 begin say_title(gameforge.main_quest_lv1._60_sayTitle) say(gameforge.main_quest_lv2._170_say) if pc.is_gm() then wait() say_title(gameforge.main_quest_lv2._180_sayTitle) say(gameforge.main_quest_lv2._182_say) local s = select(gameforge.locale.guild.yes, gameforge.locale.guild.no) if s == 1 then set_state (gototeacher2) end end end when 20354.chat.gameforge.main_quest_lv2._160_npcChat with pc.getqf("state") >= 9 begin say_title(gameforge.main_quest_lv1._60_sayTitle) say(gameforge.main_quest_lv2._190_say) set_state (gototeacher2) end end state gototeacher2 begin when letter begin local v=find_npc_by_vnum(20354) if 0==v then else target.vid("__TARGET__", v, gameforge.main_quest_lv2._40_targetVid) end end when letter begin send_letter(gameforge.main_quest_lv2._200_sendLetter) end when button or info begin say_title(gameforge.main_quest_lv2._200_sendLetter) say_reward(gameforge.main_quest_lv2._150_sayReward) end when __TARGET__.target.click begin target.delete("__TARGET__") say_title(gameforge.main_quest_lv1._60_sayTitle) say(gameforge.main_quest_lv2._210_say) wait() say_title(gameforge.collect_herb_lv4._130_sayTitle) say_reward(gameforge.main_quest_lv2._220_sayReward) say_reward(string.format(gameforge.main_quest_lv2._230_sayReward, item_name(27001), 15)) say_item(item_name(27001),27001,"") pc.give_exp2( 250 ) pc.change_money( 1000 ) pc.give_item2( 27001 ,15 ) pc.setqf("state", 0) clear_letter() set_state (__COMPLETE__) set_quest_state("main_quest_lv3","run") end end state __COMPLETE__ begin end end