[Help] 5165 NPC Help

01/13/2010 22:41 xScott#1
Hey i cant seem to get my NPC to make the character get a given amount of Aggility

Heres the code.

Code:
                              GC.MyChar.CPs -= 1290;
                              GC.MyChar.Agi =275;
                              GC.AddSend(Packets.NPCSay("There you go, You now have 275 Aggility. Come back if you reallot your Attribute Points again!"));
                              GC.AddSend(Packets.NPCLink("Thanks!", 255));
                              GC.AddSend(Packets.NPCSetFace(N.Avatar));
                              GC.AddSend(Packets.NPCFinish());
After i click the link that does this code, it doesnt change the aggility i said in the code.
01/13/2010 22:43 .Ryu#2
Quote:
Originally Posted by xScott View Post
Hey i cant seem to get my NPC to make the character get a given amount of Aggility

Heres the code.

Code:
                                                            GC.MyChar.CPs -= 1290;
                                                            GC.MyChar.Agi =275;
                                                            GC.AddSend(Packets.NPCSay("There you go, You now have 176 Strength. Come back if you reallot your Attribute Points again!"));
                                                            GC.AddSend(Packets.NPCLink("Thanks!", 255));
                                                            GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                            GC.AddSend(Packets.NPCFinish());
After i click the link that does this code, it doesnt change the aggility i said in the code.
Maybe because the NPC is not complete lol
Post the full code and ill see what i can do =P
01/13/2010 22:45 xScott#3
Quote:
Originally Posted by .Fox View Post
Maybe because the NPC is not complete lol
Post the full code and ill see what i can do =P
Code:
#region Stats
                            case 55570:
                                    {
                                        if(Control == 0)
                                        {
                                          if(GC.MyChar.Level >= 120 && GC.MyChar.Reborns >= 1)
                                          {
                                                
                                            {
                                                GC.AddSend(Packets.NPCSay("Hey, are you the type of person who Allots all your points to HP? "));
                                                GC.AddSend(Packets.NPCSay("If your sick of Realloting your points to weild seperate gear then i can help you. "));
                                                GC.AddSend(Packets.NPCSay("Remember, You have to be promoted to the highest promotion to do this! "));
                                                GC.AddSend(Packets.NPCSay("Required Statuses to Boost Attribute points, Strength Point classes: Trojan, Warrior, Water "));
                                                GC.AddSend(Packets.NPCSay("Required Statuses to Boost Attribute points, Aggility Point classes: Ninja, Archer "));
                                                GC.AddSend(Packets.NPCSay("This will cost 1290CPs"));
                                                GC.AddSend(Packets.NPCLink("Strength Attribute Points", 1));
                                                GC.AddSend(Packets.NPCLink("Aggility Attribute Points", 2));
                                                GC.AddSend(Packets.NPCLink("Just passing by.", 255));
                                                GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                GC.AddSend(Packets.NPCFinish());

                                            }
                                                if(Control == 1)
                                                {
                                                    if (GC.MyChar.Job == 15 || GC.MyChar.Job == 25 || GC.MyChar.Job == 135 && GC.MyChar.CPs >= 1290) //checks if its a tro,war or water & has 1290
                                                    {
                                                        GC.MyChar.CPs -= 1290;
                                                        GC.MyChar.Str = 175;
                                                        GC.AddSend(Packets.NPCSay("There you go, You now have 176 Strength. Come back if you reallot your Attribute Points again!"));
                                                        GC.AddSend(Packets.NPCLink("Thanks!", 255));
                                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                        GC.AddSend(Packets.NPCFinish());

                                                    }
                                                        else
                                                    {
                                                        GC.AddSend(Packets.NPCSay("Im sorry, But you are not a TrojanMaster, WarriorMaster or WaterSaint."));
                                                        GC.AddSend(Packets.NPCLink("Sorry.", 255));
                                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                        GC.AddSend(Packets.NPCFinish());
                                                    }
                                                     
                                                    if(Control == 2)
                                                    {
                                                        if (GC.MyChar.Job == 55 || GC.MyChar.Job == 45 && GC.MyChar.CPs >= 1290) //checks if ninja or archer & cps
                                                        {
                                                            GC.MyChar.CPs -= 1290;
                                                            GC.MyChar.Agi =275;
                                                            GC.AddSend(Packets.NPCSay("There you go, You now have 176 Strength. Come back if you reallot your Attribute Points again!"));
                                                            GC.AddSend(Packets.NPCLink("Thanks!", 255));
                                                            GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                            GC.AddSend(Packets.NPCFinish());
                                                        }
                                                    }
                                                    else
	                                                    {
                                                            GC.AddSend(Packets.NPCSay("Im sorry, But you are not a NinjaMaster or ArcherMaster."));
                                                            GC.AddSend(Packets.NPCLink("Sorry.", 255));
                                                            GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                            GC.AddSend(Packets.NPCFinish());
	                                                    }
                                                    }
                                                
                                        }

                                          else  //not right level
                                            {
                                                GC.AddSend(Packets.NPCSay("Im sorry but this option is only aloud for players that exceed level 120, Come back when your stronger!"));
                                                GC.AddSend(Packets.NPCLink("Oh, Sorry.", 255));
                                                GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                GC.AddSend(Packets.NPCFinish());
                                            }
                                        }
                                        break;
                                    }
                                #endregion

