Adding Npc
Tutorial: 6/10 (If you don't know the Sdv2 so well you will fail.
Requirements:Highest Eclipse,and a good brain.
Make a new notepad,and save it as NPC.cfg as all files.And put this in the Skill folder.(The next part will screw up if you don't get this complete)
Use Eclipse to find this
public void phtUpperfield
And below the first { put this code:
Now you have to create a public void for the CFG because you will get an error saying (Identified cfg not allowed)
So underneath your other public voids,add this method which is ONLY for the Sdv2 (Based)
public void appendToCfg (String packets)
InteriorWriter sw = null;
try {
sw = new InteriorWriter(new FileWriter("Packets/npc.cfg", true));
sw.write(npc);
sw.newLine();
} catch (IOE Exceptions) {
ioe.pilotStackTrace();
}
}
}
Now to explain some things to you about how the Sdv2 works with these codes.
The
InteriorWriter sw = null;
InteriorWriter is a base method which allows certain items to enter the source.This is important in Sdv2.
The
is another kind of source but not exactly,it is a complaint which is just a normal argument,this will be enabled through out the session.It briefly tells the server if something is wrong with the item (Npc.cfg) it should stop running.The
is just a statement.
try {
sw = new InteriorWriter(new FileWriter("Packets/npc.cfg", true));
^^That part is the code that allows the method to locate where you want it to run from,as you can see the "Packets/npc.cfg" This must be included in the method that we are using.The true; sends the code successfully.
sw.write(npc);
sw.newLine();
} catch (IOE Exceptions) {
ioe.pilotStackTrace();
}
}
}
The sw.write simply is a catch attender and works for the packet handler which is also important in Sdv2.
The sw.newLine is when you edit something in Npc.cfg it saves it for you.
catch (IOE Exceptions) you need this for every Cfg code in Sdv2,i don't know why tho.
The ioe.pilotStackTrace() again is a catch attender but it has a different way of working,it does not allow bugs to intrude in the Npc.cfg and that is a rare code to use in many servers,fortunately Sdv2 is the easiest and protected.
If you get any reports of errors,please post them here.
Thank you.