Jump to content
Tera

Reputation mob

Recommended Posts

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...

 

  • Like 2

lelouch_signature_by_vahntheknight-d4uafwj.png

Share this post


Link to post
Share on other sites

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 by Ximboliex
  • Like 1

xbx3.png

Share this post


Link to post
Share on other sites
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.

  • Like 1

logo-big.png   logo.png

                                   Sunny Go! Online                                                                    pko.host                                                 

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

@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 

 


lelouch_signature_by_vahntheknight-d4uafwj.png

Share this post


Link to post
Share on other sites
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 by Tera
resuelto

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

Do not quote too long post, it's annoying to read :P.  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 

 


lelouch_signature_by_vahntheknight-d4uafwj.png

Share this post


Link to post
Share on other sites

 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 by BETEP/macs509

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites
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 by Vasil
  • Like 1

Share this post


Link to post
Share on other sites

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!

  • Like 1

Share this post


Link to post
Share on other sites
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 ?

Share this post


Link to post
Share on other sites
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

 

  • Thanks 1

lelouch_signature_by_vahntheknight-d4uafwj.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...