PDA

View Full Version : About puppets (as requested)


stoffe
08-26-2005, 06:01 AM
second, i could really use a good puppet tutorial for a mod im about to start work on


Since it was off-topic in the thread it was originally posted, I'll post my attempt at a puppet tutorial here instead as you requested.

As said, making a puppet is not very complicated, but I tend to be notoriously long-winded in my explanations. Anyway, here is my attempt at explaining it. :)

There are essentially two steps to it, preparing your Puppet creature template, and doing the scripts that will turn it into a working party puppet. So:


1. MAKING THE PUPPET UTC:

Create a new creature template, or modify and existing one. You will need KotorTool and a GFF Editor for this. Set the Tag and Resref of something descriptive, I'll use st_puppet1 in this example.

Set the faction number to 23, which is the puppet faction. This will make the Puppet attack hostile creatures, but hostile creatures will not attack it directly.

Give the puppet all the feats and, if its a force user, force powers it should know, and assign it a class. Give it the ability scores it should have. Equip the weapons and items you want your puppet to carry. Make sure you set everything to be Undroppable.

In this example we want the puppet to increase in strength along with the party, so set the level in the template to something low, like 1 or 2. Also set the hitpoints to something low, no more than 15 unless you want it to end up with an insane amount of health in-game. Since the saving throws and Defense also will be automatically adjusted, don't give any Save of Natural AC bonus unless you want your puppet to be near unbeatable.

Next assign it the party member set of AI scripts, those which begin with k_hen_ rather than k_def_ which most other creatures use. Most of those scripts should work fine for a puppet too, but we'll need to make a custom Heartbeat script for it. More about that below.

So, with everything set up, you might end up with a creature template (UTC file) that might look something like:


Basic:
Name: Bastila the Puppet
Tag: st_puppet1
Race: Human
Appearance: Party_NPC_Bastila
Conversation:

Statistics:
Strength: 12
Dexterity: 18
Constitution: 16
Intelligence: 10
Wisdom: 14
Charisma 16
Save bonuses: 0/0/0
Natural AC: 0
Base Hit Points: 14
Current Hit Points: 14
Max Hit Points: 14

Advanced:
Template Resref: st_puppet1
Faction: 23
Challenge Rating: 3

Class:
Alignment: 70
Class: Jedi Sentinel
Level: 2

Scripts: (Leave all unmentioned slots blank)
OnHeartbeat: st_ai_puppethb
OnNotice: k_hen_percept01
OnAttacked: k_hen_attacked01
OnDamaged k_hen_damage01
OnEndRound: k_hen_combend01
OnDialogue: k_hen_dialogue01
OnSpawn: k_hen_spawn01
OnBlocked: k_hen_blocked01
OnUserDefine: k_hen_userdef01


Save the template with a filename matching your Template Resref, in this example the filename would be st_puppet1.utc. Now open this file in your GFF Editor. I will use K-GFF in this example.

Find the field called MultiplierSet inside the top-level struct. If it doesn't exist, right-click on the toplevel STRUCT and choose Add field: BYTE in the popup-menu, and set the Label to MultiplierSet in the panel to the right. Set the value of this field to 2. This will make the puppet go up in level along with your party, but not make it insanely powerful. The MultiplierSet field is used by the game's autobalancer functionality to adjust the strength of NPCs according to the level of the Exile. This is why you left the Health and Level so low previously.

Next, find the field called IgnoreCrePath. If it does not exist, add it as a BYTE field just like for the MultiplierSet field. Set this field to 1. This will make the creature incorporeal, making it possible to walk right through it. While it may look a bit silly it eliminates the annoyance of the puppet getting in the way in narrow corridors or in the heat of battle.

Save your modified UTC file and put it in the Override folder. Next you'll have to create the scripts that make it into a puppet, and implement the st_ai_puppethb script that was set as OnHeartbeat script above.


2. MAKING THE SCRIPTS:

First we need to create a custom OnHeartbeat script for the puppet to make it follow its owner around. The standard party heartbeat script will only make party members follow, not puppets. Above I called this script st_ai_puppethb, and it should look something like:


// ST: st_ai_puppethb.nss
#include "k_inc_generic"

