Register for your free account! | Forgot your password?

You last visited: Today at 18:11

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Stamina Improvement

Discussion on Stamina Improvement within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
CriticallyDev's Avatar
 
elite*gold: 0
Join Date: May 2012
Posts: 87
Received Thanks: 4
Stamina Improvement

I did not like the way Impulse had the stamina for a player coded because it was too plain and was missing quite a lot. So I took the liberty of implementing the codes used on Albetros for stamina onto the 5165 base. And It was a success .. somewhat.

The only issue I come across is literally having to sit over and over to gain stamina after using a skill that requires stamina usage. I'm not sure what I am missing so when the character is sitting, the stamina is increasing.

Code:
#region Stamina

                    //TODO: Fly update for stamina
                    {
                        try
                        {
                            byte ToUp = 2;
                            if (client.Entity.Action == Game.Enums.ConquerAction.Sit || client.Entity.Action == Game.Enums.ConquerAction.Lie)
                            {
                                if (DateTime.Now > client.Entity.SitAt.AddMilliseconds(300))
                                {
                                    ToUp = 11;
                                    client.Entity.Stamina = (byte)Math.Min(client.Entity.Stamina + ToUp, client.Entity.MaxStamina);
                                }
                                client.Entity.SitAt = DateTime.Now;
                            }
                        }
                        catch{}
                    }
                    #endregion
CriticallyDev is offline  
Old 07/04/2013, 04:57   #2
 
elite*gold: 80
Join Date: Sep 2007
Posts: 642
Received Thanks: 168
Quote:
Originally Posted by CriticallyDev View Post
I did not like the way Impulse had the stamina for a player coded because it was too plain and was missing quite a lot. So I took the liberty of implementing the codes used on Albetros for stamina onto the 5165 base. And It was a success .. somewhat.

The only issue I come across is literally having to sit over and over to gain stamina after using a skill that requires stamina usage. I'm not sure what I am missing so when the character is sitting, the stamina is increasing.

Code:
#region Stamina

                    //TODO: Fly update for stamina
                    {
                        try
                        {
                            byte ToUp = 2;
                            if (client.Entity.Action == Game.Enums.ConquerAction.Sit || client.Entity.Action == Game.Enums.ConquerAction.Lie)
                            {
                                if (DateTime.Now > client.Entity.SitAt.AddMilliseconds(300))
                                {
                                    ToUp = 11;
                                    client.Entity.SitAt = DateTime.Now;
                                }
                            }
                             client.Entity.Stamina = (byte)Math.Min(client.Entity.Stamina + ToUp, client.Entity.MaxStamina);
                        }
                        catch{}
                    }
                    #endregion
Try this.
Santa is offline  
Thanks
1 User
Old 07/04/2013, 09:53   #3
 
×Holo's Avatar
 
elite*gold: 0
Join Date: Mar 2012
Posts: 286
Received Thanks: 71
It's all there and obvious, sorry, but I'm not actually aware of the issue you're facing..
×Holo is offline  
Old 07/04/2013, 10:28   #4
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
as SB already pointed out, you have your brackets set so that stamina is ONLY gained if you are sitting rather than the slower passive rate at which it fills.

Note: You're also doing it wrong...

SitAt was used to determine how long you have been sitting for so that you couldn't just tap the sit key and magically gain stamina faster instantly.




Code:
#region Stamina

                    //TODO: Fly update for stamina
                    {
                            byte ToUp = 2;
                            if (client.Entity.Action == Game.Enums.ConquerAction.Sit || client.Entity.Action == Game.Enums.ConquerAction.Lie)
                            
                                if (DateTime.Now > client.Entity.SitAt.AddMilliseconds(300))                                
                                    ToUp = 11;

                              client.Entity.Stamina = (byte)Math.Min(client.Entity.Stamina + ToUp, client.Entity.MaxStamina); 
                            
                    }
                    #endregion
Note: There should be no need for try catches in this either. It's simple math. You'll also want to initialize SitAt when the user logs in as well as resetting it any time their action changes to Sit or Lie

Also fly is easy to check for, just don't fill it if they have the fly flag active.
pro4never is offline  
Thanks
1 User
Old 07/04/2013, 12:52   #5
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
This is how I am doing stamina:
Code:
public void UpdateStamina(bool first)
		{
			if (Action != Enums.ActionType.Sit && !first && Action != Enums.ActionType.Lie)
				return;
			
			if (Stamina >= 100)
				return;
			
			if (Action == Enums.ActionType.Sit)
				Stamina += 10;
			else if (DateTime.Now >= LastMovement.AddMilliseconds(2000)) // lie
				Stamina += 15;
			
			ProjectX_V3_Lib.Threading.DelayedTask.StartDelayedTask(
				() => { UpdateStamina(false); }, Core.TimeIntervals.StaminaUpdate);
		}
Super Aids is offline  
Thanks
1 User
Old 07/05/2013, 02:44   #6
 
CriticallyDev's Avatar
 
