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!

[Tutorial] XP/GD random

Joined
Sep 3, 2013
Messages
903
Reaction score
227
Add a random number of 10 to the xp/gamme$ win.

Search :

Code:
if(plr->loadout_->Hardcore)
    {
        stat.GD = rwd.GD_SOFT;
        stat.XP = rwd.XP_SOFT;
    }

Change :

Code:
else
    {
        if(rwd.GD_SOFT>0)
            stat.GD = rwd.GD_SOFT [COLOR=#ff0000]+ u_random(10)[/COLOR];//Oosmar02:: GameDollars aleatoire GD_Soft + random de 10 = Final
        else
            stat.GD = rwd.GD_SOFT;
        if(rwd.XP_SOFT>0)
            stat.XP = rwd.XP_SOFT [COLOR=#ff0000]+ u_random(10)[/COLOR];//Oosmar02:: Xp aleatoire XP_Soft + random de 10 = Final
        else
            stat.XP = rwd.XP_SOFT;
    }


Like that :

Code:
wiStatsTracking ServerGameLogic::GetRewardData(obj_ServerPlayer* plr, EPlayerRewardID rewardID)
{
    r3d_assert(g_GameRewards);
    const CGameRewards::rwd_s& rwd = g_GameRewards->GetRewardData(rewardID);
    if(!rwd.IsSet)
    {
        LogInfo(plr->peerId_, "GetReward", "%d not set", rewardID);
        return wiStatsTracking();
    }
    
    wiStatsTracking stat;
    stat.RewardID = (int)rewardID;
    stat.GP       = 0;
    
    if(plr->loadout_->Hardcore)
    {
        stat.GD = rwd.GD_SOFT;
        stat.XP = rwd.XP_SOFT;
    }
    else
    {
        if(rwd.GD_SOFT>0)
            stat.GD = rwd.GD_SOFT + u_random(10);//Oosmar02:: GameDollars aleatoire GD_Soft + random de 10 = Final
        else
            stat.GD = rwd.GD_SOFT;
        if(rwd.XP_SOFT>0)
            stat.XP = rwd.XP_SOFT + u_random(10);//Oosmar02:: Xp aleatoire XP_Soft + random de 10 = Final
        else
            stat.XP = rwd.XP_SOFT;
    }
    
    return stat;
}

You can change :

Code:
u_random(10)
to
Code:
u_random(20)
for exemple
 
Last edited:
Joined
Sep 3, 2013
Messages
903
Reaction score
227
What what ? is just function RANDOM in all the source.

Just random function , the function is all in my server like FightZ , Training ...

i based :

Code:
nextLootboxUpdate_ = r3dGetTime() + u_GetRandom(10*60, 15*60);

'_'
 
☆Dying Dawn☆
Joined
Jan 30, 2012
Messages
971
Reaction score
727
all is good except for the credit lol
PbNCXlw - [Tutorial] XP/GD random - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Junior Spellweaver
Joined
Jun 15, 2016
Messages
139
Reaction score
37
I was literally about to post the same screen xD Code just taken and then give himself credit for Alexredds work.
 
Back
Top