metin2united
  • 0
shiva

open Lua return from select

Question

Hi, I'm doing quest for NPC and i have select for weapons.... In this select i have "Swords" "Daggers" and so on.... In "Swords" i have "Swords 1", "Swords 2", "Swords 3". 

When I'm in sword selection and I click on "Close", I want the quest to go back to "Weapon selection", which means 1 step "select" back... I tried return, but it is not working and the whole quest closes.... Do you know how to do it? :)

 

Thank you! :)

Share this post


Link to post
Share on other sites

6 answers to this question

  • 0

There are many options how to approach this.

You'd write this stuff into a function and just call it again once the player chooses "Close". Note that you'd at least give the player an option to properly exit the function, otherwise you're calling it recursive with no getting out, trapping the player in an endless loop of hopelessness. People start to forget the player's name as they're fading into oblivion, down the spiral of endless torture as they loose their understanding of time and space and their existence enters nothingness.

tl;dr: Recursive function is the key, but make sure you let the player exit it somewhere.

  • Haha 1

Share this post


Link to post
Share on other sites
  • 0

Thank you. :) I was hoping i can do it with some "simple" return thing. :D But I will try your recommendation. :)

Share this post


Link to post
Share on other sites
  • 0

I'm not 100% sure if you can do this on Metin2, but lua has a goto statement too.

http://lua-users.org/wiki/GotoStatement

If that's possible there you can just use it and "return" back to the prior code. But I absolutely hate goto stuff... So use it at your own risk, I'm not even sure if Metin2 can handle it

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, Vanilla said:

I'm not 100% sure if you can do this on Metin2, but lua has a goto statement too.

http://lua-users.org/wiki/GotoStatement

If that's possible there you can just use it and "return" back to the prior code. But I absolutely hate goto stuff... So use it at your own risk, I'm not even sure if Metin2 can handle it

goto statement is only available in lua 5.2+(metin2 original source uses 5.0)

Share this post


Link to post
Share on other sites

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

  • Recently Browsing   0 members

    No registered users viewing this page.