|
You last visited: Today at 16:25
Advertisement
[Help Request] Saving a Custom System (5165)
Discussion on [Help Request] Saving a Custom System (5165) within the CO2 Private Server forum part of the Conquer Online 2 category.
03/07/2010, 20:19
|
#1
|
elite*gold: 0
Join Date: Feb 2010
Posts: 378
Received Thanks: 86
|
[Help Request] Saving a Custom System (5165)
Hey you guys, I need help. =\
I know that sounds lame but it's really hard for me and I've been trying for days.
My goal is to save a variable M and D to a character file in a folder called "example" (Like the Flower System's save system).
This is what I have for the System's cs (located in Features called Example.cs):
Code:
[COLOR="Blue"]using[/COLOR] System;
[COLOR="Blue"]using[/COLOR] System.Collections.Generic;
[COLOR="Blue"]using[/COLOR] System.Text;
[COLOR="Blue"]namespace[/COLOR] NewestCOServer
{
[COLOR="Blue"]public partial class[/COLOR] [COLOR="Teal"]Struct[/COLOR]
{
[COLOR="Blue"]public class[/COLOR] [COLOR="Teal"]Example[/COLOR]
{
[COLOR="Blue"]public int[/COLOR] D;
[COLOR="Blue"]public int[/COLOR] M;
[COLOR="Blue"]public int[/COLOR] CanGetX;
}
}
}
CanGetX is referring to being able to obtain an item.
Then, I have this is the database:
Code:
[COLOR="Blue"]public static void[/COLOR] LoadExample([COLOR="Blue"]string[/COLOR] name)
{
[COLOR="Blue"]if [/COLOR]([COLOR="Teal"]File[/COLOR].Exists([COLOR="DarkRed"]@"C:\OldCODB\Example\"[/COLOR] + name + [COLOR="DarkRed"]".chr"[/COLOR]))
{
[COLOR="Teal"]FileStream[/COLOR] fs = [COLOR="Blue"]new[/COLOR] [COLOR="Teal"]FileStream[/COLOR]([COLOR="DarkRed"]@"C:\OldCODB\Example\"[/COLOR] + name + [COLOR="DarkRed"]".chr"[/COLOR], [COLOR="Teal"]FileMode[/COLOR].Open);
[COLOR="Teal"]BinaryReader[/COLOR] br = [COLOR="Blue"]new[/COLOR] [COLOR="Teal"]BinaryReader[/COLOR](fs);
[COLOR="Blue"]try[/COLOR]
{
Game.[COLOR="Teal"]Character[/COLOR] CC = [COLOR="Teal"]World[/COLOR].CharacterFromName(name);
CC.Example.M = br.ReadInt32();
CC.Example.D = br.ReadInt32();
CC.Example.CanGetX = br.ReadInt32();
fs.Flush();
br.Close();
fs.Close();
}
[COLOR="Blue"]catch[/COLOR] ([COLOR="Teal"]Exception[/COLOR] e) { [COLOR="Teal"]Console[/COLOR].WriteLine(e); }
}
}
[COLOR="Blue"]public static void[/COLOR] SaveExample([COLOR="Blue"]string[/COLOR] name)
{
[COLOR="Blue"]if [/COLOR]([COLOR="Teal"]File[/COLOR].Exists([COLOR="DarkRed"]@"C:\OldCODB\Example\"[/COLOR] + name + [COLOR="DarkRed"]".chr"[/COLOR]))
{
[COLOR="Teal"]FileStream[/COLOR] fs = [COLOR="Blue"]new[/COLOR] [COLOR="Teal"]FileStream[/COLOR]([COLOR="DarkRed"]@"C:\OldCODB\Example\"[/COLOR] + name + [COLOR="DarkRed"]".chr"[/COLOR], [COLOR="Teal"]FileMode[/COLOR].Open);
[COLOR="Teal"]BinaryReader[/COLOR] br = [COLOR="Blue"]new[/COLOR] [COLOR="Teal"]BinaryReader[/COLOR](fs);
[COLOR="Blue"]try[/COLOR]
{
Game.[COLOR="Teal"]Character[/COLOR] CC = [COLOR="Teal"]World[/COLOR].CharacterFromName(name);
bw.Write(CC.Example.M);
bw.Write(CC.Example.D);
bw.Write(CC.Example.CanGetX);
bw.Flush();
fs.Flush();
bw.Close();
fs.Close();
}
[COLOR="Blue"]catch[/COLOR] ([COLOR="Teal"]Exception[/COLOR] e) { [COLOR="Teal"]Console[/COLOR].WriteLine(e); }
}
}
Then I have it so that the player can go up to an NPC and set D and M.
When the character types something in as D or M, it sets it temporarily as:
GC.MyChar.Example.D = (number);
The problem is, I don't know how it will save it. 
Please help =\
|
|
|
03/07/2010, 20:25
|
#2
|
elite*gold: 20
Join Date: Dec 2006
Posts: 945
Received Thanks: 175
|
Well this isnt really a big deal but
Console.Writeline(e.ToString());
At least thats how i do it
|
|
|
03/07/2010, 20:26
|
#3
|
elite*gold: 0
Join Date: Nov 2009
Posts: 322
Received Thanks: 63
|
im confused, you want to write Two variables to a file, And then read the line and get the two words from the line ?
|
|
|
03/07/2010, 20:28
|
#4
|
elite*gold: 0
Join Date: Feb 2010
Posts: 378
Received Thanks: 86
|
Quote:
Originally Posted by hunterman01
Well this isnt really a big deal but
Console.Writeline(e.ToString());
At least thats how i do it
|
What does that do? I mean, how would i implement that into the NPC?
Quote:
Originally Posted by xScott
im confused, you want to write Two variables to a file, And then read the line and get the two words from the line ?
|
I want it to save 2 numbers, one to M and one to D from the NPC.
|
|
|
03/07/2010, 20:39
|
#5
|
elite*gold: 20
Join Date: Dec 2006
Posts: 945
Received Thanks: 175
|
Quote:
Originally Posted by -NewDawn-
What does that do? I mean, how would i implement that into the NPC?
I want it to save 2 numbers, one to M and one to D from the NPC.
|
Your pretty much doing the same thing it's just i like my way better
|
|
|
03/07/2010, 21:37
|
#6
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
What youve written for the save method is correct, whats your problem?
|
|
|
03/07/2010, 23:09
|
#7
|
elite*gold: 0
Join Date: Feb 2010
Posts: 378
Received Thanks: 86
|
Quote:
Originally Posted by Korvacs
What youve written for the save method is correct, whats your problem?
|
I don't know how to access it. I want it so if you say M = 13 using an NPC in Twin City, i want it to save... but when It sets GC.MyChar.Example.M = 13; it goes away after a d/c or log off. It doesn't save to the Example folder in OldCODB.
|
|
|
03/07/2010, 23:16
|
#8
|
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
|
Quote:
Originally Posted by -NewDawn-
I don't know how to access it. I want it so if you say M = 13 using an NPC in Twin City, i want it to save... but when It sets GC.MyChar.Example.M = 13; it goes away after a d/c or log off. It doesn't save to the Example folder in OldCODB.
|
Make it save, in the character look at the ExpBallUsed per day bool or w,e it is, save it how that is been saved or the lottery used per day
|
|
|
03/07/2010, 23:24
|
#9
|
elite*gold: 0
Join Date: Feb 2010
Posts: 378
Received Thanks: 86
|
Quote:
Originally Posted by -Shunsui-
Make it save, in the character look at the ExpBallUsed per day bool or w,e it is, save it how that is been saved or the lottery used per day
|
So...
BW.Write(C.ExpBallsUsedToday);
So... I'd say something like:
BW.Write(C.Example.M);
in NPCDialog...
C being defined as:
Game.Character C = new NewestCOServer.Game.Character();
Is that right?
EDIT: Still doesn't work... nothing is in the Example Folder...
|
|
|
03/08/2010, 03:02
|
#10
|
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
|
You don't have a method to even create the file "example.chr" or whatever this is, and this is straight from my flowers save =o
|
|
|
03/08/2010, 03:12
|
#11
|
elite*gold: 0
Join Date: Mar 2010
Posts: 133
Received Thanks: 22
|
whats with the e.tostring?
why not e.message?
|
|
|
 |
Similar Threads
|
GF custom system
08/27/2010 - Lin2 Exploits, Hacks, Bots, Tools & Macros - 0 Replies
This Package contains:
Fire.dll & unichat.dll = Enable unicode characters in chat
User.ini = enable infinite zoom, with middle mouse button you can see trough walls
L2.ini = pc names are visible from triple distance, enable windowed mode without frame (you can switch between clients with Alt+Tab).
Install:
1. Close your Lineage II client
2. Backup your system folder, and copy the selected files into it and overwrite all.
3. Enjoy :)
|
Saving things on 5165
02/15/2010 - CO2 Private Server - 14 Replies
Where can I add this in my 5165 source? (what it does is it saves everything every 60 seconds and on the console it says "Game Saved Automatically")
Thread.Sleep(60 * 1000);
Database.SaveKOs();
Database.SaveEmpire();
Features.Guilds.SaveGuilds();
Features.SkillsClass.Save();
Console.WriteLine("Game Saved automatically.");
|
[HELP] Custom Items in 5165
12/16/2009 - CO2 Private Server - 7 Replies
Hi I'm sorta new to the coding business and I'm adding new items to my server I was just wondering if i have to change anything in my source or just add the item to my client. BTW using a 5165 source and ive been searching for like half the day and havnt found anything usefull plz help
Thx in advance :handsdown:
|
REQUEST Custom system folder for interlude!
03/26/2009 - Lineage 2 - 1 Replies
Hey i want the pack were i can see moob lvl, diference between chest/box, color messages, the moob drop/spoil.. ETC! can someone help me to find it? INTERLUDE plz
|
[Release] Custom Dye System Edits
10/12/2008 - EO PServer Guides & Releases - 3 Replies
http://img.photobucket.com/albums/v126/saintkatzen /clothes.jpg
These are some custom edits I made for funhacker's Dye System.
Place them in your c3/texture folder.
However, I suggest you backup these files and/or folder before you overwrite, lest you not favor the turnout.
Most of the casuals are edited, except for Manderine, SummerHunter, and the ones that were not included in the Dye System initially.
These edits were made for RagelandersOnline, but I have released them here now,...
|
All times are GMT +1. The time now is 16:28.
|
|