Anyway, back to business.....
Look in Lib/AnmSets for file KnightAnimationSet.py. Copy/paste it to
your NUFiles/NUDaveStuff folder (As you add these files, update the BLModInfo.py. Keep the same folder structure).
Rename the file 'NUDaveAnimationSet.py' and open it. Now comes the really tedious bit. Start at the top. Alter the function name to
(alter the 'print' statement if you like)
The first anim is Rlx_no This is the animation the char will do when standing doing nothing with no weapon in hand. You need to alter all
instances of 'Kgt' to 'Kga', EXCEPT where it comes before the extension .BMV. These files contain animation info. Because you are basing 'Dave' on Sargon's animation set, you still need to reference these. What you are doing here is assigning them to your new race.
Lastly, on the first line of each code block there is a 1 (sometimes a 0) After all these 1s and 0s add ,Knight_A. Like this:
Code: Select all
Now work your way down the file altering as you go. The file is very long and you will probably loose the will to live about halfway down.[|)]. As you go, try to guess what each anim is for.
Kgt_rlx_vt = very tired [B)]
Now just to make things awkward some blocks of code are written differently.[}:)] they begin:
Do these like this:
Copy the whatever bit (not the quotes"")
Paste it into the filepath to replace"+ anm_name + .Paste over the first quote but leave the second. The end should look like this:
Now alter the anm_name= "Kgt......etc" to "Kga.....etc
If you are clever, you could try using the search/replace feature. It is tricky as you have to be selective. When you get to the death animations you are near the end of the file. (You will probably feel like death when you reach here.[|)][|)][|)])
Alright, thats the AnimationSet made. Next Biped action.[:p] Look in Scripts/Biped for KgtBAct.py. Copy it across as before. Rename your copy 'NUDaveBAct.py'.
Open it and swap 'Knight' for 'Knight_A' and 'Kgt' for 'Kga'.
This time you can use search/replace. Take a moment to study this file so that you get some idea of whet each anim does. e.g
Attack_f_1h = moving forward in combat mode with one-handed weapon but no shield.
D_b = Dodge back
hurt_head = guess what! [B)]
Next file Combos. Copy KgtCombos.py from Scripts/Combos. Rename your copy 'NUDaveCombos.py'
Replace 'Knight' with 'Knight_A'
Replace 'Knight_N' with 'Knight_A'
Replace 'Kgt_N' with 'Kga'
Replace 'kgt' with 'kga'
Lastly, NuAnmFact.py. Make a file of this name and save it to the NUFiles Folder (Not in The NUDaveStuff folder) This file sets the timing of some animations. If you happen to have some new NPC races they can share this file.
Open the file Lib/AnmFact.py and copy the entire function 'AnmFactKnight' to your file (import Bladex at the top)
Rename the function 'AnmFactDave', then change all the instances of'Kgt' to 'Kga'. The values at the end denote the time of the animation. Now you may think that if you increase the value, the animation will be slower, but in fact it works the other way. Increase values to speed up animations.[;)]
Ok add this file to list in BLModInfo.py with the others so that it is installed in the right place.
There is still more to do before Dave will operate, but that is the basic work done.[:D]
Before you can test Dave out, you need to give him some sounds.
Look in Scripts folder for file AniSoundKght.py. Copy it across to NUFiles folder. Rename it 'ExtraAnimSounds.py' This file contains one big function 'AsignarSonidosCaballero'. Change this to 'AsignarSonidosDave'. Now another boring exercise. Go the file and
change all the 'Kgts' that come directly after per, to 'Kga'. Don't alter the others such as 'AndarKgt1'. At the moment you are just giving Dave Sargon's sounds. (You'll see that Sargon also shares a few sounds with Tukaram.) Later, you can create and assign any sounds you wish to personalise Dave.
Ok. Now make a file 'PlayerTypes.py. Put it in the inner MyMap folder with the rest of your main files. this file will contain a sub-class of the 'PlayerPerson' class.
Code: Select all
That's all you need for now. If you have made Dave a custom skin you can omit the MeshName line.
Open your pj.py file.
At the top you need:
import NUDaveData (in place of import SuperZoeData)
Change the PlayerName in the last elif clause from SuperZoe to Dave.
Below this , I put in a little failsafe clause that checks that the Knight_A model has been installed. Alter the filepath to Kgt_AInst.cfg. You can alter the starting weapons at this point.
Lastly, at the end of the file change the if clause:
Code: Select all
if PlayerName == "Dave":
Finally, open ActorsInit.py and add
This is purely a savegame thing. ActorsInit file is exe'd early in the savegame load routine. As he is a new char Dave needs his data loaded before the savegame re-creates him. This principle also applies to new weapons. (Check out ProsperoArena3 ActorsInit File)
You should now be able to use Dave in your map. Load the map and try
him. I should mention at this point that if he works first time with no problems then you are indeed Ianna's Chosen One.[^] You will probably have a bit of de-bugging to do. There are 1000s of lines of code involved so the possibility of errors is quite high.
After you do get him working, there are a few refinements you can add:
As he is, the FX on combo's won't work and you won't get the New Attack messages. For these you need to make new files and add stuff to the Player class. Refer to ProsperoArena3 to see how these work. In fact, if you have any probs, refer to this map.
Once you have Dave working, he will have the same abilities as Sargon.
Next I'll go into how to customise him.
btw. You can in theory use any char as a Player. I used the Knight as an example purely because he already is fully functional as a Player.
NPCs have lots of animations missing as they never need to open doors and pick stuff up,etc. If you use a Traitor Knight as a Player for instance, using his own animation set, you can walk him round OK but
lots of moves will be missing. You have to add the missing animations
by borrowing suitable ones from other chars. All the 'human' types (they have 25 nodes in the structure) will share animations and there are LOTS to choose from. Other chars (Dal for one) will not carry weapons on their backs. Non-Humans (Minos, Demons) have a diffrent number of articulations in their structure and will not use human animations.
What to do with new Player now you have got one.[8D]
Almost anything.[:0] Now you have a complete set of files dedicated to the new char you can edit all aspects of the behaviour without affecting the other chars.
You can replace animations with those from other chars or add attacks
of other chars.
As 'Dave' was based on a Player char, he already has all the attacks bound to keystrokes. If he were say, a Traitor Knight all this code would be missing as well as many animations. You need to borrow anims from other chars. Simply find an anim in the relevant animation set and c/p it into Dave's animset. Edit the move name so that it reads 'Kga' instead of 'Dwf' or whatever. Add 'Knight_A on the end as with all the others. Then you must add it to the DaveBAct.py file.
If it is an attack you must add it to the DaveAnm_def.py. (again c/p
from source Anm_def.py and edit name) Add to NUDaveCombos.py. Look at the rest of the file to see how it should be implemented. (This is the most complex file to do.) Lastly you may need to add it to NUAnimFact.py to set the right speed. This isn't always required, but if your char does a move very slowly you can be sure it does.
There is also the sounds of the animations to consider. Look in the NUAnimSounds.py to see how they work. Each animation has several sounds bound to it. The numbers at the end of each line set the time from the start of the anim that the sound will play. The actual sounds are created in another file (AniSoundCharType+'X') These are imported with the statement
from AniSoundCharTypeX import *
You can import more than one file of this type if necessary, or better, pick sounds from multiple files and make your own AniSoundDaveX.py.
There are many things you can do to customise your char. Too many in fact for me to go into here. When I did the SuperZoe attacks I first removed all the existing ones and then added the complete set one at a time, starting with the basic 1-handed sword attack. (Testing after each new one was added). NUSuperZoeCombos.py is a good file to use for reference.[8)]
All her Spear moves are original
1Hand swords/maces are various Knight moves, but where the Knight will use Dwarf weapons with less skill, S.Z. uses them as well as Dwarf.
2Hand Swords all Barbarian.
(I didn't implement the 2Hand Axe moves, but I have 'taught' them to NPC Dwarfs.)