void main() {
object oEnemy = GetNearestCreature(
CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN,
OBJECT_SELF, 1,
CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY,
CREATURE_TYPE_IS_ALIVE, TRUE
);

if (!GN_GetSpawnInCondition(SW_FLAG_AI_OFF)) {
if (GetIsPuppet()
&& (GetIsObjectValid(GetPUPOwner())
&& (GetCurrentAction(OBJECT_SELF) != ACTION_MOVETOPOINT)
&& (GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOWOWNER)
&& !GetIsConversationActive()
&& !GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE)
&& GetCommandable()
&& (GetDistanceBetween2D(OBJECT_SELF, GetPUPOwner()) > 3.0)
&& (!GetIsObjectValid(oEnemy) || (GetDistanceBetween(oEnemy, OBJECT_SELF) > 20.0))))
{
ClearAllActions();
ActionFollowOwner(2.0);
}
}

if (GN_GetSpawnInCondition( SW_FLAG_EVENT_ON_HEARTBEAT ))
SignalEvent(OBJECT_SELF, EventUserDefined(1001));
}


This script essentially checks if the creature is a puppet with an owner assigned, that it isn't already following, that its AI hasn't been disabled, that it's more than 3 meters from its owner and that there are no enemies nearby. If all those conditions are met, the puppet will begin to follow its owner around.

If you aren't good at scripting, feel free to use the above script for your puppet. There shouldn't be any need to modify it.

In order to compile that script and produce the NCS file the game can use, you must extract the include files k_inc_generic.nss, k_inc_gensupport.nss, k_inc_walkways.nss and k_inc_drop.nss. You can find these files with KotorTool in Kotor II --> BIFs --> scripts.bif --> Script, Source. Extract them and save them in the same folder where you have the nwnnsscomp.exe script compiler.

Next you will have to make a script that turns your creature into a Puppet and assigns it to a party member. For those who aren't good at scripting I've made a function, ST_GivePuppet() that contains all that is necessary to accomplish this. The following example contains the function and an example of its use:


// -------------------------------------------------------
// Support function: Assign a puppet to a party member
// -------------------------------------------------------
void ST_GivePuppet(int nNPC, int nPUP, string sTemplate) {
string sTag = "";
switch (nNPC) {
case NPC_ATTON: sTag = "atton"; break;
case NPC_BAO_DUR: sTag = "baodur"; break;
case NPC_CANDEROUS: sTag = "mand"; break;
case NPC_G0T0: sTag = "g0t0"; break;
case NPC_HANDMAIDEN: sTag = "handmaiden"; break;
case NPC_HK_47: sTag = "hk47"; break;
case NPC_KREIA: sTag = "kreia"; break;
case NPC_MIRA: sTag = "mira"; break;
case NPC_T3_M4: sTag = "t3m4"; break;
case NPC_VISAS: sTag = "visasmarr"; break;
case NPC_HANHARR: sTag = "hanharr"; break;
case NPC_DISCIPLE: sTag = "disciple"; break;
}

object oOwner = GetObjectByTag(sTag);
if (GetIsObjectValid(oOwner) && IsObjectPartyMember(oOwner)) {
location lLoc = Location(GetPosition(oOwner) + AngleToVector(GetFacing(oOwner)) * 2.0, GetFacing(oOwner)-180.0);

AddAvailablePUPByTemplate(nPUP, sTemplate);
AssignPUP(nPUP, nNPC);
object oPUP = SpawnAvailablePUP(nPUP, lLoc);
AddPartyPuppet(nPUP, oPUP);

SetNPCAIStyle(oPUP, NPC_AISTYLE_PARTY_SUPPORT);
}
}


// -------------------------------------------------------
// Main function: Example, call above function to assign
// a puppet in st_puppet1.utc to Kreia.
// -------------------------------------------------------
void main() {
// Spawn the "st_puppet1" UTC as a puppet, assign it to Kreia
ST_GivePuppet(NPC_KREIA, PUP_OTHER1, "st_puppet1");
}


This script would add a creature made from the template created above to the Puppet table, assign it as a puppet to the creature occupying Kreia's slot in the Party table, spawn it into the game and make it an active puppet. It also sets it to use the Party Support AI, which will make a force using puppet use its force powers.

Confusing? Here are a few clarifications:

The Puppet table is a special table within the game that can store creatures. Creatures added to the Puppet table will be globally saved in the savegame, and as such can move between areas. All standard creatures, except the player character, Puppets and Party members are stuck in the area they were spawned in.

The puppet table has 3 slots, indexed from 0 to 2. Bao-Dur's Remote already occupies the first slot, but the two others are vacant and can be used by modders. For simplicity, the game has 3 constants declared to specify puppet table indexes:
PUP_SENSORBALL = Slot 0, occupied by Bao-Dur's remote.
PUP_OTHER1 = Slot 1, vacant;
PUP_OTHER2 = Slot 2, vacant;

