Auto CP in Albetros Source 5517

03/08/2012 13:07 Drake68#1
Okay so im alittle confused...I tryed changing so many settings and yet have to find the right one i cant seem to get the monsters to give cps. I went into monster.cs and i thought i found it but what i did there didnt work ether if anyone can help me id appreciate it. Im not asking to give me the answer im asking to help me point me in the right direction.
03/08/2012 14:00 somecode#2
find monster.cs

find DropItems(Entity killer) Method
and write (killer as Player).CP += CPVALUE;
03/08/2012 14:40 Drake68#3
Okay i made it look like this still isnt working...
Code:
       void DropItems(Entity killer)
       {
           if (killer is Player)
           {
               var role = (killer as Player).CP += CPVALUE;
               #region CP Award
               if (BaseMonster.Level / 3 > 0)
                   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 += (uint)(cp);
                   }
               #endregion
03/08/2012 15:27 somecode#4
PHP Code:

     void DropItems
(Entity killer)
       {
           if (
killer is Player)
           {
               var 
role = (killer as Player)
               
#region CP Award
               
if (BaseMonster.Level 0)    // and this can remove... or BaseMonster.Level > 3
                   
if (Level >= killer.Level)    //if you must be give...didn't add percentsuccess method
                   
{
                       var 
cp Kernel.RandomNext(116);
                       if (
cp 15)
                           return;
                       
role.SendMessage("SYSTEM"role.Name"You received " cp " cps for killing a(n) " BaseMonster.Nameuint.MaxValueChatType.System);
                       
role.CP += (uint)(cp);
                   }
               
#endregion 
if still not work .... please debug your project
03/08/2012 15:58 Drake68#5
Okay it pissing me of iv tryed to debug and it just hates me lol you have team viewer mabe you can try and see what im missing
03/08/2012 22:32 turk55#6
you didnt add a part where there is a actual code of cps, so you basically link it to the randomnext.

try this
Quote:

void DropItems(Entity killer)
{
if (killer is Player)
{
var role = (killer as Player);
#region CP Award
if (BaseMonster.Level / 3 > 0)
if (Level + 1 >= killer.Level && Calculations.Damage.PercentSuccess(100.0))
{
pluscps = 20; // the amount of cps you want
var cp = Kernel.RandomNext(1, 16);
if (cp > 15)
return;
role.SendMessage("SYSTEM", role.Name, "You received " + pluscps + " cps for killing a(n) " + BaseMonster.Name, uint.MaxValue, ChatType.System);
role.CP += pluscps;
}
#endregion
03/08/2012 22:56 Drake68#7
still isnt giving the cps ):
03/08/2012 23:36 pro4never#8
You said you can't debug..

If you don't debug none of the changes you make will take effect. What is it saying when you try? What is giving an error?

Try breakpointing it to see if the code is ever run, etc.

Basic debugging/programming knowledge is REQUIRED to run a server. If you do not have those skills I suggest taking some time and learning them.
03/09/2012 00:08 Drake68#9
Well im still learning on the debug part its the fact of just having to do it on my own i have yet to find a guide for the basic's on co.

All i need is for someone to show me the right way to debug it and im good to go iv got the basics down.
03/09/2012 01:03 funhacker#10
Try this, it's using a lot of assumptions based on your own code you placed in. But the way you declared your "var" seems incorrect, again I can't be sure because I've not seen your code.
But either to prevent such things occurring you should stick with just casting rather than vars in my opinion they don't belong in C# being such a class/object driven class.

Code:
void DropItems(Entity killer)
{
   if(killer is Player)
   {
      Player role;
      uint cp;

      role = (Player)killer;

      if(Level > 3)
      {
          if(Level + 1 >= role.Level)
          {
             cp = Kernel.RandomNext(1,16);
             role.SendMessage("SYSTEM", role.Name, "You received " + cp.ToString() + " cps for killing a(n) " + Name, uint.MaxValue, ChatType.System);
             role.CP += cp;
          }
      }
   }
}
03/09/2012 01:23 Drake68#11
funhacker would you mind getting on team viewer? see where im messing up at?

msn: [Only registered and activated users can see links. Click Here To Register...]
03/09/2012 02:17 corbit15#12
you need to remove the checks for the players level and the one about the base level.
03/09/2012 02:21 Drake68#13
You mind getting on team viewer and giving a hand see whats going on?
03/10/2012 05:39 corbit15#14
sorry but no. it's not hard look at the code. i got it working in like 3 seconds. remove the checks and it will work
03/10/2012 06:51 Drake68#15
Thanks i got it working (:

#close