Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Money By Killing Monsters.

Preparing
Loyal Member
Joined
Sep 18, 2011
Messages
1,104
Reaction score
257
Before starting, this is not my guide I just posted it here

K lets start.


The function to work with is

GetExp_New(dead, atk) found in exp_and_level.lua
this function is called to give exp when killing action happens.


There are lots of ways you can go by to calculate random amounts.
#1
you can directly do a random value calculation.
Code:
money = math.random(50000,100000)

That should give any amount between 50k to 100k.

#2
do a random value and a multiplier for it.
Code:
money = math.random(50000,100000)
multiplier = (2,10)
finalValue = money * multiplier

This will first generate a random value between 50k and 100k and then generate another random value between 2 and 10. After that, both are multiplied to get the final value.

There are many more ways you can do... :)

first we will check if the dead is a monster.
so we do
Code:
    if IsPlayer(dead) ~= 1 then -- if its not player.
So in this part of below function, i've gone with a request from sunshine , where he wants players to get $ 1 million by killing Snowman Warlord.
So i've checked mobID, if it is 678 which is for Snowman Warlord, then amount becomes 1m, also to explain things a bit more, i've added one more id (679 which is Wandering soul), if players kill it, they get 2m, and for any other mob (i used else that means for any other id), they get the random value :)
Code:
        local mobID = GetChaID(dead)

        if mobID == 678 then
            amount = 1000000
        elseif mobID == 679 then
            amount = 2000000
        else
            a = math.random(200, 900)
            b = math.random(2, 10)
            amount = a*b
        end

        AddMoney ( atk, 0 , amount )
Amount value which is calculated or defined will be added to player. If you want only for certain mobs, you can remove the part for else. should do :)


Place this right below
Code:
    if ValidCha(atk) == 0  then
        LG ( "exp_atker=NIL" , "function GetExp_New : atker = nil " )
        return
    end
in function GetExp_New(dead , atk )

Credits goes to Amu for this guide.
 
Back
Top