These index constants can be used to add a creature to the puppet table, or to retrieve a creature that has been stored there. In our example, AddAvailablePUPByTemplate(PUP_OTHER1, "st_puppet1") would have added our custom creature to the second slot (index 1) in the puppet table.

Just adding a creature to the Puppet Table is not enough to make it into an actual puppet however. To do that it will first have to be linked to an Owner. The owner is defined by providing an index to a slot in the Party Table.

The Party Table is, like the puppet table, a special table that can store creatures globally, allowing them to move between areas. The party table contains 12 slots, indexed from 0 to 11, and is where everyone that has joined your party is stored. For simplicity, the game has a set of index constants defined to make accessing the slots in the party table a bit more intuitive to humans:

NPC_ATTON = Slot 0, usually occupied by Atton Rand;
NPC_BAO_DUR = Slot 1, usually occupied by Bao-Dur, though B4D4 and the Remote use it on two occasions;
NPC_CANDEROUS = Slot 2, usually occupied by Mandalore.
NPC_G0T0 = Slot 3, usually occupied by G0T0.
NPC_HANDMAIDEN = Slot 4, usually occupied by the Handmaiden.
NPC_HK_47 = Slot 5, usually occupied by HK-47.
NPC_KREIA = Slot 6; usually occupied by Kreia.
NPC_MIRA = Slot 7, usually occupied by Mira.
NPC_T3_M4 = Slot 8, usually occupied by T3-M4.
NPC_VISAS = Slot 9, usually occupied by Visas Marr.
NPC_HANHARR = Slot 10, usually occupied by Hanharr.
NPC_DISCIPLE = Slot 11, usually occupied by the Disciple.

Note the reoccurring word usually. You assign a puppet to a Party Table slot, not directly to a party member creature. If another creature occupies one of the party table slots, such as one from a 3rd party recruitment mod, your puppet will get assigned to that creature instead.

You have also probably noticed that your main player character is missing from the Party Table. This character is handled separately and is not stored in the party table. This means that you cannot assign a puppet to the Exile. Only party members can have puppets.

This also means that if your puppet owner gets assigned as the temporary main character (such as being the lead on G0T0's yacht, Mira, Atton or T3 on their solo adventurers, or the Group leader in the Dxun Tomb), their puppet will vanish until they return to being a normal party member again.

Back to the script posted above. The custom function ST_GivePuppet() takes 3 parameters. The first is the party table slot of the one you want to be the puppet owner. The second is the puppet table slot you want to assign your puppet to. The third is the Resref of the creature template we created above. So:

ST_GivePuppet(NPC_KREIA, PUP_OTHER1, "st_puppet1");

...would assign the puppet to Kreia, store it in the first free puppet slot, and use the creature in st_puppet1.utc as the puppet.

If you want to use the above script, modify the ST_GivePuppet() call in the main() function to change the st_puppet1 template into the one you use for your creature, change NPC_KREIA to the party table slot of your intended puppet owner, and if you have more than one puppet, change PUP_OTHER1 to PUP_OTHER2 for the second one. The compile your script and put in override.

In order for that script to work, your intended puppet owner must be in the active party when the script is run. As such a good place to run the script would be as part of the script that makes the NPC in question join your party.

Once you have run this script, the Puppet will appear whenever its Owner is added to the party, and will follow you around. If you transition to a new area, the puppet will follow. If the puppet is killed in battle, it will reappear at full health when you either transition to another area or remove and re-add its owner to the party.



OPTIONAL: GENERIC SCRIPTING EXPLANATIONS:

In more general terms, key scripting functions useful for handling puppets are:

AddAvailablePUPByTemplate(int nPUP, string sTemplate)
This function adds a creature, created from the template whose resref is specified in the sTemplate parameter, to the puppet table slot specified by the nPUP parameter. The puppet creature does not have to exist in the game world yet for this to work. This will not turn the creature into a puppet. It will merely add it to the puppet table so it can later be turned into a puppet.

AddAvailablePUPByObject(int nPUP, object oPuppet)
A variant of the previous function, this will use a creature that already exists in the game world and add it to the party puppet table. oPuppet is the object to "puppetize", and nPUP is the puppet table slot to add it to.

AssignPUP(int nPUP, int nNPC)
This function assigns the puppet in the puppet table slot nPUP to the party member in party table slot nNPC. One of the AddAvailablePUP... functions above must have been used before calling this, and the Owner must be a member of the player's party.

SpawnAvailablePUP(int nPUP, location lLocation)
This spawns the creature stored in the puppet table slot nPUP into the game world at the coordinates indicated by lLocation.

AddPartyPuppet(int nPUP, object oidCreature)
This adds the creature in puppet table slot nPUP as an Active party puppet. This will make it appear whenever the owner is added to the party, and make it follow when moving between areas. For this to work the creature must have already been added to the puppet table with one of the AddAvailablePUP... functions, assigned an owner with AssignPUP(), and spawned into the area with SpawnAvailablePUP(). The oidCreature must be set to this spawned puppet creature.

GetPUPOwner(object oPUP)
This function returns a reference to the creature that is assigned as owner of the puppet specified by the oPUP parameter.

GetIsPuppet(object oPUP)
This function returns TRUE if the object set in the oPUP parameter is a party puppet.


ActionFollowOwner(float fRange)
This function will make the object running it follow its assigned owner at fRange meters distance. The creature must be a puppet and have an owner assigned, or this action will do nothing.

ChAiNz.2da
08-26-2005, 06:12 AM
Thank you for re-posting this stoffe! This will help out so many of us :)

