shiva 2 Posted June 12, 2019 Share Posted June 12, 2019 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! Link to comment Share on other sites More sharing options...
Vanilla 1455 Posted June 12, 2019 Share Posted June 12, 2019 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. 1 We are the tortured. We're not your friends. As long as we're not visible. We are unfixable. Link to comment Share on other sites More sharing options...
shiva 2 Posted June 12, 2019 Author Share Posted June 12, 2019 Thank you. I was hoping i can do it with some "simple" return thing. But I will try your recommendation. Link to comment Share on other sites More sharing options...
Vanilla 1455 Posted June 12, 2019 Share Posted June 12, 2019 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 We are the tortured. We're not your friends. As long as we're not visible. We are unfixable. Link to comment Share on other sites More sharing options...
shiva 2 Posted June 12, 2019 Author Share Posted June 12, 2019 I have simple rule... NEVER use goto... It is Pandora's box But thank you. Link to comment Share on other sites More sharing options...
boaspessoal 8 Posted June 12, 2019 Share Posted June 12, 2019 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) Link to comment Share on other sites More sharing options...
Braxy 618 Posted June 12, 2019 Share Posted June 12, 2019 Post your quest so i can update your code. As long as I'll be a threat for you , i will always be your target :3 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