5518 source how to add cp drop help

05/07/2012 08:39 lawanko#1
can someone help me i still can't get it..no cp drop..i already edited the monster.cs and debugging done too..can someone post here the exact code with cp droprate configured already..(im doing this for 4day and still cant make it drop cp)

Code:
void DropItems(Entity killer)
       {
           if (killer is Player)
           {
               var role = (killer as Player).CP += CPVALUE;
               #region CP Award
               if (BaseMonster.Level > 3)
                   if (Level + 1 >= killer.Level && Calculations.Damage.PercentSuccess(100.0))
                   {
                       var cp = Kernel.RandomNext(1, 16);
                       if (cp > 15)
                           return;
                       role.SendMessage("SYSTEM", role.Name, "You received " + cp + " cps for killing a(n) " + BaseMonster.Name, uint.MaxValue, ChatType.System);
                       role.CP += cp;
                   }
               #endregion
05/07/2012 22:52 CriticallyDev#2
Quote:
Originally Posted by lawanko View Post
can someone help me i still can't get it..no cp drop..i already edited the monster.cs and debugging done too..can someone post here the exact code with cp droprate configured already..(im doing this for 4day and still cant make it drop cp)

Code:
void DropItems(Entity killer)
       {
           if (killer is Player)
           {
               var role = (killer as Player).CP += CPVALUE;
               #region CP Award
               if (BaseMonster.Level > 3)
                   if (Level + 1 >= killer.Level && Calculations.Damage.PercentSuccess(100.0))
                   {
                       var cp = Kernel.RandomNext(1, 16);
                       if (cp > 15)
                           return;
                       role.SendMessage("SYSTEM", role.Name, "You received " + cp + " cps for killing a(n) " + BaseMonster.Name, uint.MaxValue, ChatType.System);
                       role.CP += cp;
                   }
               #endregion
ConquerPoints are already coded on the source, they just drop depending on your character level and monsters you attack within the range of your level.
Why not just change the lines of code(which i wouldn't because it keeps the server stable as it already is) with no random chance?
05/07/2012 23:11 pro4never#3
He already changed it...

What you posted shouldn't even compile from what I see.


var role = (killer as Player).CP += CPVALUE;

Role in this case is going to be the value of CP + CPVALUE and not refer to a player. I could be wrong but looks that way to me.

As said, change it back to how it was when you downloaded the source and change the calculation as you wish.

Code:
 if (BaseMonster.Level > 3)//Only drop from mobs over level 3. no pheasant dropping cp
                   if (Level + 1 >= killer.Level && Calculations.Damage.PercentSuccess(100.0))//Only drop if monster is higher level than player... If you want it 100 percent success... just remove the damn percentSuccess check rofl!
                   {
                       var cp = Kernel.RandomNext(1, 16);//Amount to award, random 1-15
                       if (cp > 15)
                           return;
                       role.SendMessage("SYSTEM", role.Name, "You received " + cp + " cps for killing a(n) " + BaseMonster.Name, uint.MaxValue, ChatType.System);//Inform them they gained cp
                       role.CP += cp;//Add their cp
                   }
Commented it for you. Please, learn some basic C# so you understand what you're reading before you go and try to change it.
05/08/2012 07:10 lawanko#4
sorry guys =D and tnx for the help gonna try it now ty

like diz?still aint working... :( :( :(
Code:
  void DropItems(Entity killer)
       {
           if (killer is Player)
           {
               var role = (killer as Player).CP += CPVALUE;
               #region CP Award
               if (BaseMonster.Level > 3)    
                   if (Level + 1 >= killer.Level)    
                   {
                       var cp = Kernel.RandomNext(1, 16);
                       if (cp > 15)
                           return;
                       role.SendMessage("SYSTEM", role.Name, "You received " + cp + " cps for killing a(n) " + BaseMonster.Name, uint.MaxValue, ChatType.System);
                       role.CP +=1000 cp;
                   }
               #endregion
05/10/2012 04:58 lawanko#5
i finally get it into work but how can i edit it to drop 1000 CP's or more plz post the guide tnx cuz i already edit it and it gives me ramdom drop...frustrating really =(
05/10/2012 06:02 pro4never#6
go read the most basic information about programming or C# and you'll understand...

You keep posting completely incorrect codes and doing things completely wrong.

Whatever you add to your cp is what is gained... everything inside the code you're editing is to do with generating a random amount of cp (or chance to gain cp) and then add it.

If you wanted to just give the cp regardless you'd remove what's there and simply say role.CP += 1000;. Again... boils down to basic understanding of coding. That's something you're going to need to learn if you hope to do anything with pserver sources.