Jump to content
Brothers

Kill mobs and earn money

Recommended Posts

I know there was a topic of this, but i cant find it anymore.

What i want: When i kill some special mobs, i want to make money (instead of exp?)..

Can anyone help me or link with the old topic? Thank you

 

- Ivy

Share this post


Link to post
Share on other sites

Hello, @Brothers!

 

Find function GetExp_PKM in file exp_and_level.lua (GameServer\resource\scripts\calculate) and add the following code at the beginning of the function:

AddMoney(atk, 0, 1000)

where 1000 is the amount of gold the character will receive.

 

 

function GetExp_PKM(dead, atk)
	AddMoney(atk, 0, 1000)
	-- Original code . . .
end

 

  • Like 1

Share this post


Link to post
Share on other sites
5 hours ago, Brothers said:

Hey, @V3ct0r!


As always, thank you very much :)

and if you're trying to use it only on specific monsters, then add a condition:

local monster = GetChaID(dead)
if monster == monster_id then
--addmoney
end

Share this post


Link to post
Share on other sites
On 7/22/2018 at 5:14 AM, quad said:

and if you're trying to use it only on specific monsters, then add a condition:

local monster = GetChaID(dead)
if monster == monster_id then
--addmoney
end

its posible to add more monsters id separated with , ?

Share this post


Link to post
Share on other sites
8 hours ago, Masuka00 said:

its posible to add more monsters id separated with , ?

try this
 

function GetExp_PKM(dead, atk)
	local MonsterIDs = {
	[789] = 5000,	---monster id --- gold amount 
	}
	
	local monster = GetChaID(dead)
	for i,v in pairs(MonsterIDs) do
		if (i == monster) then
			AddMoney(atk, 0, v)
			break
		end
	end
	
end

 

Edited by mkhzaleh
  • Thanks 2

Share this post


Link to post
Share on other sites
16 hours ago, V3ct0r said:

@mkhzaleh

 

You can make it easier:


if (MonsterIDs[monster] ~= nil) then
	AddMoney(atk, 0, MonsterIDs[monster])
end

 

I got this

 

sshot-5.png.1a41f1fce156cdb5408a0e72a3a92792.png

 

but i figure out

 

sshot-6.png.4f2e6da0594812ae20217af4124767ae.png

 

The is something between well I know that many already know what I mean but I comment in case anyone wanted to know 😏

 

and

 

sshot-7.png.bd893538ae5ed7930ed365e6b672e8dd.png

 

can you tell the difference? 🤔

 

If someone out there is just as lazy like me 😅 who only copies and pastes and then comes to say why the scrip  does not work 😥, take the time to inspect every detail, I just say it in a good way.
And thank you very much for the scrip code, I had not reviewed it until today to take away the doubt, but it took me almost 1 hour to realize my mistake, I have been in the forums for years but this of the scrip codes is not my thing.

Again, thank you very much

Edited by Masuka00

Share this post


Link to post
Share on other sites
2 hours ago, Masuka00 said:

I got this

 

sshot-5.png.1a41f1fce156cdb5408a0e72a3a92792.png

 

but i figure out

 

sshot-6.png.4f2e6da0594812ae20217af4124767ae.png

 

The is something between well I know that many already know what I mean but I comment in case anyone wanted to know 😏

 

and

 

sshot-7.png.bd893538ae5ed7930ed365e6b672e8dd.png

 

can you tell the difference? 🤔

 

If someone out there is just as lazy like me 😅 who only copies and pastes and then comes to say why the scrip  does not work 😥, take the time to inspect every detail, I just say it in a good way.
And thank you very much for the scrip code, I had not reviewed it until today to take away the doubt, but it took me almost 1 hour to realize my mistake, I have been in the forums for years but this of the scrip codes is not my thing.

Again, thank you very much

when you do copy past from forums you may have extra symbols 
like this
image.png.05ae253572854c4fb999fb9b7fc252e7.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×