Register for your free account! | Forgot your password?

You last visited: Today at 22:11

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

Advertisement



Change your class NPC

Discussion on Change your class NPC within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
anone.ious's Avatar
 
elite*gold: 0
Join Date: May 2014
Posts: 48
Received Thanks: 3
Change your class NPC

Here is npc [change your class for 1,000,000 CPS!!]
for Source 5165.

k go to NPCDialog.cs and add this:
Code:
 #region ChangeYourClass
                            case 6699:
                                {
                                    if (Control == 0)
                                    {
                                        GC.AddSend(Packets.NPCSay("Would you like to change your job for 1000000 cps?"));
                                        GC.AddSend(Packets.NPCLink("Sure!", 1));
                                        GC.AddSend(Packets.NPCLink("No thanks.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }

                                    else if (Control == 1)
                                    {

                                        GC.AddSend(Packets.NPCSay("Alright choose the job. [for 1000000 cps]"));
                                        GC.AddSend(Packets.NPCLink("Trojan", 3));
                                        GC.AddSend(Packets.NPCLink("Warrior", 4));
                                        GC.AddSend(Packets.NPCLink("Archer", 5));
                                        GC.AddSend(Packets.NPCLink("WaterTaoist", 6));
                                        GC.AddSend(Packets.NPCLink("FireTaoist", 7));
                                        GC.AddSend(Packets.NPCLink("Ninja", 8));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());

                                    }

                                     if (Control == 3)
                                        if (GC.MyChar.Job >= 15 && GC.MyChar.CPs >= 1000000)
                                        {
                                            GC.MyChar.CPs -= 1000000;
                                            GC.MyChar.Job = 15;
                                        }
                                     if (Control == 4)
                                        if (GC.MyChar.Job >= 15 && GC.MyChar.CPs >= 1000000)
                                        {
                                            GC.MyChar.CPs -= 1000000;
                                            GC.MyChar.Job = 25;
                                        }
                                     if (Control == 5)
                                        if (GC.MyChar.Job >= 15 && GC.MyChar.CPs >= 1000000)
                                        {
                                            GC.MyChar.CPs -= 1000000;
                                            GC.MyChar.Job = 45;
                                        }
                                     if (Control == 6)
                                         if (GC.MyChar.Job >= 15 && GC.MyChar.CPs >= 1000000)
                                        {
                                            GC.MyChar.CPs -= 1000000;
                                            GC.MyChar.Job = 135;
                                        }
                                     if (Control == 7)
                                         if (GC.MyChar.Job >= 15 && GC.MyChar.CPs >= 1000000)
                                        {
                                            GC.MyChar.CPs -= 1000000;
                                            GC.MyChar.Job = 145;
                                        }
                                     if (Control == 8)
                                         if (GC.MyChar.Job >= 15 && GC.MyChar.CPs >= 1000000)
                                        {
                                            GC.MyChar.CPs -= 1000000;
                                            GC.MyChar.Job = 55;
                                        }
                                    break;
                                }
                            #endregion
and now go to NPCS.txt on your OLDCOOB folder and add this in the bottom
Code:
 6699 9200 2 67 1002 443 361
NOTE: if you want change the cps just change the GC.MyChar.CPs -= 1000000; [1000000 is the cps just change it if you want..]
if i helped to you press on the Thanks button
anone.ious is offline  
Thanks
1 User
Old 07/05/2014, 09:02   #2
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,190
A switch statement may be a better option than what you have going on. Actually, a nested if-else statement would be better than what you have as well. Having to check every if statement (like what you have above) will cost you.
Spirited is offline  
Old 07/05/2014, 11:29   #3
 
turk55's Avatar
 
elite*gold: 130
Join Date: Oct 2007
Posts: 1,655
Received Thanks: 705
So you have to be a Trojan Master or anything else ?

EDIT: I was bored so here is a better approach, not sure if it will work with the source you use though but you should get the idea.

Code:
case 6699:
{
	if (Control == 0)
	{
		GC.AddSend(Packets.NPCSay("Would you like to change your job for 1000000 cps?"));
		GC.AddSend(Packets.NPCLink("Sure!", 1));
		GC.AddSend(Packets.NPCLink("No thanks.", 255));
	} 
	else if (Control == 1)
	{ 
		GC.AddSend(Packets.NPCSay("Alright choose the job. [for 1000000 cps]"));
		GC.AddSend(Packets.NPCLink("Trojan", 15));
		GC.AddSend(Packets.NPCLink("Warrior", 25));
		GC.AddSend(Packets.NPCLink("Archer", 45));
		GC.AddSend(Packets.NPCLink("WaterTaoist", 135));
		GC.AddSend(Packets.NPCLink("FireTaoist", 145));
		GC.AddSend(Packets.NPCLink("Ninja", 55));
	}
	if(Control > 1) {
		if(GC.MyChar.CPs >= 1000000) {
			GC.MyChar.CPs -= 1000000;
			GC.MyChar.Job = Control;
			GC.AddSend(Packets.NPCSay("Your class has been changed."));
			GC.AddSend(Packets.NPCLink("Thanks", 255)); 
		} else {
			GC.AddSend(Packets.NPCSay("You don't meet the requirements."));
			GC.AddSend(Packets.NPCLink("My bad", 255)); 
		}
	}
	GC.AddSend(Packets.NPCSetFace(N.Avatar));
	GC.AddSend(Packets.NPCFinish()); 
	break;
}
turk55 is offline  
Old 07/07/2014, 13:55   #4
 
elite*gold: 0
Join Date: Jul 2014
Posts: 402
Received Thanks: 540
If there's someone out there who actually needs this or finds this useful, they shouldn't be coding a private server at all.
Best Coder 2014 is offline  
Thanks
2 Users
Old 07/08/2014, 04:59   #5
 
InsomniacPro's Avatar
 
elite*gold: 0
Join Date: Feb 2014
Posts: 397
Received Thanks: 205
Code:
            case 6699:
    switch(Control)
{

        case 0:
		GC.AddSend(Packets.NPCSay("Would you like to change your job for 1000000 cps?"));
		GC.AddSend(Packets.NPCLink("Sure!", 1));
		GC.AddSend(Packets.NPCLink("No thanks.", 255));
	
            break;
        case 1:
		GC.AddSend(Packets.NPCSay("Alright choose the job. [for 1000000 cps]"));
		GC.AddSend(Packets.NPCLink("Trojan", 15));
		GC.AddSend(Packets.NPCLink("Warrior", 25));
		GC.AddSend(Packets.NPCLink("Archer", 45));
		GC.AddSend(Packets.NPCLink("WaterTaoist", 135));
		GC.AddSend(Packets.NPCLink("FireTaoist", 145));
		GC.AddSend(Packets.NPCLink("Ninja", 55));
        default:
		if(GC.MyChar.CPs >= 1000000)
                 {
			GC.MyChar.CPs -= 1000000;
			GC.MyChar.Job = Control;
			GC.AddSend(Packets.NPCSay("Your class has been changed."));
			GC.AddSend(Packets.NPCLink("Thanks", 255)); 
             break;		  
                 }
			GC.AddSend(Packets.NPCSay("You don't meet the requirements."));
			GC.AddSend(Packets.NPCLink("My bad", 255)); 
		
            break;
	}
	GC.AddSend(Packets.NPCSetFace(N.Avatar));
	GC.AddSend(Packets.NPCFinish()); 
	break;
}
InsomniacPro is offline  
Old 07/08/2014, 05:30   #6
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,190
As I said in my previous post, an if-else statement would be the most efficient conditional structure for this scenario. It's not large enough for a switch statement to become more efficient.

Code:
if (Control == 0)
{

}
else if (Control == 1)
{

}
else
{

}
Spirited is offline  
Old 07/08/2014, 06:18   #7
 
InsomniacPro's Avatar
 
elite*gold: 0
Join Date: Feb 2014
Posts: 397
Received Thanks: 205
Quote:
Originally Posted by Spirited View Post
As I said in my previous post, an if-else statement would be the most efficient conditional structure for this scenario. It's not large enough for a switch statement to become more efficient.

Code:
if (Control == 0)
{

}
else if (Control == 1)
{

}
else
{

}
But switches look sooooooo much neater!
InsomniacPro is offline  
Old 07/08/2014, 06:42   #8
 
InfamousNoone's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
Quote:
Originally Posted by Spirited View Post
As I said in my previous post, an if-else statement would be the most efficient conditional structure for this scenario. It's not large enough for a switch statement to become more efficient.

Code:
if (Control == 0)
{

}
else if (Control == 1)
{

}
else
{

}
there's no need to micro-optimize the performance loss is negligible if a switch-statement were actually generated, secondly the compiler is smart enough to produce an if-statement if the switch statement is "inefficiently small."
InfamousNoone is offline  
Old 07/08/2014, 07:06   #9
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,190
Quote:
Originally Posted by InfamousNoone View Post
there's no need to micro-optimize the performance loss is negligible if a switch-statement were actually generated, secondly the compiler is smart enough to produce an if-statement if the switch statement is "inefficiently small."
So you're saying that you should just rely on your compiler to fix your **** programming practices? That doesn't sound right in the slightest. Sure it's small, but knowing the correct way of doing it can't harm your code.
Spirited is offline  
Thanks
1 User
Old 07/08/2014, 13:16   #10
 
elite*gold: 0
Join Date: Jul 2014
Posts: 402
Received Thanks: 540
Quote:
Originally Posted by Spirited View Post
So you're saying that you should just rely on your compiler to fix your shit programming practices? That doesn't sound right in the slightest. Sure it's small, but knowing the correct way of doing it can't harm your code.




Quote:
This would be much better represented as a switch as it then makes it immediately obviously that the choice of action is occurring based on the value of "value" and not some arbitrary test.
Quote:
If you are switching on the value of a single variable then I'd use a switch every time, it's what the construct was made for.
Edit:
Using a switch might actually be faster than if/else in this specific even if there's only a few branches, if not then at least as fast as if/else.
But let's be honest, only a moron would actually worry about insignificant stuff like this.

Double edit:
Really, you should never ever ever ever ever ever ever think about performance when choosing whether to use switch or if/else ... really, NEVER. That is the stupidest shit I have ever heard.
Best Coder 2014 is offline  
Thanks
2 Users
Old 07/08/2014, 16:34   #11


 
KraHen's Avatar
 
elite*gold: 0
Join Date: Jul 2006
Posts: 2,216
Received Thanks: 794
Here we are again, if vs switch. Lets start a Java bashing and a Python vs. LUA scripting war as well and it`s like the old days.
KraHen is offline  
Old 07/08/2014, 17:34   #12
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,190
Quote:
Originally Posted by Best Coder 2014 View Post








Edit:
Using a switch might actually be faster than if/else in this specific even if there's only a few branches, if not then at least as fast as if/else.
But let's be honest, only a moron would actually worry about insignificant stuff like this.

Double edit:
Really, you should never ever ever ever ever ever ever think about performance when choosing whether to use switch or if/else ... really, NEVER. That is the stupidest **** I have ever heard.
That answer was written for an absolute beginner to teach him/her what a switch statement is used for. You can do whatever the hell you want (I'm not telling you want to do), but I do things the way they should be done (you know, the correct way). You can argue your position all you want, but it's still the technically the wrong position.
Spirited is offline  
Old 07/08/2014, 17:42   #13
 
elite*gold: 0
Join Date: Jul 2014
Posts: 402
Received Thanks: 540
Quote:
Originally Posted by Spirited View Post
That answer was written for an absolute beginner to teach him/her what a switch statement is used for. You can do whatever the hell you want (I'm not telling you want to do), but I do things the way they should be done (you know, the correct way). You can argue your position all you want, but it's still the technically the wrong position.
Reality
-
-
-
-
-
-
-
-
-
-
-

You

Really, you couldn't be further away.
Best Coder 2014 is offline  
Old 07/08/2014, 17:53   #14
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,190
Quote:
Originally Posted by Best Coder 2014 View Post
Reality
-
-
-
-
-
-
-
-
-
-
-

You

Really, you couldn't be further away.
As I said, you can do whatever you want (no need to get **** hurt), just don't come here spreading bad programming practices. There's a time to use a switch statement, and the correct time to use it would be to replace larger if-ifelse-else conditional code blocks that share the some conditional identifier.
Spirited is offline  
Old 07/08/2014, 18:02   #15
 
elite*gold: 0
Join Date: Jul 2014
Posts: 402
Received Thanks: 540
Quote:
Originally Posted by Spirited View Post
As I said, you can do whatever you want (no need to get butt hurt), just don't come here spreading bad programming practices. There's a time to use a switch statement, and the correct time to use it would be to replace larger if-ifelse-else conditional code blocks that share the some conditional identifier.
Quote:
If and Switch: When to use Which
Now that if and switch statements have both been explained, it's time to analyze: which is more appropriate in certain situations?

If and switch seem related to each other in the same manner as while and for. Switch statements work well when critiquing the value of a single variable, and save time and space in these situations, just as for provides a more concise and contained way to write count-controlled loops. Furthermore, switch statements and count-controlled loops fit very well together simply due to the nature of their coding.

Just as while allows for broader test statements, so does if when compared to switch. When dealing with difficult logic that spans a plethora of variables, if statements are the most appropriate. They allow for multiple tests to be performed as well as logical comparisons of these test values. If statements can also be nested to allow for critically defined and logically understandable paths of execution.

So, when deciding which statement you should use, simply ask yourself: can I relate all the possible paths of execution to a single variable? If so, then switch is best, as it saves time and is easy to read. If no, then you need to use if, as switch can only handle conditional situations that rely on a single variable.
From

Do I need to provide more sources, or will you just keep talking shit?
Best Coder 2014 is offline  
Reply


Similar Threads Similar Threads
Class Change
06/19/2014 - Trading - 1 Replies
I have a hunter level 20 n it doesn't give me the option to upgrade my class. What can i do?
[funny-release] change CLASS npc by addition to pirate class xDDD
01/12/2012 - CO2 PServer Guides & Releases - 30 Replies
all of us wating for pirate decided to code some sort of npc which change ur job in additon to pirate that some sort of fun no more in ur npc.cs or what ever its name add that #region (CharChanger By Eslam) case 17494: { switch (npcRequest.OptionID) { case 0: { dialog.Text("Would u like to change your job?"); dialog.Option("Yes Please", 1); dialog.Option("No.", 255); dialog.Send(); break; }
ANybody Knows how to change class to another class
08/20/2009 - Cabal Online - 5 Replies
I ve been wondering if a WA could wear a martial set or a wizard could wear battleset..Any one knows how to change class? ;)
Any way to re-change class?
11/16/2008 - Aion - 1 Replies
Hey, im playing aion, and i want to know if it's there any way to re-change class after first class transfer at lvl 10. I transfered to a assassin, but i want to know if it's there any way to change to a ranger. Sry for my bad english.
Class change to TBC Class (bloodelf & Danei)
11/03/2006 - World of Warcraft - 127 Replies
habe das hier vor kurzem mal im icq gesendet bekommen, hoffe das steht hier noch net ^^ es ist zwar buggy z.b. wenn ihr ein troll mit tatoos in der fratze habt usw aber man kann es durch aus usen. am besten neuen char machen und richtig einstellen :). Anleitung: ladet die datei runter in euer World of Warcraft\Data ordner und benennt sie in speech2.mpq um, dan einfach in wow einloggen wenn es ein stick wert ist bitte sticken :)



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


Powered by vBulletin®
Copyright ©2000 - 2025, 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 ©2025 elitepvpers All Rights Reserved.