I've taken the liberty of adding this to the General Tutorials & Tools Sticky (http://www.lucasforums.com/showthread.php?t=151438) for preservation & prosperity :D

TheOssusKeeper
08-26-2005, 06:14 AM
long winded or not... you did a bang-up job on it... kudos and thanks... :thumbsup:

Commas
08-26-2005, 01:16 PM
Thank you thank you thank you!!!

don't worry, i PROMISE this will be put to good use!

Jackel
08-26-2005, 04:35 PM
Commas isn't the only one wanting to put this to good use Stoffe, I am thinking I will play around with puppets now aswell.

Darth InSidious
08-26-2005, 08:44 PM
Thank you! Serious kudos! :)

llars
08-28-2005, 07:03 AM
I am getting a ton of script errors on the two scripts when I try to compile them. A copy of the errors is below



'Star Wars: Knights of the Old Republic' Script Compiler/Decompiler
based on 'NeverWinter Nights' Script Compiler/Decompiler
Copyright 2002-2003, Edward T. Smith
Modified by Hazard (hazard_x@gmx.net)

Compiling: k_inc_drop.nss
File is an include file, ignored
Compiling: k_inc_generic.nss
File is an include file, ignored
Compiling: k_inc_gensupport.nss
File is an include file, ignored
Compiling: k_inc_walkways.nss
File is an include file, ignored
Compiling: st_ai_puppethb.nss
st_ai_puppethb.nss(13): Error: Undeclared identifier "GetIsPuppet"
st_ai_puppethb.nss(14): Error: Undeclared identifier "GetPUPOwner"
st_ai_puppethb.nss(14): Error: Required argument missing in call to "GetIsObject
Valid"
st_ai_puppethb.nss(16): Error: Undeclared identifier "ACTION_FOLLOWOWNER"
st_ai_puppethb.nss(20): Error: Undeclared identifier "GetPUPOwner"
st_ai_puppethb.nss(20): Error: Required argument missing in call to "GetDistance
Between2D"
st_ai_puppethb.nss(25): Error: Undeclared identifier "ActionFollowOwner"
Compilation aborted with errors
Total Execution time = 219 ms

Press any key to continue . . .



'Star Wars: Knights of the Old Republic' Script Compiler/Decompiler
based on 'NeverWinter Nights' Script Compiler/Decompiler
Copyright 2002-2003, Edward T. Smith
Modified by Hazard (hazard_x@gmx.net)

