adi97ida 6 Posted March 19, 2014 Share Posted March 19, 2014 Hello, Today, i made a quest that drops some items if you break a metin stone. You get these items from the stone only if the differencte between player's level and metin's is no more than 15. Here's the code : quest drop_metine begin state start begin when kill begin if npc.get_race() >= 8001 and npc.get_race() <= 8055 then local mob = npc.get_level() + 15 local nivel = pc.get_level() local sex = pc.get_sex() local sansa2 = math.random(1,3) local sansa3 = math.random(1,2) chat("Nivelul metinului "..mob.."") if nivel >= mob then notice("Nivelul tau este prea mare pentru a primii rasplata...") else if sansa2 == 2 then if sex == 0 then game.drop_item_with_ownership("71159",1) else game.drop_item_with_ownership("71160",1) end game.drop_item_with_ownership("50130",1) -- cufar pietre game.drop_item_with_ownership("50130",1) -- cufar pietre game.drop_item_with_ownership("50130",1) -- cufar pietre game.drop_item_with_ownership("50513", sansa3) -- Drop SS-uri local aux = pc.getqf("metine_sparte") + 1 pc.setqf("metine_sparte", aux) chat("Metine Sparte "..aux.."") notice("Ai fost rasplatit!") end end end end end end The problem is that the "if nivel >= mob then" condition is not always happening... For example: My character is level 95, the level of the metin i kill is 90, after i break the stone, the "chat("Nivelul metinului "..mob.."")" message appears, but the condition is not evaluated anymore. This also happens if the difference is bigger than 15 levels...... Sometimes the condition is evaluated, sometimes is not. Can someone tell me what's wrong? Thank you in advance. Link to comment Share on other sites More sharing options...
Developer PACI 921 Posted March 19, 2014 Developer Share Posted March 19, 2014 npc.get_level() function doesn't exists I think. when you return 0 and server doesn't boot: Link to comment Share on other sites More sharing options...
adi97ida 6 Posted March 19, 2014 Author Share Posted March 19, 2014 it exists, i already specified that the evaluation is done with succes, but not always..... Link to comment Share on other sites More sharing options...
Developer PACI 921 Posted March 19, 2014 Developer Share Posted March 19, 2014 Why don't you write a table with metin stone's level? e.g: [8001] = 5, [8002] = 10, [8003] = 15, etc when you return 0 and server doesn't boot: Link to comment Share on other sites More sharing options...
Active Member ATAG 310 Posted March 19, 2014 Active Member Share Posted March 19, 2014 If you have more than 1 "when kill begin" like quest, you have to priorize in locale_list. Server runs the first (and only one) possible "event/callback" only. Sorry for my bad english, i hope you understand me 1 Link to comment Share on other sites More sharing options...
adi97ida 6 Posted March 19, 2014 Author Share Posted March 19, 2014 ATAG, can you please give me an example?? Link to comment Share on other sites More sharing options...
Pepineitor 69 Posted March 19, 2014 Share Posted March 19, 2014 Try this, and comment if you kill a metin in the chat appears "test1" quest drop_metine begin quest drop_metine begin state start begin when kill begin if npc.get_race() >= 8001 and npc.get_race() <= 8055 then local mob = npc.get_level() + 15 local nivel = pc.get_level() local sex = pc.get_sex() local sansa2 = math.random(1,3) local sansa3 = math.random(1,2) chat("Nivelul metinului "..mob.."") if nivel >= mob then notice("Nivelul tau este prea mare pentru a primii rasplata...") else chat("test1") if sansa2 == 2 then if sex == 0 then game.drop_item_with_ownership("71159",1) else game.drop_item_with_ownership("71160",1) end game.drop_item_with_ownership("50130",1) -- cufar pietre game.drop_item_with_ownership("50130",1) -- cufar pietre game.drop_item_with_ownership("50130",1) -- cufar pietre game.drop_item_with_ownership("50513", sansa3) -- Drop SS-uri local aux = pc.getqf("metine_sparte") + 1 pc.setqf("metine_sparte", aux) chat("Metine Sparte "..aux.."") notice("Ai fost rasplatit!") end end end end end end end Link to comment Share on other sites More sharing options...
Premium Syreldar 1875 Posted March 20, 2014 Premium Share Posted March 20, 2014 Write a table in questlib.lua with an array which returns metinvnum ---> metinlevel, and read that table. More simple. "Nothing's free in this life. Ignorant people have an obligation to make up for their ignorance by paying those who help them. Either you got the brains or cash, if you lack both you're useless." Syreldar Link to comment Share on other sites More sharing options...
Yiv 321 Posted March 20, 2014 Share Posted March 20, 2014 Why he shouldn't use the function noc.get_level() if he implemented it? He has - I think - 55 metin stones so to write the table he's just wasting time and if he adds a metin he always has to edit that. Put some chats for testing into the quest to check if it runs and whats the result of the condition and try again. Regards 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