blue 0 Posted July 7, 2020 Share Posted July 7, 2020 Hey folks, I'm new to this and trying to experiment with metin2 quests. Does anyone know how to add the location detection function to a quest? For example, do you remember the horse/pony level-up (lv. 1-10) quest on the official servers? TIA! Link to comment Share on other sites More sharing options...
Contributor TMP4 10998 Posted July 7, 2020 Contributor Share Posted July 7, 2020 (edited) Quote state training_frame_purple_step5 begin when letter begin target.pos("__TARGET__", 490, 560, 62, "") end when letter begin setskin(NOWINDOW) makequestbutton(gameforge.pony_levelup._130_makequestbutton) q.set_title(gameforge.pony_levelup._130_makequestbutton) q.start() end when button or info begin say_title(gameforge.pony_levelup._130_makequestbutton) say(gameforge.pony_levelup._140_sayReward) end when 22000.use or 22010.use begin setstate(failure) end when __TARGET__.target.arrive begin target.delete("__TARGET__") say_title(gameforge.pony_levelup._130_makequestbutton) say_reward(gameforge.pony_levelup._150_sayReward) setstate(report) end when unmount begin setstate(failure) end end I marked with red what you're looking for. (local_x, local_y, mapindex when you set the target's location) If you don't want to make a target (like treasure hunting or something) then you can use these quest function: pc.get_local_x() pc.get_local_y() pc.get_map_index() I just wrote an example quest for hidden treasure hunting: quest lost_treasure begin state start begin when login with pc.get_map_index() == 255 and pc.getqf("treasure") == 0 begin loop_timer("hidden_treasure", 3) chat("Search the hidden spot!") end when hidden_treasure.timer with pc.getqf("treasure") == 0 begin if pc.get_local_x() >= 100 and if pc.get_local_x() <= 150 and pc.get_local_y() >= 50 and pc.get_local_y() <= 100 then chat("You found the area!") pc.change_gold(1000000) pc.setqf("treasure",1) cleartimer("hidden_treasure") end end end end So if the user go to the rectangle (x: 100,150; y: 50, 100) he'll get gold only once. It uses loop_timer (3sec) but i suppose it is one time or event quest so it'll be good. Edited July 7, 2020 by TMP4 1 Link to comment Share on other sites More sharing options...
blue 0 Posted July 7, 2020 Author Share Posted July 7, 2020 @TMP4 Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now