Compiling: k_inc_drop.nss
File is an include file, ignored
Compiling: k_inc_generic.nss
File is an include file, ignored
Compiling: k_inc_gensupport.nss
File is an include file, ignored
Compiling: k_inc_walkways.nss
File is an include file, ignored
Compiling: p_mira_puppet.nss
p_mira_puppet.nss(2): Error: Syntax error at "if"
p_mira_puppet.nss(5): Error: Syntax error at "AddAvailablePUPByTemplate"
p_mira_puppet.nss(8): Error: Syntax error at "AddPartyPuppet"
Leaked PStackEntry (h:\programmieren\vc7\gametools\kotor\nwntools-1.2\_nsclib\ns
ccontext.cpp,230)
Leaked PStackEntry (h:\programmieren\vc7\gametools\kotor\nwntools-1.2\_nsclib\ns
ccontext.cpp,230)
Leaked PStackEntry (h:\programmieren\vc7\gametools\kotor\nwntools-1.2\_nsclib\ns
ccontext.cpp,230)
Leaked PStackEntry (h:\programmieren\vc7\gametools\kotor\nwntools-1.2\_nsclib\ns
ccontext.cpp,230)
Leaked PStackEntry (h:\programmieren\vc7\gametools\kotor\nwntools-1.2\_nsclib\ns
ccontext.cpp,230)
Leaked PStackEntry (h:\programmieren\vc7\gametools\kotor\nwntools-1.2\_nsclib\ns
ccontext.cpp,230)
Leaked PStackEntry (h:\programmieren\vc7\gametools\kotor\nwntools-1.2\_nsclib\ns
ccontext.cpp,230)
Leaked PStackEntry (h:\programmieren\vc7\gametools\kotor\nwntools-1.2\_nsclib\ns
ccontext.cpp,230)
Leaked PStackEntry (h:\programmieren\vc7\gametools\kotor\nwntools-1.2\_nsclib\ns
ccontext.cpp,230)
Leaked PStackEntry (h:\programmieren\vc7\gametools\kotor\nwntools-1.2\_nsclib\ns
ccontext.cpp,230)
Leaked PStackEntry (h:\programmieren\vc7\gametools\kotor\nwntools-1.2\_nsclib\ns
ccontext.cpp,230)
Leaked PStackEntry (h:\programmieren\vc7\gametools\kotor\nwntools-1.2\_nsclib\ns
ccontext.cpp,230)
Leaked PStackEntry (h:\programmieren\vc7\gametools\kotor\nwntools-1.2\_nsclib\ns
ccontext.cpp,230)
Leaked PStackEntry (h:\programmieren\vc7\gametools\kotor\nwntools-1.2\_nsclib\ns
ccontext.cpp,230)
Leaked PStackEntry (h:\programmieren\vc7\gametools\kotor\nwntools-1.2\_nsclib\ns
ccontext.cpp,230)
Leaked PStackEntry (h:\programmieren\vc7\gametools\kotor\nwntools-1.2\_nsclib\ns
ccontext.cpp,230)
Compilation aborted with errors
Total Execution time = 109 ms

Press any key to continue . . .

stoffe
08-28-2005, 07:15 AM
I am getting a ton of script errors on the two scripts when I try to compile them. A copy of the errors is below

Sounds like you don't have the TSL-version of nwscript.nss in the same folder as the compiler.... Or, if you are using the more recent compiler, aren't telling it to compile the script for TSL.

In the first case, extract nwscript.nss from Scripts.bif with KotorTool into the folder where nwnnsscomp.exe is, correct the error described here (http://64.20.36.211/showthread.php?t=146472) if necessary.

In the second case, use the commandline flag that tells the compiler to use the TSL file, like:
nwnnsscomp.exe -c -g 2 filename.nss

Judging by the header of the compiler output you posted I think you have a fairly old version of NWNNSSCOMP though. I'd recommend using one of the versions that came with KotorTool instead.

llars
08-28-2005, 07:23 AM
Just figured it out a minute ago after looking at the scripting tutorial. I had to add the -v1.00 to the command line. Funny thing is, the other scripts I have compiled worked fine.

Thanks for the tutorial.

TheMitten9
09-30-2005, 05:18 PM
Hello, I'm not very familiar with this stuff (just starting learning how to mod yesterday ;p) and was hoping I could get some help. Before I do, though, thanks so much for all the help files and tutorials - they have helped tremendously.

My question is in regards to this specific tutorial. To start out I am doing it exactly as the tutorial shows, then once I know I can do it right I'll make some custom changes for a differnet pet for a different slot, ect.

To jump to my question, following this tutorial will result in a three files being made/compiled and moved to the override folder. Those files are st_puppet1.utc, st_ai_puppethb.ncs, and a third ncs file that does not have a specified name. If that is correct, then what do I need to save the .nss as in order to compile it and move it to the override folder? Also, do I compile the 2nd .nss file with the same 4 .nss files that I compiled st_ai_puppethb.nss with?

If it matters, I am using notepad to create the scripts.

stoffe
09-30-2005, 06:16 PM
To jump to my question, following this tutorial will result in a three files being made/compiled and moved to the override folder. Those files are st_puppet1.utc, st_ai_puppethb.ncs, and a third ncs file that does not have a specified name. If that is correct, then what do I need to save the .nss as in order to compile it and move it to the override folder?


That should be correct. You can name the third file whatever you wish, as long as the name only contains alphanumerical characters (no spaces) and is no more than 16 characters long. I'd recommend that you use either a prefix or suffix for all your filenames to make sure they are less likely to conflict with names of standard files already in the game, or with the work of other modders. Makes it easier to find which files are yours as well. For example, I prefix all files I have created with "st_" (so don't pick that prefix please ;)).

