Beiträge von Syreldar

    Guys stop using global vars please.

    The pc.get_map_index() == 136 check doesn't work because you are inside a dungeon, and while inside a dungeon, your map index multiplies per 10000.


    That's why, for every dungeon, an 'InDungeon' function is necessary.


    Example:


    So what you want to do after adding this kind of function is:



    Code
    1. when 1092.kill with QUESTNAME.InDungeon() begin
    2. d.notice("Du hast den Dämonenkönig getötet.")
    3. d.notice("Aber diese Metinsteine werden euch nun aufhalten!")
    4. d.spawn_mob(8027, 68, 57)
    5. d.spawn_mob(8027, 45, 74)
    6. d.spawn_mob(8027, 35, 42)
    7. d.spawn_mob(8027, 54, 29)
    8. end -- when

    Hello!


    I had nothing to do, so i thought about posting a clean, simple and useful quest-functions collection for you guys.
    Those are my quest functions, but you are free to suggest a quest function down here and i'll add it!


    functions.lua:


    24/08/2017:

    • Polished up other functions.
    • Added party_get_member_count,
    • Added party_get_member_pids,
    • Added clear_dungeon,
    • Added table_get_keyword_index,
    • Added table_is_any_subarray_containing_keyword,
    • Added table_get_subarray_keyword_index

    26/08/2017:

    • Added table_shuffle.

    30/04/2018:

    • Reworked table_shuffle, since it was not working properly.
    • Added InDungeon() [bool].
    • Added ToDungeonIndex(map_index) [int].

    01/06/2018:

    • Added factorial (factorial(5) returns 120);

    14/11/2019:

    • (Did you miss me?) Updated the whole list, better code and even more functions!

    25/12/2021:

    • Added is_valid_number, is_integer_number. (safe funcs you should be using on numerical inputs)
    • table_shuffle now creates a copy of the table and works on it instead of changing the table itself. The end result is the same, but the table passed as argument remains untouched.
    • Reworked get_time_format.
    • Renamed IsOdd to is_odd.

    25/6/2022:

    • Added get_gold_format
    • Added BuildSkillListOfLevel
    • Minor fixes.

    25/10/2022:

    1. Fixed IntToRomanStr typo

    29/01/2023:

    1. Rewritten.
    2. Added some new stuff.
    3. Provided more examples and data for each func.

    Hello.

    Example of a bad quest:


    That is absolutely obnoxious in my opinion, totally obnoxious.
    I'm here today to show you the simplest, cleanest and shortest way to deal with something like this: A quest which communicates with a simple library in order to get global notice and eventual drop from a boss/monster or metin kill, the quest is coded to work with bosses, but it's fully ampliable and 100% customizable to your likings.
    I release this in hope to see less quests like the one i put into a spoiler (no one should see that, it could spread terminal cancer).


    As always, the library is fully customizable.
    Each function contains a clear explanation of its structure and what it does.


    Have fun!


    Function Library File (.lua):


    Quest File:


    How do i use the library file?
    Make it load by dofile() in your questlib.lua or simply add what's inside it to the questlib.lua as it is.


    Why should i use it?
    First of all, as I said, it's fully customizable: you can just add new monsters to the main data array and the quest will handle them.
    Secondly, the library file contains the full boss and data arrays + documentation and yet it still is only 120 lines of code, the quest contains the checks and the notice/drop functions, nothing else, since the whole is completely managed by the library, small, yet full of functionalities.