Kenta 23 Posted April 15, 2017 Share Posted April 15, 2017 Hello, I got a problem when i compile the quest with a quest i coded, what(): std::bad_alloc Badly placed ()'s. # Abort trap (core dumped) If someone could help me resolve my problem please, sry for bad english trophees.quest Link to comment Share on other sites More sharing options...
Rudhon 6 Posted April 15, 2017 Share Posted April 15, 2017 I can't download this file..Please write in this topic the code. Ready to code Link to comment Share on other sites More sharing options...
Kenta 23 Posted April 16, 2017 Author Share Posted April 16, 2017 Oh okay I'am sorry that's the code : quest trophees begin state start begin when kill with npc.is_pc() begin local check_my_ip = pc.get_ip() local check_enemy_ip = npc.get_ip() if check_my_ip == check_enemy_ip then nbpoints = pc.getqf("nbtrophees") else pc.setqf("nbtrophees", pc.getqf("nbtrophees") + math.random(23, 33)) local old = pc.select(npc.get_vid()) pc.setf("trophees","nbtrophees", math.random(13, 23)) pc.select(old) if ("nbtrophees") =< 2000 then pc.change_alignment(-2000) else if ("nbtrophees") =< 4000 then pc.change_alignment(2000) if ("nbtrophees") =< 6000 then pc.change_alignment(5000) else if ("nbtrophees") =< 8000 then pc.change_alignment(9000) if ("nbtrophees") =< 10000 then pc.change_alignment(15000) else if ("nbtrophees") =< 15000 then pc.change_alignment(15000) select name, dwpid, lvalue from player.quest, player.player where player.id == quest.dwpid and szname ="trophees" and szstate="nbtrophees" order by lvalue desc; end end end end end end end Link to comment Share on other sites More sharing options...
Premium Syreldar 1875 Posted April 16, 2017 Premium Share Posted April 16, 2017 This quests makes no sense at all, please explain what you want to accomplish, so i can write it for you in a decent way. Thanks. "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...
Kenta 23 Posted April 16, 2017 Author Share Posted April 16, 2017 In this quest for every kill u make ur going to win between 23 and 33 points and every time u will die u will lose between 13 or 23 points and when the player get 2000 points or 4000 etc.. who will set ur rank exemple : Between 0 and 2k points ur rank will be set at -2K Between 2K and 4k points at 2K Between 4k and 6k points at 5K Between 6k and 8k at 9k And finnaly between 8k end 10k at 15k, I hope u understand the goal of my quest sorry for bad english Link to comment Share on other sites More sharing options...
Kenta 23 Posted April 16, 2017 Author Share Posted April 16, 2017 UP PLEASE Link to comment Share on other sites More sharing options...
Premium Syreldar 1875 Posted April 17, 2017 Premium Share Posted April 17, 2017 quest trophees begin state start begin function alignment_to_points() local array = { [1] = {["align"] = 2000, ["points"] = -2000}, [2] = {["align"] = 4000, ["points"] = 4000}, -- 2000 [3] = {["align"] = 6000, ["points"] = 1000}, -- 5000 [4] = {["align"] = 8000, ["points"] = 4000}, -- 9000 [5] = {["align"] = 10000, ["points"] = 6000} -- 15000 }; return array; end -- function function refresh_alignment() local table_ex = trophees.alignment_to_points(); for i = 1, table.getn(table_ex) do if (pc.get_alignment() <= table_ex[i]["align"]) then return table_ex[i]["points"]; end -- if end -- for return 0; end -- function when kill with npc.is_pc() and pc.get_ip() ~= npc.get_ip() begin pc.setqf("kill_points", pc.getqf("kill_points")+math.random(23, 33)); pc.change_alignment(trophees.refresh_alignment()); pc.select(npc.get_vid()); pc.setqf("kill_points", pc.getqf("kill_points")-math.random(13, 23)); pc.change_alignment(trophees.refresh_alignment()); pc.select(); end -- when end -- state end -- quest It should work without any problem. "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...
Kenta 23 Posted April 17, 2017 Author Share Posted April 17, 2017 (edited) Thank you, it work ur awesome, but i just wanna benefit from this post because i have another problem with another quest that I coded but the quest don't work i don't understand why, the goal of the quest is to win 1 points for every kill and lose 20% of ur points for every death, and to display the number of points IG in the inventory like this https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif But the problem here is that when I do a kill i receive 1 points, but when I die i lose all my points and if I kill a player with like 20 points and I got 0 points the player is gonna lose all his points and I am gonna receive 18 points something like that i tried to solve it by my own but I'am a beginner in this language so i don't understand why it don't work That's the quest quest pvp begin state start begin when kill with npc.is_pc() begin pc.setqf("nbpoints", pc.getqf("nbpoints") + 1) local coins = pc.getqf("nbpoints") cmdchat("PointsPVP "..coins) syschat ("Vous recevez 1 points") local old = pc.select(npc.get_vid()) pts = pc.getf("pvp","nbpoints") pc.setf("pvp","nbpoints", math.floor(pts*0.8)) local coins = pc.getf("pvp", "nbpoints") cmdchat("PointsPVP "..coins) diff = pts - pc.getf("pvp","nbpoints") if diff == 0 then syschat("Vous ne perdez aucun points") else syschat("Vous perdez "..diff.." points") end pc.select(old) end end end If someone could help me it would be amazing, Edited September 3, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Kenta 23 Posted April 17, 2017 Author Share Posted April 17, 2017 UP PLEASE Link to comment Share on other sites More sharing options...
Premium Syreldar 1875 Posted April 17, 2017 Premium Share Posted April 17, 2017 quest pvp begin state start begin when kill with npc.is_pc() begin pc.setqf("nbpoints", pc.getqf("nbpoints")+1); cmdchat(string.format("PointsPVP %d", pc.getqf("nbpoints"))); syschat("You've received 1 Kill point.") pc.select(npc.get_vid()); pc.setqf("nbpoints", math.floor(pc.getqf("nbpoints")*0.8)); cmdchat(string.format("PointsPVP %d", pc.getqf("nbpoints"))); syschat("You've lost 20% of your current Kill points.") pc.select(); end -- when end -- state end -- quest "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...
Kenta 23 Posted April 17, 2017 Author Share Posted April 17, 2017 Thx, another time dude ! You are awesome. Just the first quest don't work when i get 2k points my rank don't change it's still the same 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