Register for your free account! | Forgot your password?

Go Back   elitepvpers > Conquer Online 2 > CO2 PServer - Discussions / Questions
You last visited: Today at 16:47

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

 

[Request] How to make a wishes tree

Reply
 
Old   #16
 
elite*gold: 0
Join Date: May 2010
Posts: 630
Received Thanks: 130
Code:
bool someEventIsTriggered = true;
if (someEventIsTriggered)
       {
	foreach(Game.Character Char in Game.World.H_Chars)
{
	Char.MyClient.DialogNPC = 666111;
	PacketHandling.NPCDialog.Handle(Char.MyClient, null, 666111, 0);
	Char.MyClient.EndSend();
	}
}
fixed the brackets



.Summer is offline  
Old   #17
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,740
Received Thanks: 5,268
Quote:
Originally Posted by .Summer View Post
Code:
bool someEventIsTriggered = true;
if (someEventIsTriggered)
       {
	foreach(Game.Character Char in Game.World.H_Chars)
{
	Char.MyClient.DialogNPC = 666111;
	PacketHandling.NPCDialog.Handle(Char.MyClient, null, 666111, 0);
	Char.MyClient.EndSend();
	}
}
fixed the brackets
When he pastes it in C# it's going to fix the brackets automatically.
That was just a waste of a post.


Arcо is offline  
Thanks
1 User
Old   #18
 
elite*gold: 0
Join Date: Dec 2005
Posts: 231
Received Thanks: 85
Quote:
Originally Posted by .Summer View Post
Code:
bool someEventIsTriggered = true;
if (someEventIsTriggered)
       {
	foreach(Game.Character Char in Game.World.H_Chars)
{
	Char.MyClient.DialogNPC = 666111;
	PacketHandling.NPCDialog.Handle(Char.MyClient, null, 666111, 0);
	Char.MyClient.EndSend();
	}
}
fixed the brackets
what's wrong with the brackets? o.0 You can code all that in 1 line and it'd still work.
dragon89928 is offline  
Old   #19
 
elite*gold: 0
Join Date: May 2010
Posts: 630
Received Thanks: 130
Quote:
Originally Posted by dragon89928 View Post
what's wrong with the brackets? o.0 You can code all that in 1 line and it'd still work.
looking better.
but whatever XD


.Summer is offline  
Old   #20
 
elite*gold: 0
Join Date: Oct 2009
Posts: 128
Received Thanks: 49
Quote:
Originally Posted by .Summer View Post
looking better.
but whatever XD
It's all a matter of style. Unless you're working for a company that strictly enforcing certain coding conventions...
s.bat is offline  
Old   #21
 
elite*gold: 0
Join Date: Dec 2005
Posts: 231
Received Thanks: 85
Quote:
Originally Posted by s.bat View Post
It's all a matter of style. Unless you're working for a company that strictly enforcing certain coding conventions...
Personally I don't like how C# express does the brackets. IMO its a waste of space to have the starting "{" on its own line
dragon89928 is offline  
Old   #22
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,740
Received Thanks: 5,268
Java's bracket setup is way better.
Arcо is offline  
Old   #23
 
elite*gold: 0
Join Date: Dec 2006
Posts: 94
Received Thanks: 28
done, it by myself, thank you rly much
masternek is offline  
Old   #24
 
elite*gold: 0
Join Date: Dec 2005
Posts: 231
Received Thanks: 85
Quote:
Originally Posted by .Arco View Post
Java's bracket setup is way better.
yep i second that
dragon89928 is offline  
Old   #25
 
elite*gold: 0
Join Date: Feb 2010
Posts: 80
Received Thanks: 29
I realized that It doesn't show the name of person who wrote the wish on the file.