Its probably a silly mistake. i just cant find it xD
01/13/2010 22:48 .Ryu#4
Quote:
Originally Posted by xScott View Post
Code:
#region Stats
                            case 55570:
                                    {
                                        if(Control == 0)
                                        {
                                          if(GC.MyChar.Level >= 120 && GC.MyChar.Reborns >= 1)
                                          {
                                                
                                            {
                                                GC.AddSend(Packets.NPCSay("Hey, are you the type of person who Allots all your points to HP? "));
                                                GC.AddSend(Packets.NPCSay("If your sick of Realloting your points to weild seperate gear then i can help you. "));
                                                GC.AddSend(Packets.NPCSay("Remember, You have to be promoted to the highest promotion to do this! "));
                                                GC.AddSend(Packets.NPCSay("Required Statuses to Boost Attribute points, Strength Point classes: Trojan, Warrior, Water "));
                                                GC.AddSend(Packets.NPCSay("Required Statuses to Boost Attribute points, Aggility Point classes: Ninja, Archer "));
                                                GC.AddSend(Packets.NPCSay("This will cost 1290CPs"));
                                                GC.AddSend(Packets.NPCLink("Strength Attribute Points", 1));
                                                GC.AddSend(Packets.NPCLink("Aggility Attribute Points", 2));
                                                GC.AddSend(Packets.NPCLink("Just passing by.", 255));
                                                GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                GC.AddSend(Packets.NPCFinish());

                                            }
                                                if(Control == 1)
                                                {
                                                    if (GC.MyChar.Job == 15 || GC.MyChar.Job == 25 || GC.MyChar.Job == 135 && GC.MyChar.CPs >= 1290) //checks if its a tro,war or water & has 1290
                                                    {
                                                        GC.MyChar.CPs -= 1290;
                                                        GC.MyChar.Str = 175;
                                                        GC.AddSend(Packets.NPCSay("There you go, You now have 176 Strength. Come back if you reallot your Attribute Points again!"));
                                                        GC.AddSend(Packets.NPCLink("Thanks!", 255));
                                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                        GC.AddSend(Packets.NPCFinish());

                                                    }
                                                        else
                                                    {
                                                        GC.AddSend(Packets.NPCSay("Im sorry, But you are not a TrojanMaster, WarriorMaster or WaterSaint."));
                                                        GC.AddSend(Packets.NPCLink("Sorry.", 255));
                                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                        GC.AddSend(Packets.NPCFinish());
                                                    }
                                                     
                                                    if(Control == 2)
                                                    {
                                                        if (GC.MyChar.Job == 55 || GC.MyChar.Job == 45 && GC.MyChar.CPs >= 1290) //checks if ninja or archer & cps
                                                        {
                                                            GC.MyChar.CPs -= 1290;
                                                            GC.MyChar.Agi =275;
                                                            GC.AddSend(Packets.NPCSay("There you go, You now have 176 Strength. Come back if you reallot your Attribute Points again!"));
                                                            GC.AddSend(Packets.NPCLink("Thanks!", 255));
                                                            GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                            GC.AddSend(Packets.NPCFinish());
                                                        }
                                                    }
                                                    else
	                                                    {
                                                            GC.AddSend(Packets.NPCSay("Im sorry, But you are not a NinjaMaster or ArcherMaster."));
                                                            GC.AddSend(Packets.NPCLink("Sorry.", 255));
                                                            GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                            GC.AddSend(Packets.NPCFinish());
	                                                    }
                                                    }
                                                
                                        }

                                          else  //not right level
                                            {
                                                GC.AddSend(Packets.NPCSay("Im sorry but this option is only aloud for players that exceed level 120, Come back when your stronger!"));
                                                GC.AddSend(Packets.NPCLink("Oh, Sorry.", 255));
                                                GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                GC.AddSend(Packets.NPCFinish());
                                            }
                                        }
                                        break;
                                    }
                                #endregion

