Will this work

02/22/2010 02:32 -Shunsui-#1
Will this work because i just have feeling it wount havent tested it.
what i think it wount work is like the else statements are they set correct ? are they set well ?
Code:
#region SecondStageNPC DIS /// SET THE NPC IN GAME
                            case 4546:
                                {
                                    if (Linkback == 0)
                                    {
                                        GC.AddSend(Packets.NPCSay("You Must go Kill The Mobs That Are needed to Go Into Stage 3, You Need 1000 Mobs if You Are a Trojan Also for Ninjas. 800 For Warriors 500 For Taoist's And Archers"));
                                        GC.AddSend(Packets.NPCLink("I Killed them", 1));
                                        GC.AddSend(Packets.NPCLink("Dam, I Have to Keep Going", 255));
                                        GC.AddSend(Packets.NPCSetFace(30));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    if (Linkback == 1)
                                    {
                                        if (GC.MyChar.DisCity2 >= 1000 && GC.MyChar.Job >= 10 || GC.MyChar.Job <= 15)//Trojans)
                                        {
                                            GC.MyChar.Teleport(1002, 200, 210);//Set Correct Cords To Send to DisCity Stage 3
                                            //Also Set Awarding Exp
                                        }
                                        else
                                        {
                                            GC.AddSend(Packets.NPCSay("You need to kill 1000 Mobs since Your a Trojan Please return"));
                                            GC.AddSend(Packets.NPCLink("Dam, I Have to Keep Going", 255));
                                            GC.AddSend(Packets.NPCSetFace(30));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                        if (GC.MyChar.DisCity2 >= 1000 && GC.MyChar.Job >= 50 || GC.MyChar.Job <= 55)//Ninjas)
                                        {
                                            GC.MyChar.Teleport(1002, 200, 210);//Set Correct Cords To Send to DisCity Stage 3
                                            //Also Set Awarding Exp
                                        }
                                        else
                                        {
                                            GC.AddSend(Packets.NPCSay("You need to kill 800 Mobs since Your a Ninja Please return"));
                                            GC.AddSend(Packets.NPCLink("Dam, I Have to Keep Going", 255));
                                            GC.AddSend(Packets.NPCSetFace(30));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                        if (GC.MyChar.DisCity2 >= 800 && GC.MyChar.Job >= 20 || GC.MyChar.Job <= 25)//Warriors)
                                        {
                                            GC.MyChar.Teleport(1002, 200, 210);//Set Correct Cords To Send to DisCity Stage 3
                                            //Also Set Awarding Exp
                                        }
                                        else
                                        {
                                            GC.AddSend(Packets.NPCSay("You need to kill 800 Mobs since Your a Warrior Please return"));
                                            GC.AddSend(Packets.NPCLink("Dam, I Have to Keep Going", 255));
                                            GC.AddSend(Packets.NPCSetFace(30));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                        if (GC.MyChar.DisCity2 >= 500 && GC.MyChar.Job >= 100 || GC.MyChar.Job <= 145)//Taoist)
                                        {
                                            GC.MyChar.Teleport(1002, 200, 210);//Set Correct Cords To Send to DisCity Stage 3
                                            //Also Set Awarding Exp
                                        }
                                        else
                                        {
                                            GC.AddSend(Packets.NPCSay("You need to kill 500 Mobs since Your a Taoist Please return"));
                                            GC.AddSend(Packets.NPCLink("Dam, I Have to Keep Going", 255));
                                            GC.AddSend(Packets.NPCSetFace(30));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                        if (GC.MyChar.DisCity2 >= 500 && GC.MyChar.Job >= 40 || GC.MyChar.Job <= 45)//Trojans)
                                        {
                                            GC.MyChar.Teleport(1002, 200, 210);//Set Correct Cords To Send to DisCity Stage 3
                                            //Also Set Awarding Exp
                                        }
                                        else
                                        {
                                            GC.AddSend(Packets.NPCSay("You need to kill 500 Mobs since Your a Archer Please return"));
                                            GC.AddSend(Packets.NPCLink("Dam, I Have to Keep Going", 255));
                                            GC.AddSend(Packets.NPCSetFace(30));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                    }
                                    break;
                                }
                            #endregion
02/22/2010 02:36 ~Yuki~#2
use "esle if" instead of "if" again
PHP Code:
#region SecondStageNPC DIS /// SET THE NPC IN GAME
                            
case 4546:
                                {
                                    if (
Linkback == 0)
                                    {
                                        
GC.AddSend(Packets.NPCSay("You Must go Kill The Mobs That Are needed to Go Into Stage 3, You Need 1000 Mobs if You Are a Trojan Also for Ninjas. 800 For Warriors 500 For Taoist's And Archers"));
                                        
GC.AddSend(Packets.NPCLink("I Killed them"1));
                                        
GC.AddSend(Packets.NPCLink("Dam, I Have to Keep Going"255));
                                        
GC.AddSend(Packets.NPCSetFace(30));
                                        
GC.AddSend(Packets.NPCFinish());
                                    }
                                    if (
Linkback == 1)
                                    {
                                        if (
GC.MyChar.DisCity2 >= 1000 && GC.MyChar.Job >= 10 || GC.MyChar.Job <= 15)//Trojans)
                                        
{
                                            
GC.MyChar.Teleport(1002200210);//Set Correct Cords To Send to DisCity Stage 3
                                            //Also Set Awarding Exp
                                        
}
                                        else
                                        {
                                            
GC.AddSend(Packets.NPCSay("You need to kill 1000 Mobs since Your a Trojan Please return"));
                                            
GC.AddSend(Packets.NPCLink("Dam, I Have to Keep Going"255));
                                            
GC.AddSend(Packets.NPCSetFace(30));
                                            
GC.AddSend(Packets.NPCFinish());
                                        }
                                       else if (
GC.MyChar.DisCity2 >= 1000 && GC.MyChar.Job >= 50 || GC.MyChar.Job <= 55)//Ninjas)
                                        
{
                                            
GC.MyChar.Teleport(1002200210);//Set Correct Cords To Send to DisCity Stage 3
                                            //Also Set Awarding Exp
                                        
}
                                        else
                                        {
                                            
GC.AddSend(Packets.NPCSay("You need to kill 800 Mobs since Your a Ninja Please return"));
                                            
GC.AddSend(Packets.NPCLink("Dam, I Have to Keep Going"255));
                                            
GC.AddSend(Packets.NPCSetFace(30));
                                            
GC.AddSend(Packets.NPCFinish());
                                        }
                                       else if (
GC.MyChar.DisCity2 >= 800 && GC.MyChar.Job >= 20 || GC.MyChar.Job <= 25)//Warriors)
                                        
{
                                            
GC.MyChar.Teleport(1002200210);//Set Correct Cords To Send to DisCity Stage 3
                                            //Also Set Awarding Exp
                                        
}
                                        else
                                        {
                                            
GC.AddSend(Packets.NPCSay("You need to kill 800 Mobs since Your a Warrior Please return"));
                                            
GC.AddSend(Packets.NPCLink("Dam, I Have to Keep Going"255));
                                            
GC.AddSend(Packets.NPCSetFace(30));
                                            
GC.AddSend(Packets.NPCFinish());
                                        }
                                       else if (
GC.MyChar.DisCity2 >= 500 && GC.MyChar.Job >= 100 || GC.MyChar.Job <= 145)//Taoist)
                                        
{
                                            
GC.MyChar.Teleport(1002200210);//Set Correct Cords To Send to DisCity Stage 3
                                            //Also Set Awarding Exp
                                        
}
                                        else
                                        {
                                            
GC.AddSend(Packets.NPCSay("You need to kill 500 Mobs since Your a Taoist Please return"));
                                            
GC.AddSend(Packets.NPCLink("Dam, I Have to Keep Going"255));
                                            
GC.AddSend(Packets.NPCSetFace(30));
                                            
GC.AddSend(Packets.NPCFinish());
                                        }
                                       else if (
GC.MyChar.DisCity2 >= 500 && GC.MyChar.Job >= 40 || GC.MyChar.Job <= 45)//Trojans)
                                        
{
                                            
GC.MyChar.Teleport(1002200210);//Set Correct Cords To Send to DisCity Stage 3
                                            //Also Set Awarding Exp
                                        
}
                                        else
                                        {
                                            
GC.AddSend(Packets.NPCSay("You need to kill 500 Mobs since Your a Archer Please return"));
                                            
GC.AddSend(Packets.NPCLink("Dam, I Have to Keep Going"255));
                                            
GC.AddSend(Packets.NPCSetFace(30));
                                            
GC.AddSend(Packets.NPCFinish());
                                        }
                                    }
                                    break;
                                }
                            
#endregion 
02/22/2010 03:09 -Shunsui-#3
But. Still my Question will it Work ?
02/22/2010 03:16 Arcо#4
Quote:
Originally Posted by -Shunsui- View Post
But. Still my Question will it Work ?
Only one way to find out.
T&E.
02/22/2010 05:11 ~Yuki~#5
Tested - Works
02/22/2010 11:30 PeTe Ninja#6
no you guys are failure with your else ifs and else

you have

if { } // FIRST
else { } // OVERRIDES ALL
else if { }
else { }
02/22/2010 12:49 Decker_#7
Quote:
Originally Posted by PeTe Ninja View Post
no you guys are failure with your else ifs and else

you have

if { } // FIRST
else { } // OVERRIDES ALL
else if { }
else { }
Why two of them?
02/22/2010 12:52 Arcо#8
Quote:
Originally Posted by Decker_ View Post
Why two of them?
An else for each if.
02/22/2010 12:54 Decker_#9
Ahh ok ok.
02/22/2010 21:05 PeTe Ninja#10
Quote:
Originally Posted by .Arco View Post
An else for each if.
no im saying what they did is wrong

you cant do


if (Box == blue)
{
}
else
{
}
else if (Box == red)
{
}
else
{
}
else if (Box == green)
{
}

you have to do

if (Box == blue)
{
}
else if (Box == red)
{
}
else if (Box == green)
{
}
else
{
}
02/23/2010 02:39 -Shunsui-#11
Quote:
Originally Posted by PeTe Ninja View Post
no im saying what they did is wrong

you cant do


if (Box == blue)
{
}
else
{
}
else if (Box == red)
{
}
else
{
}
else if (Box == green)
{
}

you have to do

if (Box == blue)
{
}
else if (Box == red)
{
}
else if (Box == green)
{
}
else
{
}
So Its like

Code:
[COLOR="Blue"]if (Box == blue)[/COLOR]
{
}
[COLOR="Red"]else if (Box == red)[/COLOR]
{
}
[COLOR="Lime"]else if (Box == green)[/COLOR]
{
}
[COLOR="blue"]else[/COLOR]
{
}
[COLOR="red"]else[/COLOR]
{
}
[COLOR="lime"]else[/COLOR]
{
}
The Color that its the If its what it goes with the else ?
02/23/2010 02:41 Arcо#12
Quote:
Originally Posted by -Shunsui- View Post
So Its like

Code:
[COLOR="Blue"]if (Box == blue)[/COLOR]
{
}
[COLOR="Red"]else if (Box == red)[/COLOR]
{
}
[COLOR="Lime"]else if (Box == green)[/COLOR]
{
}
[COLOR="blue"]else[/COLOR]
{
}
[COLOR="red"]else[/COLOR]
{
}
[COLOR="lime"]else[/COLOR]
{
}
The Color that its the If its what it goes with the else ?
No it would be:
Code:
[COLOR="Blue"]if (Box == blue)[/COLOR]
{
}
[COLOR="Red"]else if (Box == red)[/COLOR]
{
}
[COLOR="Lime"]else if (Box == green)[/COLOR]
{
}
[COLOR="blue"]else[/COLOR]
{
}
02/23/2010 02:50 -Shunsui-#13
Quote:
Originally Posted by .Arco View Post
No it would be:
Code:
[COLOR="Blue"]if (Box == blue)[/COLOR]
{
}
[COLOR="Red"]else if (Box == red)[/COLOR]
{
}
[COLOR="Lime"]else if (Box == green)[/COLOR]
{
}
[COLOR="blue"]else[/COLOR]
{
}
>.< So its 1 Else for all the If ?
02/23/2010 10:06 Korvacs#14
Correct.

If you want to do more things you should probably use a switch, you can handle all possibilities and use default: for everything else.
02/23/2010 15:18 ~Yuki~#15
and: Switches are faster since they dun loop throu all if statements