Register for your free account! | Forgot your password?

You last visited: Today at 06:22

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

Advertisement



A little help Please?

Discussion on A little help Please? within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
damianpesta's Avatar
 
elite*gold: 0
Join Date: Jan 2007
Posts: 1,034
Received Thanks: 58
A little help Please?

Well I got Andy's DMap's to work with LOTF , I started off with walking but It doesnt seem to work fine since I still can jump on few walls and so on...? A little help? Thats what I got so far.

Code:
                    case 1005:
                        {
                            sbyte AddX = 0;
                            sbyte AddY = 0;
                            byte Dir = (byte)(Data[8] % 8);
                            MyChar.Direction = Dir;

                            switch (Dir)
                            {
                                case 0:
                                    {
                                        AddY = 1;
                                        break;
                                    }
                                case 1:
                                    {
                                        AddX = -1;
                                        AddY = 1;
                                        break;
                                    }
                                case 2:
                                    {
                                        AddX = -1;
                                        break;
                                    }
                                case 3:
                                    {
                                        AddX = -1;
                                        AddY = -1;
                                        break;
                                    }
                                case 4:
                                    {
                                        AddY = -1;
                                        break;
                                    }
                                case 5:
                                    {
                                        AddX = 1;
                                        AddY = -1;
                                        break;
                                    }
                                case 6:
                                    {
                                        AddX = 1;
                                        break;
                                    }
                                case 7:
                                    {
                                        AddY = 1;
                                        AddX = 1;
                                        break;
                                    }
                                    int LocX = 0;
                                    int LocY = 0;
                                    Struct.GameMap DMD = new Struct.GameMap("gamemap.dat");
                                    foreach (Struct.DMap _Map in DMD.Maps)
                                    {
                                        if (!General.Maps.ContainsKey((int)_Map.MapId))
                                        {
                                            Struct.DmapData Mapping = General.Maps[(int)_Map.MapId];
                                            if (!Mapping.CheckLoc((ushort)(LocX + AddX), (ushort)(LocY + AddY)))
                                            {
                                                MyChar.LocX = MyChar.PrevX;
                                                MyChar.LocY = MyChar.PrevY;

                                            }
                                        }
                                    }
                            }
                            World.PlayerMoves(MyChar, Data);

                            MyChar.PrevX = MyChar.LocX;
                            MyChar.PrevY = MyChar.LocY;
                            MyChar.LocX = (ushort)(MyChar.LocX + AddX);
                            MyChar.LocY = (ushort)(MyChar.LocY + AddY);

                            MyChar.TargetUID = 0;
                            MyChar.MobTarget = null;
                            MyChar.PTarget = null;
                            MyChar.TGTarget = null;
                            MyChar.AtkType = 0;
                            MyChar.SkillLooping = 0;                            
                            MyChar.Action = 100;
                            World.SpawnMeToOthers(MyChar, true);
                            World.SpawnOthersToMe(MyChar, true);                            
                            World.SurroundNPCs(MyChar, true);
                            World.SurroundMobs(MyChar, true);
                            World.SurroundDroppedItems(MyChar, true);
                            MyChar.Attacking = false;
                            if (MyChar.Mining)
                                MyChar.Mining = false;

                            break;
                        }
damianpesta is offline  
Old 07/06/2009, 03:36   #2
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
This could help you idk

ReWritten walk method by EmmeTheCoder
Code:
public void Walk(byte Dir)
{
sbyte x = 0, y = 0;
if (Dir == 0 || Dir == 1 || Dir == 5 || Dir == 7)
x = 1;
if (Dir >= 1 && Dir <= 3)
x = -1;
if (Dir == 1 || Dir == 6 || Dir == 7)
y = 1;
if (Dir >= 3 && Dir <= 5)
y = -1;
X = (ushort)(X + x); Y = (ushort)(Y + y);
}

Hybrid's tip on his method

Quote:
Originally Posted by Hybrid
Fyi the *lotf* one will run faster than yours. You also forget that the client does not send a pre-modulated direction, so unless the caller mods it in the argument, you've missed this as well.

Further more you can see several what I'd assume vital things done;
his code
Code:
// notify other people to move? your function fails to do this
World.PlayerMoves(MyChar, Data);

// update the old location, your function fails to do this
MyChar.PrevX = MyChar.LocX;
MyChar.PrevY = MyChar.LocY;

// update the current location, your function *does* do this
MyChar.LocX = (ushort)(MyChar.LocX + AddX);
MyChar.LocY = (ushort)(MyChar.LocY + AddY);
funny thing the original walk method has that what hybrid said his doesnt.

