kaiquegames069 Posted October 13, 2017 at 12:52 PM Share Posted October 13, 2017 at 12:52 PM Boas pessoal, tenho aqui essa quest de evento pvm que finaliza com um timer, porém pode ser que o timer é finalizado e ainda pode haver mobs a matar no mapa. Seria possível invés de finalizar com timer, não seria possível finalizar ao verificar se ainda existe algum monstro no mapa? Caso não exista o evento finalize? Fica aqui a quest! https://pastebin.com/6aXFxKaN Link to comment Share on other sites More sharing options...
[Admin] tierrilopes Posted October 14, 2017 at 01:07 PM Share Posted October 14, 2017 at 01:07 PM Dá para fazer com as mesmas funções utilizadas por exemplo em deviltower.quest No entanto o mapa do evento tem de ser um dungeon Link to comment Share on other sites More sharing options...
kaiquegames069 Posted October 15, 2017 at 04:35 PM Author Share Posted October 15, 2017 at 04:35 PM Não existe nenhuma forma de por exemplo, tem 40 mobs no mapa ao ativar o evento pvm, inicia um count de 40 kill para monstros, ao matar esses 40 monstros todos são teleportados para cidade em 10 segundos? Link to comment Share on other sites More sharing options...
Marco Posted October 15, 2017 at 04:40 PM Share Posted October 15, 2017 at 04:40 PM 5 minutos atrás, kaiquegames069 disse: Não existe nenhuma forma de por exemplo, tem 40 mobs no mapa ao ativar o evento pvm, inicia um count de 40 kill para monstros, ao matar esses 40 monstros todos são teleportados para cidade em 10 segundos? Em vez de meteres para matar "x" monstros, metes para matar todos os monstros Link to comment Share on other sites More sharing options...
Mário. Posted October 15, 2017 at 05:02 PM Share Posted October 15, 2017 at 05:02 PM Criei esta função a ver se resolve o teu problema. Ela conta todos os monstros que existem no mapa através do índex. questlua_pc.cpp: int pc_count_monster(lua_State * L) { CQuestManager& q = CQuestManager::instance(); LPCHARACTER MapIndex = q.GetCurrentCharacterPtr()->GetMapIndex(); if (MapIndex) lua_pushnumber(L, MapIndex->CountMonster()); else { sys_err("something is wrong."); lua_pushnumber(L, LONG_MAX); } return 1; } { "count_monster", pc_count_monster }, Exemplo de quest: quest contagem state start begin when login with pc.get_map_index() == 1 begin -- Se fizerem o login no mapa cujo o index é 1: if pc.counter_monster() <= 0 then -- Se a contagem dos monstros for inferior ou igual a 0: notice("Todos os monstros foram mortos.") end end end end OBS: Nada testado. Link to comment Share on other sites More sharing options...
juniorsilva Posted December 2, 2017 at 02:05 AM Share Posted December 2, 2017 at 02:05 AM (edited) Tá ai a nova função counter_monster_in_map(mapindex) ...... Vá em questlua_global.cpp e adicione isso acima da função: int _regen_in_map( lua_State * L ) int _counter_monster_in_map(lua_State * L) { DWORD iMapIndex = (DWORD)lua_tonumber(L, 1); LPSECTREE_MAP pMap = SECTREE_MANAGER::instance().GetMap(iMapIndex); if (pMap != NULL) { lua_pushnumber(L, SECTREE_MANAGER::instance().GetMonsterCountInMap(iMapIndex)); return 1; } return 0; } Depois vá em void RegisterGlobalFunctionTable(lua_State* L) e adicione abaixo da definição : "get_special_item_group", _get_special_item_group }, { "counter_monster_in_map", _counter_monster_in_map }, Mini quest com a nova função counter_monster_in_map(mapindex): quest counter_monster begin state start begin when 20095.chat."Verificar o counter_monster" with pc.is_gm() begin say("Verificar se existem monstros?") say("") local s = select("Sim","Não") if s == 2 then return end notice(string.format("Total de Mobs: %d.", counter_monster_in_map(200))) end when 20095.chat."Evento counter_monster" with pc.is_gm() begin say("Iniciar Evento PVM?") say("Status: "..game.get_event_flag("event_pvm")) say("") local s = select("Iniciar","Finalizar", "Cancelar") if s == 2 then game.set_event_flag("event_pvm", 0) clear_server_timer("check_monster") notice_all("O Evento PVM foi finalizado!") return end if s == 3 then return end game.set_event_flag("event_pvm", 1) notice_all("O Evento PVM foi iniciado!") mob.spawn_group(104, pc.get_local_x(), pc.get_local_y(), 1, 1, 1) mob.spawn(1093, pc.get_local_x(), pc.get_local_y(), 1) server_loop_timer("check_monster", 10) end when kill with not npc.is_pc() begin notice(string.format("O jogador %s matou: %s.", pc.get_name(), mob_name(npc.get_race()))) end when check_monster.server_timer begin if game.get_event_flag("event_pvm") == 1 then if counter_monster_in_map(200) == 0 then game.set_event_flag("event_pvm", 0) clear_server_timer("check_monster") notice_all("O Evento PVM foi finalizado!") end end end end end Isso é tudo boa sorte, qualquer dúvida é só comentar ..... Edited December 2, 2017 at 02:17 AM by juniorsilva Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now