Its probably a silly mistake. i just cant find it xD
Do you get errors cause i dont have the 5165 source... and if you can show me a screen shot of the error it would be allot easier for me ^^
01/13/2010 22:51 xScott#5
Quote:
Originally Posted by .Fox View Post
Do you get errors cause i dont have the 5165 source... and if you can show me a screen shot of the error it would be allot easier for me ^^
Nah there isnt an error,

after i click the link which checks for cps & what jobs they are and preforms the code. it doesnt show the dialog i coded once its done

Like this part

Code:
                                                        GC.AddSend(Packets.NPCSay("There you go, You now have 176 Strength. Come back if you reallot your Attribute Points again!"));
                                                        GC.AddSend(Packets.NPCLink("Thanks!", 255));
                                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                        GC.AddSend(Packets.NPCFinish());
idunno what the error is. it just doesnt do anything after i click the links. :S
01/13/2010 22:53 .Ryu#6
Quote:
Originally Posted by xScott View Post
Nah there isnt an error,

after i click the link which checks for cps & what jobs they are and preforms the code. it doesnt show the dialog i coded once its done

Like this part

Code:
                                                        GC.AddSend(Packets.NPCSay("There you go, You now have 176 Strength. Come back if you reallot your Attribute Points again!"));
                                                        GC.AddSend(Packets.NPCLink("Thanks!", 255));
                                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                        GC.AddSend(Packets.NPCFinish());
idunno what the error is. it just doesnt do anything after i click the links. :S
Well then it got mested up hold on ill see what i can do
01/13/2010 22:54 xScott#7
Quote:
Originally Posted by .Fox View Post
Well then it got mested up hold on ill see what i can do
i think i realised what ive done wrong, ill post back if i fixed it or not

I placed the second link nested into the the first link
whereas i should've done else if i think...
01/13/2010 22:56 .Ryu#8
Quote:
Originally Posted by xScott View Post
i think i realised what ive done wrong, ill post back if i fixed it or not

I played the second link nested into the the first link
whereas i should've done else if i think...
K if you need help lemme know =P
01/14/2010 00:38 xScott#9
ugh i just cant get it to work ><
01/14/2010 11:35 intel_ro#10
Quote:
Originally Posted by xScott View Post
Hey i cant seem to get my NPC to make the character get a given amount of Aggility

Heres the code.

Code:
                              GC.MyChar.CPs -= 1290;
                              [COLOR="Red"]GC.MyChar.Agi =275;[/COLOR]
                              [COLOR="MediumTurquoise"]GC.MyChar.Agi = 275;[/COLOR]
                              GC.AddSend(Packets.NPCSay("There you go, You now have 275 Aggility. Come back if you reallot your Attribute Points again!"));
                              GC.AddSend(Packets.NPCLink("Thanks!", 255));
                              GC.AddSend(Packets.NPCSetFace(N.Avatar));
                              GC.AddSend(Packets.NPCFinish());
