Jump to content

Search the Community

Showing results for tags 'mission'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Russian Section
    • Новости и объявления
    • Пиратия: Документация
    • Пиратия: Релизы
    • Пиратия: Разработка
    • Пиратия: Web
    • Пиратия: Помощь
    • Совместные проекты / набор команды
    • Доска объявлений
    • Программирование
    • Оффтопик
    • Корзина
  • English Section
    • News & Announcements
    • Guides
    • Releases
    • Development
    • Web
    • Questions & Help
    • Shared Projects / Team search
    • Paid services & Requests
    • Programming
    • Offtopic
    • Recycle bin
  • Portuguese Section
    • Dúvidas & Ajuda
  • Spanish Section
    • Preguntas y Ayuda
  • Servers
    • Russian servers
    • English servers

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 2 results

  1. Hi all. I am posting this here as it took me some time to figure it out and maybe someone else wants to use it as well. - What we want to achieve: Mission shows a "[Completed]" flag in the quest log when we have collected all items - killed all mobs - In directory `/resource/script/MisSdk/` 1. File: ScriptSdk.lua: We will start a variable called `MissionSid = {}` in global variables definition, line ~=16 (below `Mission` variable): and in function `DefineMission` we will cal the MissionSid with a misid index: 1. File: MissionSdk.lua: Here we will use the function `RefreshCompleteFlag` (used normally by random class quests, "A hunter's life" etc). First in the `RefreshCompleteFlag` function itself: The function defines a local called: `local mission`. We will start this local with the value of `Mission[sid]`, so replace `local mission` with `local mission = Mission[sid]`: Then we need to use the `RefreshCompleteFlag` function in the `AddNextFlag` function: ( we added the line `RefreshCompleteFlag(character,MissionSid[id])` ): I hope this can help someone. Sorry for my English and if there are mistakes/bad scripting/better way, please let me know
  2. [Script] Quest requires 'X' hours after the start Hello! In this thread I am posting an example of script that will allow you to check the condition when the player completes the quest: 'X' time has to pass after starting the quest to complete it. Usage MisResultCondition(MissionTimeExpired, <quest_id>, <time_in_seconds_to_wait>) Installation Add the following code to the file 'vairable.lua': -- Table with the time of taking quests by characters if (quest_table_guard == nil) then quest_table_guard = true quest_table = { } end Add to the file 'functions.lua': -- Quest added event AddMission__Original = AddMission AddMission = function(role, id, param) -- Call original AddMission function local ret = AddMission__Original(role, id, param) -- Check the result if ( ret == LUA_TRUE ) then -- Add the quest to the table quest_table[id] = quest_table[id] or {} -- Remember the time when the character took the quest quest_table[id][ GetRoleID(role) ] = os.time() end -- Return original result return ret end -- Check that some time expired since character taken the quest function MissionTimeExpired(role, id, t) -- Check that quest exists in the table if ( quest_table[id] == nil ) then -- Quest not found return LUA_TRUE end -- Get character ID local cha_id = GetRoleID(role) -- Check that the character has the quest if ( quest_table[id][cha_id] == nil ) then -- Character doesn't have the quest ?! return LUA_TRUE end -- Calculte time delta local delta = ( os.time() - quest_table[id][cha_id] ) -- Check that t seconds expired since quest started if ( delta >= t ) then -- Remove character from table quest_table[id][cha_id] = nil -- Condition is completed return LUA_TRUE end -- Condition is not completed return LUA_FALSE end And finally register the new function in the file 'MissionSdk.lua' ('ConditionsTest' function): . . . elseif conditions[i].func == MissionTimeExpired then local ret = MissionTimeExpired( character, conditions[i].p1, conditions[i].p2 ) if ret ~= LUA_TRUE then PRINT( "ConditionsTest: MissionTimeExpired = false" ) return LUA_FALSE end . . . That's all! Note: 1) All data about the time of taking quests by characters will be lost when the server is restarted. You need to come up with a mechanism for saving the table 'quest_table' to a file or database if this is critical for your application; 2) NPCs that give and accept a quest with this condition must be within the same GameServer instance.
×
×
  • Create New...