Tera 26 Report post Posted December 27, 2016 How can make kill a monster and obtain reputation? Quote Share this post Link to post Share on other sites
Eviles 179 Report post Posted December 27, 2016 Hello. You can put something like on GetExp_PKM, should work: local MID = GetChaID(dead) if(MID == 1)then local fame = GetChaAttr( atk , ATTR_FAME ) local famebonus = 100 fame = fame + famebonus SetCharaAttr( fame, atk , ATTR_FAME ) end Where MID == 1 is monster id and famebonus = reputation amt... 2 Quote Share this post Link to post Share on other sites
Ximboliex 86 Report post Posted December 27, 2016 (edited) Other way "hook" your need runing in your server "hook.lua" function KillMobRep(ignore, dead, atk) local dead_type = GetChaTypeID(dead) if dead_type >4 then AddMasterCredit ( atk, ####) --rep to add end end Hook:AddPostHook("GetExp_PKM",KillMobRep) Edited December 27, 2016 by Ximboliex 1 Quote Share this post Link to post Share on other sites
Eviles 179 Report post Posted December 27, 2016 @Ximboliex Should use Attr intead of AddMasterCredit, i think you understand as well for who the rep will be sent, xD. 1 Quote Share this post Link to post Share on other sites
Shako 97 Report post Posted December 27, 2016 34 minutes ago, Satan said: @Ximboliex Should use Attr intead of AddMasterCredit, i think you understand as well for who the rep will be sent, xD. good catch. 1 Quote Sunny Go! Online pko.host Share this post Link to post Share on other sites
Ximboliex 86 Report post Posted December 27, 2016 4 hours ago, Satan said: @Ximboliex Should use Attr intead of AddMasterCredit, i think you understand as well for who the rep will be sent, xD. Quote Share this post Link to post Share on other sites
Tera 26 Report post Posted December 27, 2016 18 hours ago, Satan said: Hola. Usted puede poner algo así como el GetExp_PKM, debería funcionar: Donde MID == 1 es Identificación del monstruo y famebonus = amt reputación ... Where would this located?in function? Quote Share this post Link to post Share on other sites
Eviles 179 Report post Posted December 27, 2016 @Tera exp_and_level.lua, function GetExp_PKM(dead,atk). Quote Share this post Link to post Share on other sites
Tera 26 Report post Posted December 27, 2016 Thank you Quote Share this post Link to post Share on other sites
Tera 26 Report post Posted December 28, 2016 9 hours ago, Satan said: @Tera exp_and_level.lua, function GetExp_PKM(dead,atk). Could you tell me how to edit this same function so that instead of giving reputation gives me items? Quote Share this post Link to post Share on other sites
Eviles 179 Report post Posted December 28, 2016 @Tera Just use GiveItem() instead of SetChaAttr(), eg: local MID = GetChaID(dead) if(MID == 1)then BickerNotice(atk,'Find a refining gem!') GiveItem( atk, 885 , 1, 4 ) end Quote Share this post Link to post Share on other sites
Tera 26 Report post Posted December 28, 2016 (edited) Hace 4 horas, Satanás dijo: @Tera Sólo Tiene Que Como utilizar GiveItem () en Lugar de SetChaAttr (), por example: I did not understand, it's working thanks: D Edited December 28, 2016 by Tera resuelto Quote Share this post Link to post Share on other sites
Tera 26 Report post Posted December 28, 2016 22 minutes ago, Tera said: I did not understand, it's working thanks: D 22 minutes ago, Tera said: I did not understand, it's working thanks: D no, not working, I put it within the same function of reputation or should I go in another function? Quote Share this post Link to post Share on other sites
Eviles 179 Report post Posted December 28, 2016 Do not quote too long post, it's annoying to read . Use elseif: https://www.lua.org/pil/4.3.1.html local MID = GetChaID(dead) if(MID == 1)then local fame = GetChaAttr( atk , ATTR_FAME ) local famebonus = 100 fame = fame + famebonus SetCharaAttr( fame, atk , ATTR_FAME ) elseif(MID == 2) then BickerNotice(atk,'Find a refining gem!') GiveItem(atk, 885 , 1, 4 ) end Quote Share this post Link to post Share on other sites
BETEP/macs509 87 Report post Posted December 28, 2016 (edited) in exp_and_level.lua are looking for function ShareTeamExp move on local map_name_atk = GetChaMapName ( The_Killer ) local map_name_def = GetChaMapName ( dead ) if map_name_atk == "guildwar" or map_name_def == "guildwar" then local normal_monster = GetChaID(dead) if normal_monster == 220 then AddState ( The_Killer , The_Killer , STATE_HFZQ , 10 , 10 ) end if normal_monster == 219 then AddState ( The_Killer , The_Killer , STATE_QINGZ , 10 , 300 ) end if normal_monster == 217 then AddState ( The_Killer , The_Killer , STATE_JRQKL , 10 , 180 ) end if normal_monster == 218 then AddState ( The_Killer , The_Killer , STATE_YS , 10 , 300 ) end elseif map_name_atk == "guildwar2" or map_name_def == "guildwar2" then local normal_monster = GetChaID(dead) if normal_monster == 220 then AddState ( The_Killer , The_Killer , STATE_HFZQ , 10 , 10 ) end if normal_monster == 219 then AddState ( The_Killer , The_Killer , STATE_QINGZ , 10 , 300 ) end if normal_monster == 217 then AddState ( The_Killer , The_Killer , STATE_JRQKL , 10 , 180 ) end if normal_monster == 218 then AddState ( The_Killer , The_Killer , STATE_YS , 10 , 300 ) end insert elseif map_name_atk == "garner2" or map_name_def == "garner2" then --map local normal_monster = GetChaID(dead) if normal_monster == 1500 then --id mob SystemNotice ( TurnToCha(t) , "За уничтожение сундука нач. уровня получено 20 репутации!" ) local r = 20 -- reputation AddCreditX(The_Killer, r) --calculation end Edited December 28, 2016 by BETEP/macs509 Quote Share this post Link to post Share on other sites
Faller 93 Report post Posted December 30, 2016 Hey guys! Any tips on how to add money? I've tried "AddMoney ( role , 0 ,QTY )" But no success, I get the following error message: lua function [lua_AddMoney] parameter unit or type error! Thanks! Quote Share this post Link to post Share on other sites
Vasil 71 Report post Posted December 30, 2016 (edited) MoneyDWHook = GetExp_PKM GetExp_PKM = function( dead , atk ) MoneyDWHook(dead,atk) local DeadMonster = GetChaID(dead) if(GetChaMapName(atk) == "puzzleworld" or GetChaMapName(atk) == "puzzleworld2") then if(DeadMonster == 669 or DeadMonster == 670 or DeadMonster == 671 or DeadMonster == 672 or DeadMonster == 725 or DeadMonster == 726)then local chamoney = GetChaAttr( atk , ATTR_GD ) local moneyadd = 1000000 chamoney = chamoney + moneyadd SetCharaAttr( chamoney, atk , ATTR_GD ) SyncChar(atk,4) SystemNotice( atk, "You have Recieved 1 Million Gold From "..GetChaDefaultName(dead) ) end elseif(GetChaMapName(atk) == "darkswamp")then if(DeadMonster == 696 or DeadMonster == 695 or DeadMonster == 698 or DeadMonster == 697)then local chamoney = GetChaAttr( atk , ATTR_GD ) local moneyadd = 500000 chamoney = chamoney + moneyadd SetCharaAttr( chamoney, atk , ATTR_GD ) SyncChar(atk,4) SystemNotice( atk, "You have Recieved 500k Gold From "..GetChaDefaultName(dead) ) end end end This should work @Faller Edited December 30, 2016 by Vasil 1 Quote Share this post Link to post Share on other sites
Faller 93 Report post Posted December 30, 2016 Hey @Vasil~~ Thanks! I'll try using this part, so I won't need to hook: Quote local chamoney = GetChaAttr( atk , ATTR_GD ) ocal moneyadd = 1000000 chamoney = chamoney + moneyadd SetCharaAttr( chamoney, atk , ATTR_GD ) SyncChar(atk,4) SystemNotice( atk, "You have Recieved 1 Million Gold From "..GetChaDefaultName(dead) ) end Appreciate it! 1 Quote Share this post Link to post Share on other sites
kyleflow 35 Report post Posted March 24, 2022 On 12/27/2016 at 11:29 AM, Eviles said: Hello. You can put something like on GetExp_PKM, should work: local MID = GetChaID(dead) if(MID == 1)then local fame = GetChaAttr( atk , ATTR_FAME ) local famebonus = 100 fame = fame + famebonus SetCharaAttr( fame, atk , ATTR_FAME ) end Where MID == 1 is monster id and famebonus = reputation amt... Using this script give reputation but its not auto updated. need to relog before can see changes in reputation. Any ways to make it work like normal reputation ? Quote Share this post Link to post Share on other sites
Eviles 179 Report post Posted March 24, 2022 9 hours ago, kyleflow said: Using this script give reputation but its not auto updated. need to relog before can see changes in reputation. Any ways to make it work like normal reputation ? Hi @kyleflow! This function refresh the character when called, you can simple add it after SetCharaAttr(): RefreshCha(atk) I've recoded whole function for better understanding and also created a function which gives reputation to player, you can call it anywhere you want to give reputation to player. -- @FUNCTION: Give amount reputation set to character -- @PLACE IT ON: functions.lua or end of exp_and_level.lua function GiveReputation(Character, Amount) local Fame = GetChaAttr(Character, ATTR_FAME) local FameAdd = Amount local FameMinLimit = 0 local FameMaxLimit = 100000000 local FinalFame = Fame + FameAdd if FinalFame >= FameMaxLimit then SetCharaAttr(FameMaxLimit, Character, ATTR_FAME) elseif FinalFame <= FameMinLimit then SetCharaAttr(FameMinLimit, Character, ATTR_FAME) else SetCharaAttr(FinalFame, Character, ATTR_FAME) end RefreshCha(Character) end -- @FUNCTION: Give reputation to player after monster being killed by him -- @CALL ON: GetExp_PKM, after SetItemHost() function Reputation_PKM(dead, atk) -- @CONFIGURATION: -- Key = MonsterID (characterinfo.txt) -- Value = Reputation to give to player local monster_conf = { [103] = 100, -- Forest Spirit (default: 100 reputation) [75] = 10, -- Mystic Shrub (default: 10 reputation) } local offset = monster_conf[GetChaTypeID(dead)] if offset ~= nil and offset > 0 then GiveReputation(atk, offset) end end 1 Quote Share this post Link to post Share on other sites