Code:
#region wish tree
                            case 999999: // make sure you change this to the npc you want to use
                                {

                                    if (Control == 0)
                                    {
                                        GC.AddSend(Packets.NPCSay("What is your wish?"));
                                        GC.AddSend(Packets.NPCLink2("Type in your wish", 1));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    else if (Control == 1)
                                       [COLOR="Magenta"]foreach (DictionaryEntry DE in World.H_Chars)
                                      {
                                          Character Chaar = (Game.Character)DE.Value;[/COLOR]
                                        string wish = ReadString(Data);
                                        if (wish != null)
                                        {
                                            string path = "C:\\OldCODB\\wish.txt";
                                            StreamWriter SW;
                                            if (File.Exists(path))
                                            {
                                                SW = File.AppendText(path);
                                                SW.WriteLine([COLOR="Magenta"]Chaar.Name +[/COLOR] ": " + wish);
                                                //will write  --   Name: My wish
                                                SW.Close();
                                                Console.WriteLine("A new wish has been made!");
                                            }
                                            else
                                            {
                                                SW = File.CreateText(path);
                                                SW.WriteLine(wish);
                                                SW.Close();
                                                Console.WriteLine("A new wish has been made!");
                                            }
                                        }
                                        GC.AddSend(Packets.NPCSay("Your Wish has been added into the file"));
                                        GC.AddSend(Packets.NPCLink2("Thanks", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    break;
                                }
                            #endregion
Add/Change the codes with pink ones. =]
xSynthesis is offline  
Old   #26
 
elite*gold: 0
Join Date: Dec 2005
Posts: 231
Received Thanks: 85
Quote:
Originally Posted by xSynthesis View Post
I realized that It doesn't show the name of person who wrote the wish on the file.
it doesn't? I'm pretty sure it will. What you're doing right there is cycling through characters, which is unnecessary since you already know that the person that pressed the npc is already gc.mychar.

edit: Okay, I took another look at the code and I think what's gonna happen if you do that is it will write all the names of the people with the same wish in the file x.x Because you didn't add any checks.
dragon89928 is offline  
Old   #27
 
elite*gold: 0
Join Date: Oct 2009
Posts: 128
Received Thanks: 49
Quote:
Originally Posted by xSynthesis View Post
I realized that It doesn't show the name of person who wrote the wish on the file.
Did you test to see if it doesn't write the player's name to the file, or are you just guessing? It looks like it should write the player's name to the file. Your code on the other hand, looks like it will write every single player's name in the file with the single player's wish, but I didn't look too closely into it.
s.bat is offline  
Old   #28
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,740
Received Thanks: 5,268
Quote:
Originally Posted by xSynthesis View Post
I realized that It doesn't show the name of person who wrote the wish on the file.
Uhm...
SW.WriteLine(GC.MyChar.Name + ": " + wish);
Yes it does?
Arcо is offline  
Old   #29
 
elite*gold: 0
Join Date: Feb 2010
Posts: 80
Received Thanks: 29
Quote:
Originally Posted by s.bat View Post
Did you test to see if it doesn't write the player's name to the file, or are you just guessing? It looks like it should write the player's name to the file. Your code on the other hand, looks like it will write every single player's name in the file with the single player's wish, but I didn't look too closely into it.
Yep I tested it and all I seen was wishes. There was no names. The first code which is
Code:
                                       foreach (DictionaryEntry DE in World.H_Chars)
                                      {
                                          Character Chaar = (Game.Character)DE.Value;
allows you to use "Chaar" at NPCDialog.cs otherwise you will get errors. I don't really know why but it seems GC.MyChar.Name doesn't work for some reason. But Chaar.Name does. I have tested my code aswell. And it works for me. D=

Edit:
Quote:
Originally Posted by .Arco View Post
Uhm...
SW.WriteLine(GC.MyChar.Name + ": " + wish);
Yes it does?
Well, It might work on you but it doesnt for me. I got ConquerSX's source and it's kinda different than normal one. It might because of that. I dunno D=
xSynthesis is offline  
Old   #30
 
elite*gold: 0
Join Date: Dec 2006
Posts: 94
Received Thanks: 28
yes, there are names, but thx for try helping xsynthesis


masternek is offline  
Reply



« Previous Thread | Next Thread »

Similar Threads
[Request] NAGC Skill Tree Uncap?
Title says. Is there any possible hack to uncap the 35 limit to infinity?
7 Replies - Grand Chase
Best Wishes from Hungary
Hi to ALL ! :D enjoy the life's goods :cool:
2 Replies - Say Hello
Druid Tree form buff without tree Form
My buddy and i were screwing around the other day in Mech and we figured out a way to have a working tree form buff for the party but not be in tree...
5 Replies - WoW Exploits, Hacks, Tools & Macros



All times are GMT +1. The time now is 16:47.


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

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2017 elitepvpers All Rights Reserved.