How would you get a npc to check the players level and if they are second reborn?
public static byte LEVEL = 200;//If should be over level 200 public static byte REBORNS = 2;//If should be over 2nd rb //You could also just replace LEVEL and REBORNS with the value u want if (GC.MyChar.Level >= LEVEL && GC.MyChar.Reborns >= REBORNS)
:p or could just make a simple if statmentQuote:
Code:public static byte LEVEL = 200;//If should be over level 200 public static byte REBORNS = 2;//If should be over 2nd rb //You could also just replace LEVEL and REBORNS with the value u want if (GC.MyChar.Level >= LEVEL && GC.MyChar.Reborns >= REBORNS)
if (GC.MyChar.Level >= 200 && GC.MyChar.Reborns >= 2)
remember to tell || can be used to make 2 checks to see if one is right.Quote:
I don't feel like re-writing a TON of stuff seeing as it's already been posted... If you look at my linklist there is some mini tutorials I wrote up that cover how to use some different types of things in C# including if/else if/else, try/catch and some similar stuff.
The tldr version though is that if(code to check) checks everything inside the bracket to verify if it is either true or false. If true the code under it is executed... if not then it isn't run.
You can do a string of if statements using else if.
Else simple means if no preceding statement is called then the else statement is run.
Eg:
if(GC.MyChar.Level >= 100)
{
//you are level 100 or over
}
else if (GC.MyChar.Level >=120)
{
you are over 120. This will NEVER be called because the first if statement is already confirming you are over 100!
}
else
{
//will only be called if under 100
}
If you do a string of if statements and then an else... then only 2 things can be called!
if(GC.MyChar.Level >= 100)
{
100 or over called
}
if(GC.MyChar.Level >= 120)
{
120 or over called (ALWAYS calls both if over 120.. because you are obviously over 100 if you are 120+)
}
else
{
will be called at 0-120. EVEN IF YOU ARE 110-120 THIS WILL BE CALLED BECAUSE YOU DID NOT DO ELSE IF FOR THE SECOND CHECK!
}
Also here are the things you can use for if statements
&& = and (both statements must be true)
|| = or (either statement must be true)
> = greater than
< = less than
>= greater than or equal to
<= less than or equal to
if (GC.MyChar.Level >= 120 && GC.MyChar.Reborns >= 1 || GC.MyChar.Reborns >= 2 && GC.MyChar.Level >= 110)//If you are over level 120 and 1st rb OR if you are 2nd rb and over level 110