Jump to content
  • We need you!

    You must register to discover all the features of our community!

  • 0

Metin2 quest func where you can detect location


blue

Question

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 post

2 answers to this question

Recommended Posts

  • 0
Posted (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 by TMP4 (see edit history)
  • Love 1
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.