PeTe Ninja is offline  
Old 07/06/2009, 03:51   #3
 
damianpesta's Avatar
 
elite*gold: 0
Join Date: Jan 2007
Posts: 1,034
Received Thanks: 58
Quote:
Originally Posted by PeTe Ninja View Post
This could help you idk

ReWritten walk method by EmmeTheCoder
Code:
public void Walk(byte Dir)
{
sbyte x = 0, y = 0;
if (Dir == 0 || Dir == 1 || Dir == 5 || Dir == 7)
x = 1;
if (Dir >= 1 && Dir <= 3)
x = -1;
if (Dir == 1 || Dir == 6 || Dir == 7)
y = 1;
if (Dir >= 3 && Dir <= 5)
y = -1;
X = (ushort)(X + x); Y = (ushort)(Y + y);
}

Hybrid's tip on his method



his code
Code:
// notify other people to move? your function fails to do this
World.PlayerMoves(MyChar, Data);

// update the old location, your function fails to do this
MyChar.PrevX = MyChar.LocX;
MyChar.PrevY = MyChar.LocY;

// update the current location, your function *does* do this
MyChar.LocX = (ushort)(MyChar.LocX + AddX);
MyChar.LocY = (ushort)(MyChar.LocY + AddY);
funny thing the original walk method has that what hybrid said his doesnt.


Well it wont help cause its up to the DMap's Im waiting for someone experienced now to tell me what is wrong cause im not getting any errors, nor warnings
damianpesta is offline  
Old 07/06/2009, 04:00   #4
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
Oh ok, well dont know if this also helps but check out

Code:
public static void PlayerMoves(Character MovingChar, byte[] Data)
in world.cs
PeTe Ninja is offline  
Old 07/06/2009, 15:32   #5
 
damianpesta's Avatar
 
elite*gold: 0
Join Date: Jan 2007
Posts: 1,034
Received Thanks: 58
Quote:
Originally Posted by PeTe Ninja View Post
Oh ok, well dont know if this also helps but check out

Code:
public static void PlayerMoves(Character MovingChar, byte[] Data)
in world.cs
Well I know that the DMap part has to be there , I think I just ****** up DMaps part.
damianpesta is offline  
Old 07/06/2009, 17:06   #6
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,162
Is the maps you can still jump on walls etc have their MapID added in GameMaps.Maps?
_Emme_ is offline  
Old 07/06/2009, 18:06   #7
 
damianpesta's Avatar
 
elite*gold: 0
Join Date: Jan 2007
Posts: 1,034
Received Thanks: 58
Quote:
Originally Posted by EmmeTheCoder View Post
Is the maps you can still jump on walls etc have their MapID added in GameMaps.Maps?
Yeah , I've got the main ones loaded , like twin city , am and so on
damianpesta is offline  
Old 07/06/2009, 18:57   #8
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,162
Well, what I meant was, is DMaps loaded in the map you could still jump walls on?
_Emme_ is offline  
Old 07/06/2009, 19:19   #9
 
damianpesta's Avatar
 
elite*gold: 0
Join Date: Jan 2007
Posts: 1,034
Received Thanks: 58
Quote:
Originally Posted by EmmeTheCoder View Post
Well, what I meant was, is DMaps loaded in the map you could still jump walls on?
Yep , may I just add you Cause Im having issues with something else as well?

Well the second problem is that I messed up some packet , because I got Hybrid's NPC's (INI ones) to work with my LOTF Source and they all loading fine and It says that they are spawned , im not getting any errors on it.So I bet that I didnt get the NPC's Spawn Packet to work.Any help?

#Bump , bump , bump!!

Bump!!! Is there nobody that is actually willing to help?

#Bump!!

#merged
damianpesta is offline  
Old 07/07/2009, 20:00   #10
 
danielachraf's Avatar
 
elite*gold: 20
Join Date: Mar 2008
Posts: 958
Received Thanks: 494
3rd bump for a little help ?? oh my bad
danielachraf is offline  
Old 07/07/2009, 22:11   #11
 
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
My opinion:

WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOW!

Dude, was you drunk when you wrote this thing?

It should be like:

Struct.DmapData Mapping = null;
if(General.Maps.TryGetValue(MyChar.LocMap, out Mapping))
{
if (!Mapping.CheckLoc((ushort)(LocX + AddX), (ushort)(LocY + AddY)))
{
MyChar.LocX = MyChar.PrevX;
MyChar.LocY = MyChar.PrevY;
}
else
{ /*Pullback*/}
}
alexbigfoot is offline  
Reply




All times are GMT +1. The time now is 06:22.


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.