FapFap 13 Report post Posted August 24, 2018 (edited) Can anyone tell me how to make Mobs give Reputation automatically to the character that kill the mobs ( but not 100%, and i want a specified mob not every mob ) Something like this code: local dead_id = GetChaID(dead) local mob = {} mob[103] = {ItemDrop = 5555, Quantity = 1, Quality = 4, Rate = 0.3} --30% drop if mob[dead_id] ~= nil then if Percentage_Random(mob[dead_id].Rate) == 1 then GiveItem ( atk, 0, mob[dead_id].ItemDrop, mob[dead_id].Quantity , mob[dead_id].Quality) end end But instead of item i want Reputation to be given to the player, anyone can show me an idea? thanks Edited August 24, 2018 by FapFap Quote Share this post Link to post Share on other sites
iZae 55 Report post Posted August 25, 2018 Inside GetExp_PKM function (exp_and_level.lua) you could add somewhere: local atk_fame = GetChaAttr(atk, ATTR_FAME) local dead_id = GetChaID(dead) local rep_by_mob{} rep_by_mob[103]= 1000; if mob[dead_id] ~= nil then atk_fame = atk_fame + rep_by_mob[dead_id] SetCharaAttr(atk_fame, atk, ATTR_FAME) end in that example the mob id 103 will give the killer 1000 rep. if you want to add more mobs with their specific ammount of reputation you can just add more rep_by_mob[103]= 1000; where 103 is the character id and 1000 is the reputation. I hope it's clear. 3 Quote Share this post Link to post Share on other sites
Rinor 59 Report post Posted August 25, 2018 (edited) Nice Edited August 25, 2018 by Rinor Quote Share this post Link to post Share on other sites
FapFap 13 Report post Posted August 25, 2018 (edited) @iZae what if i want a random amount of 10-100 reps to be given from killing mob ( not 100%, not every mob gives rep ) edit: also your code not adding anything Edited August 25, 2018 by FapFap Quote Share this post Link to post Share on other sites
Onioni 58 Report post Posted August 25, 2018 (edited) 3 hours ago, FapFap said: @iZae what if i want a random amount of 10-100 reps to be given from killing mob ( not 100%, not every mob gives rep ) edit: also your code not adding anything math.random(10,100) ---*Add Reputation*--- function AddReputationx(role,amount) local playerReputation = GetChaAttr(role, ATTR_FAME) playerReputation = playerReputation + amount SetCharaAttr(playerReputation, role, ATTR_FAME) SystemNotice(role,"You've recieved "..amount.." reputation! ["..playerReputation.."]") end ---*exp and level Lua, add in GetExp_New*--- function GetExp_New(dead , atk ) for RepMob = 1 , MonsterRepID_Max , 1 do if rolemod_atker == 1 and rolemod_defer == 0 and MonsterID == MonsterRepID[RepMob] then local RepBossID = GetChaID(dead) local GetKillerName = GetChaDefaultName(atk) AddReputationx(GetKillerName, MonsterRep[RepBossID]) end end --*Variable*-- MonsterRepID_Max = 6 MonsterRepID = {} MonsterRep = {} reprand = math.random(10,100) reprandz = math.random(50,500)--few examples MonsterRepID[1 ] = 1429 MonsterRep[1429] = reprand -- Demonic Chest MonsterRepID[2 ] = 1430 MonsterRep[1430] = reprand -- Incubus Chest MonsterRepID[3 ] = 1428 MonsterRep[1428] = reprand -- Nightmare Chest MonsterRepID[4 ] = 712 MonsterRep[712] = reprandz -- Abandoned Chest 1 MonsterRepID[5 ] = 713 MonsterRep[713] = reprandz -- Abandoned Chest 2 MonsterRepID[6 ] = 714 MonsterRep[714] = reprandz -- Abandoned Chest 3 --not tested but used on my other stuff. Edited August 25, 2018 by Onioni Quote Download: Nightmare Demonic Helm Dimension Pirates Online files: get now New map Project: Flag PK Black Skin 3.1.3 for pko 1: Get now Share this post Link to post Share on other sites
Inuarashi 5 Report post Posted August 25, 2018 3 hours ago, FapFap said: @iZae what if i want a random amount of 10-100 reps to be given from killing mob ( not 100%, not every mob gives rep ) edit: also your code not adding anything could you paste your whole script? Quote Share this post Link to post Share on other sites
FapFap 13 Report post Posted August 26, 2018 @Stinger Hey, thanks alot, check out the code i posted on top, it works fine but if i add for ex: Tree or Iron Ore, even if i make the % 100% after cutting the tree i dont get the item directly on invertory Quote Share this post Link to post Share on other sites
Inuarashi 5 Report post Posted August 26, 2018 1 hour ago, FapFap said: @Stinger Hey, thanks alot, check out the code i posted on top, it works fine but if i add for ex: Tree or Iron Ore, even if i make the % 100% after cutting the tree i dont get the item directly on invertory maybe you could check on how resources work, as trees / iron ore seems to drop items everytime its cut, not when it dies like monsters. Quote Share this post Link to post Share on other sites
Inuarashi 5 Report post Posted August 27, 2018 (edited) thank you =) Edited August 27, 2018 by Inuarashi Quote Share this post Link to post Share on other sites
V1k1NGO 1 Report post Posted April 11, 2020 On 8/25/2018 at 9:12 PM, Onioni said: math.random(10,100) ---*Add Reputation*--- function AddReputationx(role,amount) local playerReputation = GetChaAttr(role, ATTR_FAME) playerReputation = playerReputation + amount SetCharaAttr(playerReputation, role, ATTR_FAME) SystemNotice(role,"You've recieved "..amount.." reputation! ["..playerReputation.."]") end ---*exp and level Lua, add in GetExp_New*--- function GetExp_New(dead , atk ) for RepMob = 1 , MonsterRepID_Max , 1 do if rolemod_atker == 1 and rolemod_defer == 0 and MonsterID == MonsterRepID[RepMob] then local RepBossID = GetChaID(dead) local GetKillerName = GetChaDefaultName(atk) AddReputationx(GetKillerName, MonsterRep[RepBossID]) end end --*Variable*-- MonsterRepID_Max = 6 MonsterRepID = {} MonsterRep = {} reprand = math.random(10,100) reprandz = math.random(50,500)--few examples MonsterRepID[1 ] = 1429 MonsterRep[1429] = reprand -- Demonic Chest MonsterRepID[2 ] = 1430 MonsterRep[1430] = reprand -- Incubus Chest MonsterRepID[3 ] = 1428 MonsterRep[1428] = reprand -- Nightmare Chest MonsterRepID[4 ] = 712 MonsterRep[712] = reprandz -- Abandoned Chest 1 MonsterRepID[5 ] = 713 MonsterRep[713] = reprandz -- Abandoned Chest 2 MonsterRepID[6 ] = 714 MonsterRep[714] = reprandz -- Abandoned Chest 3 --not tested but used on my other stuff. This code is in functions.lua? ---*Add Reputation*--- function AddReputationx(role,amount) local playerReputation = GetChaAttr(role, ATTR_FAME) playerReputation = playerReputation + amount SetCharaAttr(playerReputation, role, ATTR_FAME) SystemNotice(role,"You've recieved "..amount.." reputation! ["..playerReputation.."]") end Quote Share this post Link to post Share on other sites
V3ct0r 2,117 Report post Posted April 16, 2020 Hello @V1k1NGO! Yes, you can place this code to file functions.lua and it should work. Quote Some useful links / Полезные ссылки Tips for making a topic in 'Questions & Help' / Рекомендации по созданию тем в разделе "Помощь" Server Advertising Section Rules / Правила раздела "Реклама серверов" Available e-mail domains for registration / Допустимые e-mail домены для регистрации User groups / Группы пользователей User ranks / Звания пользователей "Broken" pictures on the forum / "Битые" изображения на форуме Beware of scammers! / Осторожно, мошенники! My developments / Мои разработки Mods for client and server / Моды для клиента и сервера PKOdev.NET website for Tales of Pirates Server / PKOdev.NET веб-обвязка для сервера Пиратии I do not provide any help in private messages and outside the forum. Use 'Questions & Help' section please. Thank you for understanding! Я не оказываю какую-либо помощь в личных сообщениях и вне форума. Пожалуйста, используйте раздел "Пиратия: Помощь". Благодарю за понимание! Share this post Link to post Share on other sites