Register for your free account! | Forgot your password?

Go Back   elitepvpers › MMORPGs › Conquer Online 2 › CO2 Private Server
You last visited: Today at 23:43

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

Advertisement



Opinions on luckytime

Discussion on Opinions on luckytime within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #16


 
CptSky's Avatar
 
elite*gold: 0
Join Date: Jan 2008
Posts: 1,449
Received Thanks: 1,184
As most servers already store the accessibility as a boolean, just change it as a bitfield in a 8 bits integer, and bam, you have access to 7 new flags without increasing the memory pressure. The bit field comparison operations will be negligible.

Thinking of it, it's clearly the best solution to have a flag.
CptSky is offline  
Thanks
1 User
Old   #17
 
InsomniacPro's Avatar
 
elite*gold: 0
Join Date: Feb 2014
Posts: 397
Received Thanks: 205
Flagging tiles is the way I decided to go, working wonderfully without any issues whatsoever.
InsomniacPro is offline  
Old   #18
 
{ Angelius }'s Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
Quote:
Originally Posted by InsomniacPro View Post
So, I would like some opinions on how I should handle luckytime.
For example, I can either enumerate through players within a screen, and check for distance and check for llucky time. If a player is within range for luckytime, they start luckabsorb.

Now option B tht I have. When a player starts luckytime, its in a 7x7 grid. Now the tiles within that 7x7 grid, get an attribute declaring them luckytime tiles, a blessed tile if you will. When player is standing still on a blessed tile, they start gaining luckytime.

Which of these would be the smarter more efficient route. Or if you have another, better way, I would love to hear.

Code:
int base_X = 10, base_Y = 10;

int lowerX= base_X - 3, lowerY= base_Y - 3;// Lowest possible coordinate value.

for (int x = lowerX; i < lowerX + 6; x++)//Enumerate through all possible X values.
{
    for (int y = lowerY; j < lowerY + 6; y++)//Enumerating through all possible Y values.
    {
         map.SetBlessedTile(x, y);
    }
}
So if i am casting luckytime and a player decides to walk right up to me to pray, You are gonna loop 36 times and call map.IsBlessed(x,y) each block that player walks just to check if i am casting luckytime? I think its a stupid idea and i don't blame you.. I blame the first responders...

That ^ is a waste of time and resources.

You are over complicating things here...
Quote:
class Hero
{
public bool CastingLuckytime;// = false
public Dictionary<int, Hero> or List<Hero> LuckyTimeLeechers;
}
Assume that Hero A is standing at 10X 10Y.
Hero A casts the Luckytime spell and goes afk... His mother she's been yelling at him to go to bed for hours or something....
Hero B jumps into Hero A screen.
Here you are gonna have to spawn Hero A to B and B to A so they can see each other.

if (A.CastingLuckytime && B.CastingLuckytime)
do nothing
if(A.CastingLuckytime && !B.CastingLuckytime)
A.LuckyTimeLeechers.Add(B);
if(!A.CastingLuckytime && B.CastingLuckytime)
B.LuckyTimeLeechers.Add(A);

LuckyTimeLeechers will be your reference later on because you are gonna have to Add/Remove status flags from not only the Hero that is casting Luckytime but from the Luckytime Leechers as will since they cant keep the Praying flag once they/the caster move(s).


Good luck.. I only had like 4 min to spare so please excuse my sloppy reply.

@Everyone else
I am sorry but i couldn't leave the house before i say... Why the fuck would you need to LOOP through lists or whatever the heck you guys are talking about for such a simple feature... You are spawning players to each other with or without checking for luckytime casters so why not take advantage of that...
{ Angelius } is offline  
Old   #19
 
InsomniacPro's Avatar
 
elite*gold: 0
Join Date: Feb 2014
Posts: 397
Received Thanks: 205
Quote:
Originally Posted by { Angelius } View Post
Code:
int base_X = 10, base_Y = 10;

int lowerX= base_X - 3, lowerY= base_Y - 3;// Lowest possible coordinate value.

for (int x = lowerX; i < lowerX + 6; x++)//Enumerate through all possible X values.
{
    for (int y = lowerY; j < lowerY + 6; y++)//Enumerating through all possible Y values.
    {
         map.SetBlessedTile(x, y);
    }
}
So if i am casting luckytime and a player decides to walk right up to me to pray, You are gonna loop 36 times and call map.IsBlessed(x,y) each block that player walks just to check if i am casting luckytime? I think its a stupid idea and i don't blame you.. I blame the first responders...