After i click the link that does this code, it doesnt change the aggility i said in the code.
Look at colors lines
your line is red my is blue
01/14/2010 16:07 xScott#11
Quote:
Originally Posted by intel_ro View Post
Look at colors lines
your line is red my is blue
Yeah i tried that, it doesnt make a differance :(
01/14/2010 16:14 spare2#12
It has to be with two equal signs.
Code:
GC.MyChar.Agi == 275;
=p
01/14/2010 16:15 pro4never#13
#1 problem which I think you already corrected

Too much/incorrect indentation


#2 after reading through it... REALLLLYYY messed up indentation.

Note I do not use lotf so I can't correct any other coding errors but here is the correct indented version

Code:
#region Stats
                case 55570:
                    {
                        if (Control == 0)
                        
                            
                            

                                {
                                    GC.AddSend(Packets.NPCSay("Hey, are you the type of person who Allots all your points to HP? "));
                                    GC.AddSend(Packets.NPCSay("If your sick of Realloting your points to weild seperate gear then i can help you. "));
                                    GC.AddSend(Packets.NPCSay("Remember, You have to be promoted to the highest promotion to do this! "));
                                    GC.AddSend(Packets.NPCSay("Required Statuses to Boost Attribute points, Strength Point classes: Trojan, Warrior, Water "));
                                    GC.AddSend(Packets.NPCSay("Required Statuses to Boost Attribute points, Aggility Point classes: Ninja, Archer "));
                                    GC.AddSend(Packets.NPCSay("This will cost 1290CPs"));
                                    GC.AddSend(Packets.NPCLink("Strength Attribute Points", 1));
                                    GC.AddSend(Packets.NPCLink("Aggility Attribute Points", 2));
                                    GC.AddSend(Packets.NPCLink("Just passing by.", 255));
                                    GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                    GC.AddSend(Packets.NPCFinish());

                                }
                                if (Control == 1)
                                {
                                    if ((GC.MyChar.Job >= 10 && GC.MyChar.Job <= 25) || ( GC.MyChar.Job >= 130 && GC.MyChar.Job <= 135) && GC.MyChar.CPs >= 1290 && GC.MyChar.Level >= 120 && GC.MyChar.Reborns >= 1) //checks if its a tro,war or water & has 1290 & level & reborn
                                    {
                                        GC.MyChar.CPs -= 1290;
                                        GC.MyChar.Str = 175;
                                        GC.AddSend(Packets.NPCSay("There you go, You now have 176 Strength. Come back if you reallot your Attribute Points again!"));
                                        GC.AddSend(Packets.NPCLink("Thanks!", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());

                                    }
                                    else
                                    {
                                        GC.AddSend(Packets.NPCSay("Im sorry, But you are not a trojan, warrior or water."));
                                        GC.AddSend(Packets.NPCLink("Sorry.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                }
                                

                                    if (Control == 2)
                                    {
                                    
                                        if (GC.MyChar.Job == 55 || GC.MyChar.Job == 45 && GC.MyChar.CPs >= 1290 && GC.MyChar.Level >= 120 && GC.MyChar.Reborns >= 1) //checks if ninja or archer & cps
                                        {
                                            GC.MyChar.CPs -= 1290;
                                            GC.MyChar.Agi = 275;
                                            GC.AddSend(Packets.NPCSay("There you go, You now have 275 Agility. Come back if you reallot your Attribute Points again!"));
                                            GC.AddSend(Packets.NPCLink("Thanks!", 255));
                                            GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                    
                                    else
                                    {
                                        GC.AddSend(Packets.NPCSay("Im sorry, But you are not a Ninja or Archer."));
                                        GC.AddSend(Packets.NPCLink("Sorry.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    }
                        break;
                                }
                            
                #endregion
I removed some of the checks and combined others simply because I didn't want to have to re-write the entire script.


For future reference, structure of npcs should be


NpcCaseNumber blablabla
{
Control/linkback (same thing, wording changes with source)
{
options for THAT linkback including if statements
}
break;
}

Each Control statement should be COMPLETELY enclosed, no linking if statements off to the end of the script (you had the level check else'ing out to outside the options all together and some other funky stuff)

Just watch your indentation. I assume the stat setting code you have in there is correct as I've never used lotf... but just double check it is saving properly. If not you will have to update the character database/ini files (fairly sure new lotf uses .ini for character info right? Either way it's same thing)

Good luck with your coding! Good to see someone trying to learn
P4N


Quote:
Originally Posted by spare2 View Post
It has to be with two equal signs.
Code:
GC.MyChar.Agi == 275;
=p
Ummm... no it doesn't.

== is used for checking a value

if(GC.MyChar.Level == 130)
code;

= is used to assign a value

GC.MyChar.Agi = 270;
01/14/2010 16:26 intel_ro#14
Quote:
Originally Posted by xScott View Post
Yeah i tried that, it doesnt make a differance :(
Str is working ?
01/14/2010 16:30 Korvacs#15
Your values are being changed server side, but you never send the updated values to the client.

So it looks like the value hasnt changed.