[RELEASE]MAKE SCROLLS WORK CoEmuV2

06/16/2009 01:15 CIRASH#16
Well, i don't know how to code. I learn by reading the code presented and altering to the things i want. Maybe, one day, ill actually learn real coding but for now this suits me just fine.
06/24/2009 22:09 0105653642#17
guys i know what i will say make u all be mad but how i add this code can some explane it to me sorry
07/02/2009 08:56 samehvan#18
Quote:
Originally Posted by scottdavey View Post
Yeah i know, i'm coding at 3am and i forgot to reload the debug. My fault lol.

Rewritten most npcs and made market/tg save your previous map, probably gonna be lots of typos atm i can barely see lol.
i think u dont need to rewrite any NPCs to do it , u may simply add a new variable to the character named PrevMap containing the current map be4 teleporting to Market or TG then when asking to leave them u retrieve that prevmap , it would also be better if u create a new func retrieving the coords and call it by that prevmap it will also be usefull to call a rev point when asking for revive

i will try to give a sample for it

if u gonna put it at NpcTalk.cs

Code:
private static int[] GetCords(int Map_)
        {
            int []MapCoords=new int[2];
            switch (Map_)
            {
                case 1002:
                    {
                        MapCoords[0] = 438; MapCoords[1] = 377;
                        break;
                    }
                case 1011:
                    {
                        MapCoords[0] = 232; MapCoords[1] = 260;
                        break;
                    }
                case 1020:
                    {
                        MapCoords[0] = 565; MapCoords[1] = 565;
                        break;
                    }
                case 1000:
                    {
                        MapCoords[0] = 496; MapCoords[1] = 649;
                        break;
                    }
                case 1015:
                    {
                        MapCoords[0] = 723; MapCoords[1] = 573;
                        break;
                    }
            }
            return MapCoords;
        }
then when u ask any teleporter to get u to Market or TG add this be4 the teleport line

Code:
CSocket.Client.PrevMap = Convert.ToInt32(CSocket.Client.Map);
for example

Code:
else if (LinkBack == 2)//Market
                        {
                            CSocket.Client.PrevMap = Convert.ToInt32(CSocket.Client.Map);
                            Teleport(1036, 211, 196, 0, CSocket);
                        }
then at the Market/Tg controller section put this

Code:
else if (LinkBack == 1)
                        {
                            int Map_ = CSocket.Client.PrevMap;
                            int[] Coords = GetCords(Map_);
                            Teleport(Map_, Coords[0], Coords[1], 0, CSocket);
                        }
hehe , that was a complete code for it , anyhow u will also need to add this to be a real complete code

at Character.cs

Code:
public int PrevMap = 1002;
now u have a complete restore previous map code :p
07/02/2009 09:12 yagnesh_shenoy#19
thxs i try this now
07/02/2009 09:42 pro4never#20
Quote:
Originally Posted by unknownone View Post
Use a goddamn database. Have you not all noticed that you are practically repeating the same code 15 times and making it impossible to edit points add new points without recompiling. lrn2code.

Code:
ScrollPoint sp = Select().From("scroll_points").Where(Equals("scoll_id", MyItem));
Handler.Teleport(sp.Map, sp.X, sp.Y, CSocket);
Thanks alot... I was just about to go to bed and then I decided to code a random scroll system instead...

I haven't tested it yet but it's implemented into my source now w/o errors so hopefully it will work once I add some locations to database.

What I have it doing is random scrolls will read the map you are on, load random locations from the database for that map, pick a random number (number of locations on that map setup) and teleport you to that location. That way it randomly sends you to a spot on your current map.

Dunno if I'll ever actually code all the item side of it but for now the source/database part is done. Thanks for depriving me of yet more sleep.
11/11/2009 16:36 martoon#21
Quote:
case 1060020: //TC Scroll
{
if ((int)CSocket.Client.Map == 9999) //Jail Map ID
{
CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You are jailed! You can't go out." + Item.ItemID, Struct.ChatType.Top));
}
else
{
Handler.Teleport(1002, 430, 378, 0, CSocket);
Delete = true;
CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "Teleported to Twin City." + Item.ItemID, Struct.ChatType.Top));
}
break;
}
This is mine ;)