That ^ is a waste of time and resources.

You are over complicating things here...
You are over complicating things

public bool BlessedTile(ushort x, ushort y)
{
return (Tile[x,y].Flags & TileFlags.Blessed) == TileFlags.Blessed;
}
InsomniacPro is offline  
Old   #20
 
{ Angelius }'s Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
Quote:
Originally Posted by InsomniacPro View Post
You are over complicating things

public bool BlessedTile(ushort x, ushort y)
{
return (Tile[x,y].Flags & TileFlags.Blessed) == TileFlags.Blessed;
}
That's what i get for helping idiots... What a waste of time.
{ Angelius } is offline  
Old   #21
 
InsomniacPro's Avatar
 
elite*gold: 0
Join Date: Feb 2014
Posts: 397
Received Thanks: 205
Quote:
Originally Posted by { Angelius } View Post
That's what i get for helping idiots... What a waste of time.
Idiots? This is a very good way to handle luckytime, which uses less time/resources than enumerating through clients within the screen.

You were making it sound like players are enumerating through tiles just to check if they can pray. Which no, it's a simple check on 1 tile.

So tell me Mr. ProfessionalCoder, what takes more work to do. Enumerating through clients within a screen, or doing an if check?
InsomniacPro is offline  
Old   #22


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,519
Quote:
Originally Posted by { Angelius } View Post
That's what i get for helping idiots... What a waste of time.
If you don't understand why looping once to set the flag and then checking for the flag (which you should be doing anyway) is better than looping and doing a distance check every single time an entity moves, then I guess there's no helping you.
Korvacs is offline  
Old   #23


 
KraHen's Avatar
 
elite*gold: 0
Join Date: Jul 2006
Posts: 2,216
Received Thanks: 794
Quote:
Originally Posted by InsomniacPro View Post
You are over complicating things

public bool BlessedTile(ushort x, ushort y)
{
return (Tile[x,y].Flags & TileFlags.Blessed) == TileFlags.Blessed;
}
He was showing you how to set it up, not the check.

@Fang : Yes, I do realize that, but you can`t do it without comparisions anyways, and you can simplify most of them with bit operations as well (something like a Karnaugh map - actually not but that`s the closest example I could come up with right now).
KraHen is offline  
Old   #24
 
InsomniacPro's Avatar
 
elite*gold: 0
Join Date: Feb 2014
Posts: 397
Received Thanks: 205
Quote:
Originally Posted by KraHen View Post
He was showing you how to set it up, not the check.

@Fang : Yes, I do realize that, but you can`t do it without comparisions anyways, and you can simplify most of them with bit operations as well (something like a Karnaugh map - actually not but that`s the closest example I could come up with right now).
He was under the impression that I would be looping for a simple check. I was correcting him and telling him why he was wrong.
InsomniacPro is offline  
Old   #25
 
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
Quote:
Originally Posted by InsomniacPro View Post
You are over complicating things

public bool BlessedTile(ushort x, ushort y)
{
return (Tile[x,y].Flags & TileFlags.Blessed) == TileFlags.Blessed;
}
This would work fine if you do it correctly like:
When one uses lucky time you do a circle around him and put the flag Blessed.
When one moves around or just stands, check every 5 seconds (or less) if one is standing on a blessed tile.

That way you do not waste resources. You don't have to check the area around you, just the tile you are sitting on.

Even like this there is still an issue. Collisions. If two players are close to each other and both use lucky time, when one leaves, you will have to mark the area not blessed which might cut from the other's blessed area. In this case you'll have to go through your screen's players and remake all the tiles.
-impulse- is offline  
Old   #26
 
elite*gold: 0
Join Date: May 2011
Posts: 648
Received Thanks: 413
With flags the error checking seems to be harder: Imagine 3 players on the screen.
A B and C.

A casts luckytime, sets the tile flags to "StartPraying" or whatever, player B jumps in, Tilecheck returns StartPraying, so he does. Now C jumps in and activates luckytime, wich again sets the flag "StartPraying" but this time, C also jumps out of the screen imediatelly. Now, since Flags are static, the tiles will not have the flag "StartPraying" and once a new player (D) jumps into the screen, he wont be able to receive luckytime.
Y u k i is offline  
Old   #27


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,519
Quote:
Originally Posted by Y u k i View Post
With flags the error checking seems to be harder: Imagine 3 players on the screen.
A B and C.