As long as it's a valid file name it does not matter what you call it, since you are the one who will have to call the script (usually from a Dialog or a party member spawn/join script) when you want to add the puppet. So name it something that will help you remember what it's for. :)


Also, do I compile the 2nd .nss file with the same 4 .nss files that I compiled st_ai_puppethb.nss with?


The script that assigns the puppet? No, it does not use any include files. The script compiler will automatically look for includes in its folder when needed, and will issue error messages if the include is missing. You can see what external (include) files a script requires by looking for lines starting with the #include directive, which is followed by the name of the file without the NSS suffix. Those are usually somewhere near the top of the script.

For example in the PUP heartbeat script you have the line #include "k_inc_generic" at the top, which means it will need the file k_inc_generic.nss in order to compile. If you open the file k_inc_generic.nss in Notepad you will see that it contains three include directives as well near the top...
#include "k_inc_gensupport"
#include "k_inc_walkways"
#include "k_inc_drop"
...which means that you will need k_inc_gensupport.nss, k_inc_walkways.nss and k_inc_drop.nss as well in order to compile. Fortunately none of those include scripts have their own #include directives though, so the include chain stops there. :)

Include files are always uncompiled NSS files, since they are used by other scripts and are never called directly by themselves. Files starting with k_inc_ are usually standard include scripts which you can find inside scripts.bif with KotorTool.

TheMitten9
09-30-2005, 07:50 PM
Thanks for the reply...it seems as though I was doing this right, but the puppet just wont show up :(

Here is exactly what I've been doing...hopefully can find what I'm doing wrong ;/

1) Load up Kotor Tool. Then under bif, template, character blueprint I select p_bastila.utc.
2) I change faction from 2 to 23, I copy and past each script name provided into the proper slots and make the tag and resref st_puppet1. (will change from default as soon as I get it working propery) Then I hit save and save it as js_puppet1.utc
3) I open GFFEditor and chance multiplierset to 2, and ignorecrepath to 1. Save as st_puppet1.utc and move it to override.
4) Open notepad, copy and past the 1st provided script and save as st_ai_puppethb.nss.
5) Open notepad, copy and past the 2nd provided script and save as js_bastilapup.nss
6) Compile (log copy and pasted below) and move the two .ncs files to the override folder.
7) Load up a saved game at Telos' surface and/or at citadel station with kreia in my group and the puppet does not show up. I remove kreia from party, put back and that doesnt make it appear. I move to a different map and it still doesnt show up ;/

Here is the log from my compile:

-------------------------------------------
NSSCOMP.bat output Fri 09/30/2005 07:40
-------------------------------------------
Compiling: js_bastilapup.nss
Total Execution time = 78 ms
Compiling: k_inc_drop.nss
File is an include file, ignored
Total Execution time = 47 ms
Compiling: k_inc_generic.nss
File is an include file, ignored
Total Execution time = 94 ms
Compiling: k_inc_gensupport.nss
File is an include file, ignored
Total Execution time = 79 ms
Compiling: k_inc_walkways.nss
File is an include file, ignored
Total Execution time = 63 ms
Compiling: st_ai_puppethb.nss
Total Execution time = 219 ms
-------------------------------------------
Compilation complete: 2/6 files compiled
4 file ignored as include file


I just can't figure out what I'm doing wrong...I've spent about 4 hours trying to figure it out now ;p Thanks again for the help!


Oh, and again, once I get this working properly I will change the filenames to js_ect instead of st_ect. I just want to follow the tutorial as closely as possible until I get it right.

General Kenobi
09-30-2005, 09:23 PM
I tend to be notoriously long-winded in my explanations.

Your very detailed and WE LOVES YA FOR IT!!! :thumbsup: hee hee hee ;)

I've already downloaded the thread for offline as it is now and I think I'll try a puppet of my own. Wonderful tutorial and we really appreciate all your help and hard work Stoffe. :D

Each of us has very very broad talents some modelers, some scripters, some graphic editors, some weapons masters. Your detailed tutorial info in your posts (not withstanding your actual "tutorials") is one of the main reasons my knowledge base has increased outside of my own known sphere of talent. Your information helps inspire others to think, "hey maybe I can do that."