elite*gold: 0
Join Date: May 2012
Posts: 87
Received Thanks: 4
@Starbucks - That method basically gives the character an infinite amount of stamina.

@Pro - The method was already being called upon when the character connects to the server.

@Super - I like the way you wrote it, I actually tried doing something similar to what you and p4n recommended but I decided to keep it as it was originally and add checks when a player is flying and such.

This is the original method for Stamina which i'm still trying to improve.
Code:
#region Stamina
                    if (DateTime.Now > client.Entity.StaminaStamp.AddMilliseconds(800))
                    {
                        if (client.Entity.Action == Game.Enums.ConquerAction.Sit || client.Entity.Action == Game.Enums.ConquerAction.Lie)
                        {
                            if (client.Entity.Stamina <= 92)
                            {
                                client.Entity.Stamina += 8;
                            }
                            else
                            {
                                client.Entity.Stamina = 100;
                            }
                        }
                        else
                        {
                            if (client.Entity.Stamina <= 95)
                            {
                                client.Entity.Stamina += 5;
                            }
                            else
                            {
                                client.Entity.Stamina = 100;
                            }
                        }
                        client.Entity.StaminaStamp = DateTime.Now;
                    #endregion
CriticallyDev is offline  
Old 07/05/2013, 03:13   #7
 
InfamousNoone's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
i don't know where the idea of "lie" came from, but the only two actions that affected stamina was kneel (although, I don't think it does anymore...) and sit.
InfamousNoone is offline  
Old 07/05/2013, 04:11   #8
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
I'm not sure what others think, but I see it as you relax and regain energy. When you sit or lie down you're relaxing.
Super Aids is offline  
Old 07/05/2013, 04:15   #9
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
Quote:
Originally Posted by InfamousNoone View Post
i don't know where the idea of "lie" came from, but the only two actions that affected stamina was kneel (although, I don't think it does anymore...) and sit.
I used lie in my old source just for fun. Had nothing to do with how conquer programmed it. Apparently it caught on at some point and people started using it.


I actually was writing stamina recharge earlier today and this is my most recent implementation.

Code:
 if (stamina < 100 && !ContainsEffect(Effect.Flying))
                {
                    byte toGain = 2;
                    if ((Action == ActionType.Sit || Action == ActionType.Lie) && Common.Clock - LastSitAt > Common.MS_PER_SECOND)
                        toGain = 7;
                    Stamina = (byte)Math.Min(100, stamina + toGain);
                }
Time in this examples is ms since server started
OnTimer runs every 1000 ms from the world thread


Very heavily (aka ripped off) from one of devs source where he was essentially re-writing binaries from scratch using C# so yahhh, works nicely though.
pro4never is offline  
Old 07/07/2013, 04:54   #10
 
shadowman123's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 1,525
Received Thanks: 230
thats the way i coded it

Code:
if (Now > client.Entity.StaminaStamp.AddSeconds(1))
{
  if (!client.Entity.ContainsFlag(Update.Flags.Fly))
  {
    byte MaxStamina = (byte)(client.Entity.HeavenBlessing > 0 ? 150 : 100);
    byte IncreaseRate = (byte)((client.Entity.Action == Enums.ConquerAction.Sit || client.Entity.Action == Enums.ConquerAction.Lie) ? 7 : 3);
    client.Entity.Stamina = (byte)Math.Min(MaxStamina, client.Entity.Stamina + IncreaseRate);
    client.Entity.StaminaStamp = Now;
  }
}
shadowman123 is offline  
Old 07/11/2013, 07:40   #11
 
CriticallyDev's Avatar
 
elite*gold: 0
Join Date: May 2012
Posts: 87
Received Thanks: 4
Post

Quote:
Originally Posted by shadowman123 View Post
thats the way i coded it

Code:
if (Now > client.Entity.StaminaStamp.AddSeconds(1))
{
  if (!client.Entity.ContainsFlag(Update.Flags.Fly))
  {
    byte MaxStamina = (byte)(client.Entity.HeavenBlessing > 0 ? 150 : 100);
    byte IncreaseRate = (byte)((client.Entity.Action == Enums.ConquerAction.Sit || client.Entity.Action == Enums.ConquerAction.Lie) ? 7 : 3);
    client.Entity.Stamina = (byte)Math.Min(MaxStamina, client.Entity.Stamina + IncreaseRate);
    client.Entity.StaminaStamp = Now;
  }
}
I actually managed to get it running at a reasonable rate(kept it the old way but with very minor adjustments). All i'm missing now is the flag checks.
CriticallyDev is offline  
Reply


Similar Threads Similar Threads
There is a program for 100 % of improvement?
11/07/2009 - General Gaming Discussion - 7 Replies
There is a program for 100 % of improvement?
Copartner improvement.
12/04/2006 - Conquer Online 2 - 2 Replies
Hmm.Any idea the co partner can improve so that when we are botting we still can type&chat in the game normally. Another question is that can any1 tell me getting moonbox from the same ghost or all different, which has the higher chance to get socket items?



All times are GMT +1. The time now is 18:12.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.