A casts luckytime, sets the tile flags to "StartPraying" or whatever, player B jumps in, Tilecheck returns StartPraying, so he does. Now C jumps in and activates luckytime, wich again sets the flag "StartPraying" but this time, C also jumps out of the screen imediatelly. Now, since Flags are static, the tiles will not have the flag "StartPraying" and once a new player (D) jumps into the screen, he wont be able to receive luckytime.
On removal of the flag you can just do a check to see if the flag should remain or not, problem solved.
Korvacs is offline  
Old   #28
 
InsomniacPro's Avatar
 
elite*gold: 0
Join Date: Feb 2014
Posts: 397
Received Thanks: 205
Quote:
Originally Posted by -impulse- View Post
This would work fine if you do it correctly like:
When one uses lucky time you do a circle around him and put the flag Blessed.
When one moves around or just stands, check every 5 seconds (or less) if one is standing on a blessed tile.

That way you do not waste resources. You don't have to check the area around you, just the tile you are sitting on.

Even like this there is still an issue. Collisions. If two players are close to each other and both use lucky time, when one leaves, you will have to mark the area not blessed which might cut from the other's blessed area. In this case you'll have to go through your screen's players and remake all the tiles.
I have it checking every 1500 ms if a player is standing on a blessed tile.
And regarding the collision:

Quote:
Originally Posted by Korvacs View Post
On removal of the flag you can just do a check to see if the flag should remain or not, problem solved.
Is exactly what I'm doing.
InsomniacPro is offline  
Old   #29
 
{ Angelius }'s Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
Quote:
Originally Posted by InsomniacPro View Post
I have it checking every 1500 ms if a player is standing on a blessed tile.
And regarding the collision:
Is exactly what I'm doing.
Checking a collection that will hardly contain 10 references every X ms removing any reference that is > X distance and removing its pray status flag. awarding all whats left in that collection with whatever you like. updating the luckytime onscreen timer for each reference. all at the same time.

Bad stuff yeah?
{ Angelius } is offline  
Old   #30
 
InsomniacPro's Avatar
 
elite*gold: 0
Join Date: Feb 2014
Posts: 397
Received Thanks: 205
So I'm still waiting for you to tell me how using a dictionary, which you'd have to enumerate through, is more efficient and smarter than making a tile as blessed, then doing a simple if check.

Quote:
Originally Posted by { Angelius } View Post


Checking a collection that will hardly contain 10 references every X ms removing any reference that is > X distance and removing its pray status flag. awarding all whats left in that collection with whatever you like. updating the luckytime onscreen timer for each reference. all at the same time.

Bad stuff yeah?
Sure, you'd only enumerate about 10 entities within the collection probably. And then do whatever needs be with each entry. But still, what is faster? Enumerating through a collection of the prayer, or doing ONE IF CHECK on a single tile in a timed manner. Plz.
InsomniacPro is offline  
Reply


Similar Threads Similar Threads
[LuckyTime]FireFlow
04/10/2010 - CO2 Weapon, Armor, Effects & Interface edits - 14 Replies
heya here a nice luckytime edit, press thanks if u like it^^ http://zoconquer.synthasite.com/resources/fireflo w1.JPG download here
[help]luckytime
09/29/2009 - CO2 Private Server - 2 Replies
hi does anyone have a guide/release how to add the skill bless (luckytime) into a 5017 source like mine (Powerco Source) ty
luckytime
09/22/2009 - CO2 Private Server - 0 Replies
case 9876: { #region LuckyTime Dictionary<int, int> Targets = new Dictionary<int, int>(); Targets.Add(CSocket.Client.ID, 0); CSocket.Client.LuckyTiming = DateTime.Now; ConquerPacket.ToLocal(ConquerPacket.MagicAttack(CS ocket.Client.ID, Spell.ID, 0, Targets, CSocket.Client.X, CSocket.Client.Y), CSocket.Client.X, CSocket.Client.Y,...
LuckyTime Bug!
01/27/2007 - Conquer Online 2 - 4 Replies
Hey you guys MAY you know the luckytime bug if the owner of luckytime casts it and 3 ppl sit on him (stackin) the first 2 on him will still get luckytime.. BUTTTTTT theres another bug .. you can cast luckytime in TG just use luckytime and press fastly sit (hotkey it) YOU can make lvl 80- fire taos stop attacking stakes^^ i did it many times buhaha enemy guilds ;D (YOU CAN ONLY MAKE EM STOP IF THEY GOT LVL 2- FIRECIRCLE AND USIN IT) enjoy~~ (i jus wanna share with u guys ok^^?)



All times are GMT +1. The time now is 23:43.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

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