:ben:
General Kenobi

Fred Tetra
09-30-2005, 10:27 PM
Thanks for the reply...

3) I open GFFEditor and chance multiplierset to 2, and ignorecrepath to 1. Save as st_puppet1.utc and move it to override.



Just so you know, the latest version of Kotor Tool has support for these two fields; you can just use a checkbox to change them. Since they are only supported in TSL, when you first open the file, tell Kotor tool that it is for TSL, not KotOR I or the fields won't show up in the creature editor.

stoffe
10-01-2005, 07:29 AM
Thanks for the reply...it seems as though I was doing this right, but the puppet just wont show up :(

Here is exactly what I've been doing...hopefully can find what I'm doing wrong ;/
(snip)
I just can't figure out what I'm doing wrong...I've spent about 4 hours trying to figure it out now ;p Thanks again for the help!


If your PUP template is called something other than st_puppet1.utc, remember to update the script (js_bastilapup.ncs in your case I assume) to call the correct template to use.

Perhaps a stupid question, but are you actually calling your js_bastilapup.ncs script somewhere? If everything compiles and is set up correctly that's the only mistake I can think of. :)

If your PUP is supposed to be assigned to Kreia you'll have to call the script somewhere after Kreia has joined your party, as scripts don't run automatically.

The most logical place to do so would be in the script which adds Kreia to your party. Below is a modified variant of the a_addkreia.nss script that should do the trick if compiled and put in override:

// ST: a_addkreia.nss

void main() {
// ST: Add Kreia to the party.
object oKreia = GetObjectByTag("kreia");
SetGlobalNumber("101PER_Kreia_Joined", 1);
AddAvailableNPCByObject(NPC_KREIA, oKreia);
AddPartyMember(NPC_KREIA, oKreia);

// ST: The name of the puppet assignment script is set here.
DelayCommand(0.5, ExecuteScript("js_bastilapup", oKreia));
}


Note that this script specifies the name of the "puppet maker" script to run, so if you rename your script don't forget to change the name in the call to the ExecuteScript() function in the above script as well. :)

TheMitten9
10-01-2005, 11:36 AM
Woot, that did it, thank you, stoffe, the help!

Thanks for pointing out that feature in kotor tool too, Fred Tetra. That is certainly faster to use and I dont have to keep tracking of as many windows - nice feature!

PallandoBl
02-05-2006, 11:29 PM
I've tried creating a puppet and it creates fine and follows my party around fine. It has the weapon I gave it and it uses force powers. The one problem I have is that it won't attack anything. It will run up to the enemy and just stand there. I've tried a variety of models in case it's an animation restriction and still no go. Any ideas?

tk102
02-05-2006, 11:33 PM
Sorry about asking the obvious, but is the Faction of the puppet's .utc file set to 23?

PallandoBl
02-06-2006, 12:14 AM
Yes it is.

Clone__Commando
02-11-2006, 03:12 PM
is there any way you could post the files on pcgamemods.com?

RedHawke
02-12-2006, 12:26 AM
is there any way you could post the files on pcgamemods.com?
This is a tutorial thread not a mod thread. :confused:

All the scripts are contained in this thread in the blue code boxes, you simply need to copy them to notepad, and alter them so as to work with what you want to do on your end. ;)

Darth-Meatbag
10-02-2006, 05:04 PM
Can someone help me? I've followed this tutorial and my puppet just will not appear. It is quite strange. It is much like the guy above. I'm attempting to implement a puppet called Floating Lightsaber to Kreia. Here is what I do off the top of my head.
1. Create a puppet and edit all stats, I name the puppet Floating Lightsaber, resref and tag are st_puppet1 (I likely will never release this so noone will ever have it, if I did then i'd change the tag/resrefs/scripts)
2. Set the scripts of the puppet to
OnHeartbeat: st_ai_puppethb
OnNotice: k_hen_percept01
OnAttacked: k_hen_attacked01
OnDamaged k_hen_damage01
OnEndRound: k_hen_combend01
OnDialogue: k_hen_dialogue01
OnSpawn: k_hen_spawn01
OnBlocked: k_hen_blocked01
OnUserDefine: k_hen_userdef01
3. Save the puppet as st_puppet1.utc
4. Change the MultiplierSet to 2
5. Change the IgnoreCrePath to 1
6. Create the above scripts with the same names (st_ai_puppethb.nss, GivePuppet, and also tried a_addkreia.nss) then I save them and compile it for KoToR2 as a .ncs)
7. Move the compiled scripts and UTC to my Override folder (D:Program Files\Games\SWKoToR2\Override)
8. Start the game, load up my save and look, no puppet. Remove Kreia from my parrty. Add her again. No puppet. Left area. No puppet. Removed and added Kreia again. No puppet. I have no idea what im doing wrong. Help would be appreciated. Thanks in advance.
NOTE: I'm useing Notepad to make the scripts and save them as an .nss (Yes, it does say All Files, not .txt)

