Introduction to AIP
Buff Bot (custom NPC)
Tools you will need.
AIP editor
IFO editor
STB/STL editor
LTB editor (if you want your NPC to speak)
Down to basics.
First of all what is AIP?
AIP is a system of coded instructions that rose uses to tell all teh monsters and NPCs in the game what they should do.
It is parsed by both the server and the client (although each of them uses different parts of the code) every few seconds. In the case of NPCs it is much longer though, typically a minute or so.
For making a Buff Bot NPC we are only going to use a few of the conditions and actions that are available to us so the AIP won't be all that complicated.
Our Buff Bot NPC is going to stand around looking pretty then every few minutes ( I am setting this to a minimum of 20 cycles but you can modify this if you like) she will be giving away free buffs to everyone in range.
Before we can get to the AIP though, we have to do all this other crap so please bear with me a bit longer.
first steps
First thing we are going to have to do is to make oursleves a custom NPC. I am going to put this one in Zant and make her stand a little way up from Judy at the north end of the main plaza. he will be pretty much facing Spero. Should be a nice easy place to access to get buffs.
I am not focusing on how to add a custom NPC. This tutorial will skip over all but the essentials of that so if you want a little more detail on that you should go read this tutorial on the subject.
Files you need to edit to add the NPC
3ddata\STB\LIST_NPC.STB
3ddata\STB\LIST_NPC_S.STL
3ddata\NPC\LIST_NPC.CHR
Ok so what NPC should we copy to make our Buff Bot. You can use any one you like. I'm going to use the Lena and call her "[Kuro-Tejina Staff] Buffy" but you can call use whatever you like. Buffy will be joining the ranks of Kuro-Tejina staff who work on my KTRose pre-evo server
First thing to do is open LIST_NPC.STB so go ahead and open the file in an STB editor. (I'm using my Excel utility but you can use any)
NPCs start around line 1000 so scroll down to that area and find all the NPCs that are in Zant. They should be the first block of entries.
Find an open line at the end of the block and remember the line number. This is important. It will become your NPC's ID number from now till the end of time in your server.
Now go find the entry for Lena It should be on line 1014
Copy the entire entry into your chosen empty line at the end of the block of Zant NPCs. This is row 1024 in my server but it may be different in yours.
It should look something like this now.
Note that I highlighted the value in the AI column. That is the reference to the AIP file that we are going to use so we are going to have to change it a bit later because it still points to the Angel's AI right now.
I also changed his name in the name column. It won't come through in the game that way though. We need to edit the STL that goes along with it.
First of all (Still in the STB) scroll across to the right until you reach the column with the STL reference values. It currently says LNPC1014 which is wrong.
I just placed Buffy into row 1024 so I'm going to change the value to LNPC1024
If you put it in a different row then use the id from whatever row you put it in.
Don't save the STB yet. We have a way to go yet.
Now go to the STL tab (or use a stand alone STL editor) and open LIST_NPC_S.STL
Add this entry.
I inserted the line into the editor in the middle right after entry LNPC1023 but you can actually put it any place you like.
Caution.... If using my Excel editor make sure you scroll to the bottom of the file and make sure that there is a number next to the last entry in column 2. Inserting in Excel shifts the cells downward by one line and this sometimes leave a row without a reference. My editor might not save the last row if you miss this step.
Also you can ignore the "Dark Fairy" entry. that's just another custom NPC that we are adding at KT Rose
OK you are done with the STL. you can save it and put it back into your client with your VFS editor now.
Now back to the STB.
We still need to figure out what AIP file we are going to link it into. It's still pointing at a blank space which is completely wrong. Lena has no AIP apparently
So how do we figure this out?
Well there is an STB file called FILE_AI.STB that tells us which AIP files to associate with which numbers in LIST_NPC.STB.
If you are using my editor, it isn't possible to open multiple instances so go ahead and save the STB that we are working on but don't put it into your client's VFS yet. We still need to come back to it yet.
now open FILE_AI.STB and scroll down to row 211. it should point to 3DDATA\AI\NPC_1020.aip which is the last NPC before the one we are adding.
On the row immediately after this we can add our new entry 3DDATA\AI\NPC_1024.aip Note: I made the name of the AIP file reference the same as the NPC id number from LIST_NPC.STB. This isn't strictly necessary but it does make it easier to keep track of things.
FILE_AI.STB should now look like this
Go ahead and save the STB then put it into your VFS with your editor. We are DONE with this one.
NOTE: You also need to add this file to your server or your new AIP file won't work
Now back to LIST_NPC.STB. Re-open the file and go to the new entry that we added earlier.
Go to that entry for the AI that i ringed earlier and change it to point to the row in FILE_AI.stb where we just added the new entry. in my example this went into row 212 so i am going to put 212 in that cell instead of the 236 that is currently there.
That's it for LIST_NPC.STB. Save it and add it back into your client and server. It will need to be in both
Finally we need to tell the client which bones images and animations to display for our new NPC so open 3ddata\NPC\LIST_NPC.chr with maxxon and Sethanye's wonderful little CHR editor.
Put 1024 (the id of our new NPC) into the "Entry" window at the top right then click "jump to"
All the stuff down the right will now be empty
In the next box down on the right where it says Entries type in 1014 (the id of Lena who we are copying) then click the Copy button
All the stuff will appear just as shown in the picture
Save the file and put it back into your client. We are DONE with this one.
One last thing we need to do to make our NPC show up and that is to add her into the database.
So open up your database editor (Navicat, phpmyadmin or whatever floats your boat)
Open table list_npc and get ready to make a new entry at the bottom of the list.
In the Name field put your NPC's name. Mine is [Kuro-Tejina Staff] Buffy as I've already told you. You can call yours Barbara Buffer if you like.
In the type field put 1024. this is the NPC ID number. If you put your NPC at a different row in LIST_NPC.STB then use the row number.
In the map field put 1. this points to Zant
In the dir field put 185. this is the direction that your NPC will face. 185 makes her face toward Spero
In the x field put 5226. This is the NPC X coordinate
In the y field put 5218. this is teh NPC Y coordinate
In the Dialog field leave as zero. We don't have any dialog for this NPC right now and if we ever put any in, it will be a different tutorial completely.
Save your table
And of course we need a skill or two for our little Buffy to actually cast.
There are very few ready made that will do what we want so let's go make a new skill.
Open up LIST_SKILL.STB in the STB editor of your choice and scroll down till you find the GM buff skills.
Unfortunately the format of LIST_SKILL.STB is very different in evo servers than it is in pre-evo or irose. I'm going to show you how to do it for Pre-Evo / irose but I think that it should work for evo also. let me know if it doesn't.
Pre-evo / irose
Your GM skills should start at row 3201 so scroll down to there and take a look around. You should find a block of skills labelled LSKILL3201 to LSKILL3221
We need the one that puts up Attack Power and Accuracy.
In pre-evo this is 3202
What I'm going to do is copy the entire row 3202 and paste it at row 3230. that's going to be the new skill that we are going to set up our buff bot to use.
First though we need to make some alterations because the GM skill isn't going to work the way it is set up right now.
here is what I did with mine
Only the places that i marked in red really need to be changed at all.
First level skill ID should be set to the same as your skill id
Target needs to be changed to 7 so that it will point to all characters
Skill type needs to be 10 (AOE BUFF)
Cost type and amount are deleted entirely as there is no point charging an NPC MP to use a skill.
I also reduced the range a bit but that is not absolutely necessary.
Now finally we get to the AIP.
First thing you need to do is download my AIP editor.
This is a slightly newer version with a few more bugs fixed so even if you already grabbed the one i posted in the tools list, this supersedes it.
I'm including a simple AIP file that I made for this also
This file will make your buff bot fire off one instance of skill 3230 every 20 minutes or so.
Sorry but getting this working and all written up here has taken longer than i thought it would so I'm going to have to leave it here and come back to the actual AIP editing tomorrow.
One last thing to note (and it's a biggy)
This buff wot WILL NOT WORK on any of the current osrose servers
None of them currently have code to handle NPCs casting skills.
rev 81 dev rev could be adapted very quickly and easily though. I will pass on my code to Lmame so that he can add it.
OsProse is also pretty close but will require a few modifications to get it working. I have this all working on my own private server after having made the necessary changes today. will get it up onto the SVN...... eventually
Osirose is miles away I think.
Should work fine on Arc files as they stand.
Anyway. AIP tutorial and instructions will follow tomorrow if i get time to write it up