~Darth Meatbag

goldberry
10-02-2006, 05:12 PM
Don't you need to put the GivePuppet script into a dialog file to actually unlock the puppet, or was that something done just in the HK-Puppet by Insideious?

Darth-Meatbag
10-02-2006, 05:38 PM
I'm sure that you don't have to put it into a Dialog file, because in the a_addkreia.ncs script it executes the GivePuppet.ncs script. Heres a copy of the script.
// ST: a_addkreia.nss

void main() {
// ST: Add Kreia to the party.
object oKreia = GetObjectByTag("kreia");
SetGlobalNumber("101PER_Kreia_Joined", 1);
AddAvailableNPCByObject(NPC_KREIA, oKreia);
AddPartyMember(NPC_KREIA, oKreia);

// ST: The name of the puppet assignment script is set here.
DelayCommand(0.5, ExecuteScript("GivePuppet", oKreia));
}
Its from the above poster. I just edited the last line to use GivePuppet instead of whateve script it was told to do in the beginning. I'm beggining to think that prehaps this is the script where Kreia first joins? I'm going to test that.

~Darth Meatbag

Darth-Meatbag
10-02-2006, 06:14 PM
Tested it, it didn't work. Can someone help or can someone help me do what the above poster said, attach it to a Dialog? I'd just normally add it to a Dialog, but i'd prefer to add it to Kreia's dialog and I have no idea what Dialogs to edit.

~Darth Meatbag

tk102
10-04-2006, 03:20 PM
The a_addkreia.ncs only fires when Kreia actually joins you for the first time. You'll have to load a savegame prior to that point if you want to get a puppet in that way.

Scripts are fired from dialogs by placing the name of the script in the Script #1 field of a a dialog branch using DLGEditor. In this case, just put "givepuppet" in that field for some branch of dialog. In your case, if you want to do this after the point Kreia joins your party, her main dialog is "kreia.dlg" in the dialogs.bif. I might also recommend playing around with the FindRefs (http://www.starwarsknights.com/tools.php) utility. It can be useful for finding these types of things.

whatthehell
06-01-2008, 01:30 PM
i must be doin something worng, cuz i cant figure any of this out. im stuck where you said "Create a new creature template, or modify and existing one." im very bad at this, but im trying to learn...

Marius Fett
06-01-2008, 01:38 PM
ZOMG, major thread resurrection. :p

What you need to do, is open KotOR Tool and go to KOTOR II> BIFs>templates.bif>Blueprints, characters> and choose a UTC that you want to use.

whatthehell
06-01-2008, 01:51 PM
this is really bad. can you tell me the buttons i need to press to get there. this is really sad...lol

EnderWiggin
06-01-2008, 01:57 PM
this is really bad. can you tell me the buttons i need to press to get there. this is really sad...lol
Ok, if you don't know how to do this simple task after it's been explained, you need to go up to the tutorial forums and go through a tutorial or two (maybe Doom_Dealer's?) before you come to us like this.

_EW_

whatthehell
06-01-2008, 02:14 PM
the thing is ive never used any of these programs and im not sure what some of these things mean. its not like there's a dicitionary i can read

EnderWiggin
06-01-2008, 02:19 PM
the thing is ive never used any of these programs and im not sure what some of these things mean. its not like there's a dicitionary i can read

No, but if you'd actually read what I post and go do what I recommended, then it would be better than a dictionary. That's what tutorials are for.

http://www.lucasforums.com/showthread.php?t=131944
http://www.lucasforums.com/forumdisplay.php?f=592
http://www.lucasforums.com/showthread.php?p=1552754#post1552754

Hope. This. Helps.

_EW_

whatthehell
06-01-2008, 03:17 PM
ill be back later then

TheExile
06-14-2008, 02:31 PM
I did all well until i reached the second point at the second tier of scripts. I got lost there! Plssssss help?

Urahara
08-02-2010, 11:10 AM
could someone please give a download to a compiled version of the second script but attach it to hk-47 plz.
Im working on a little mod and thats all that is left to do.
so PLZ!