Simple question but I couldn't find an answer anywhere. So basically, How do I find the EXACT coordinates for KOTOR 1? Because there's the Whereami Band for TSL but I can't find anything for KOTOR 1. Can anyone help me out here? Cheers.
The cheat console isn't invisible for KotOR I, so just type whereami in the cheat window and you'll see the coordinates.
Thank you! I didn't realise you could do that in the first place! Thanks!
Also, whilst on the Script Generator what should I put for Orientation? I have a feeling I should put friendly but I'm not sure...
I was always wondering what to put there, so i just put the numbers to which way my NPC is facing, but i don't know what it actually is.
Ok thanks, but now I'm getting very angry at this scripting. I have tried about 10 variations on this website and followed EVERY TUTORIAL EXACTLY but STILL my character doesn't spawn! Here is the code I'm using for the spawn script so far [the .dlg, .utc & ResRef are dan13_bralor, the .utm file [I r make merchant] is dan_bralor, the spawn script is k_pdan_bralorspawn.nss/ncs, the dialogue is k_pdan_bralord.nss/ncs & the merchant script is k_pdan_bralors.nss/ncs :
void main()
{
float x=-179.63f;
float y=-84.97;
float z=12.61;
float r=0.0;
vector vecNPC=Vector(x,y,z);
location locNPC=Location(vecNPC, r);
object oNPC=GetObjectByTag("dan13_bralor");
object oTarget=CreateObject(OBJECT_TYPE_CREATURE,"dan13_bralor",locNPC);
object oPC=GetFirstPC();
AssignCommand(oNPC,ActionMoveToObject(oPC));
AssignCommand(oNPC,ActionStartConversation(oPC,"dan13_bralor"));
}
^^^Spawn
void main() {
ActionStartConversation(GetFirstPC(),"dlg_dan13_bralor");
}
^^^Dialogue
void main()
{
object oStore = CreateObject(OBJECT_TYPE_STORE,"dan_bralor",GetLocation(GetFirstPC())); AssignCommand(GetFirstPC(), OpenStore(oStore, GetFirstPC()));
}
I HAVE Compiled the scripts and they have worked, so why the hell isn't my character spawning?! Please Help!
the spawn script is k_pdan_bralorspawn.nss/ncs
I HAVE Compiled the scripts and they have worked, so why the hell isn't my character spawning?! Please Help!
k_pdan_bralorspawn is too long, a resource name can be at most 16 characters long, that is 18 characters. :)
Your spawn script is also needlessly complicated. While technically not wrong at the spawning part it contains a lot of variables that are only used once and attempt to get the NPC by tag before it has been spawned (which would result in an invalid object reference and the "move to player and talk" part not executing properly). This variant is a bit cleaned up and should do the same:
void main() {
// Area coordinates to spawn NPC at
vector vPos;
vPos.x = -179.63;
vPos.y = -84.97;
vPos.z = 12.61;
// Direction angle (0-360) the NPC should be facing when spawned
float fAngle = 0.0;
// Spawn the NPC
object oNPC = CreateObject(OBJECT_TYPE_CREATURE,"dan13_bralor", Location(vPos, fAngle));
// Make the NPC move to the player and start conversation
object oPC = GetFirstPC();
AssignCommand(oNPC, ActionMoveToObject(oPC));
AssignCommand(oNPC, ActionStartConversation(oPC, "dan13_bralor"));
}
Damn, if only I could count...cheers Stoffe, I'll try now and see if it works
EDIT: Nope still nothing. I've tried loading a save game in Davik's Estate and progressing to Dantooine and loading Dantooine itself. In the UTC editing should I change the spawn and dialog script locations [so where it says k_def_spawn01 change it to k_pdan_bralor]?
Also, I don't want him to walk up to the PC. That was in the script in the tut and I didn't know how to remove without screwing it up.
Hang on, I just noticed the minuses in the script before the coordinates shouldn't be there. Might be why it aint working.
EDIT: Nope still nothing. I've tried loading a save game in Davik's Estate and progressing to Dantooine and loading Dantooine itself. In the UTC editing should I change the spawn and dialog script locations [so where it says k_def_spawn01 change it to k_pdan_bralor]?
The above script works properly if you run it and have specified a valid UTC name and area coordinates. I'd suspect the problem is that the script isn't run at all if nothing happens still though. Where are you running the spawning script from?
The scripts you set in the UTC template are AI event scripts that control how the NPC moves around, fights, behaves in conversation and perceives its surroundings. You should not mess with any of them unless you know what you are doing and leave them to the k_def_* set for normal NPCs and k_hen_* for party members.
The OnSpawn event script is run once when the NPC first is created into the game world, and is normally used for configuring default behaviors for the creature AI. The OnDialog event script is run whenever someone tries to initiate conversation with the NPC, the NPC hears a shout from other NPCs, or the NPC is trying to execute a Conversation action. You shouldn't need to mess with either script unless you are trying to do something out of the ordinary.
Also, I don't want him to walk up to the PC. That was in the script in the tut and I didn't know how to remove without screwing it up.
Then this should be enough to just spawn the NPC:
void main() {
// Area coordinates to spawn NPC at
vector vPos;
vPos.x = -179.63;
vPos.y = -84.97;
vPos.z = 12.61;
// Direction angle (0-360) the NPC should be facing when spawned
float fAngle = 0.0;
// Spawn the NPC
CreateObject(OBJECT_TYPE_CREATURE, "dan13_bralor", Location(vPos, fAngle));
}
I'm trying to spawn a Merchant in the Landing Area in Dantooine "hence Dan13" right on the tiled path leading to the Aratech Mercantile place. No success yet, obviously, so has anyone else have any ideas why it isn't working? I haven't changed the scripts except for removing the minuses [tried with minuses too, didn't work] in front of "179.63/84.97" and it hasn't worked.
I'm trying to spawn a Merchant in the Landing Area in Dantooine "hence Dan13" right on the tiled path leading to the Aratech Mercantile place. No success yet, obviously, so has anyone else have any ideas why it isn't working? I haven't changed the scripts except for removing the minuses [tried with minuses too, didn't work] in front of "179.63/84.97" and it hasn't worked.
Where are you running your spawn script from? The most likely cause of the spawning failing is that your script doesn't run at all. Try adding this to the script:
SendMessageToPC(GetFirstPC(), "DEBUG: SPAWNING SCRIPT IS RUNNING!");
Then check the feedback log after the spawn should have happened and look for an an entry that says "DEBUG: SPAWNING SCRIPT IS RUNNING!". If there is none your script has not been run, and that's the problem. If that line is in the feedback log then there is something wrong in the script itself, most likely the coordinates.
The area coordinate grid does not necessarily start at (0, 0, 0) so negative values are possible as valid coordinates. Thus there is a significant difference between 180.0 and -180.0, the second being 360 meters to the west of the former in the area.
If you mean the feedback log in the KOTOR game then no, nothing came up. I'll change the coordinates to somewhere else, just near where Belaya is on the first time in Dantooine. I'll edit when I've tested.
By the way, thanks for all the help so far Stoffe. You are a legend :)
Edit: Nothing so far. BTW, if the coordinates for the area are 89.97, 92.70, 5.36 in that order when displayed by the whereami cheat then should they be x, y, z in that order?
If you mean the feedback log in the KOTOR game then no, nothing came up. I'll change the coordinates to somewhere else, just near where Belaya is on the first time in Dantooine. I'll edit when I've tested.
If the debug text didn't show up in the feedback log then the problem isn't with the script itself (and messing with the coordinates will do no difference at this point), but rather with how you run it.
Scripts do not run automatically, they need to be fired from a dialog, executed from another script or triggered by an event in order to run. Whatever you use to run your script does not seem to fire it properly.
What method do you use to run the script that spawns the NPC?
BTW, if the coordinates for the area are 89.97, 92.70, 5.36 in that order when displayed by the whereami cheat then should they be x, y, z in that order?
Yes, the whereami lists the X, Y, Z coordinates, though the Z coordinate is irrelevant when spawning NPCs since they are always snapped to the floor no matter what you set that coordinate to. Other object types (placeables, sounds etc) can have a Z/elevation set value though.
To be honest I didn't read anywhere about having to try and run the script. I'm not even sure how to do that. If I understand correctly, would it be like firing off from the On_enter script? [which I can't find]
To be honest I didn't read anywhere about having to try and run the script. I'm not even sure how to do that. If I understand correctly, would it be like firing off from the On_enter script? [which I can't find]
The easiest way in this case is probably to fire it from the dialog with Bastila the player has the first time they arrive on Dantooine (where she informs you the council has requested an audience with you). If I remember correctly this is handled in the bastila.dlg file found inside the danm13_s.rim module.
Pick one of the entry nodes below that particular dialog branch and put your script in the action script box ("Script to run for this node" if you use KotorTool's dialog editor). Since that particular dialog is only run once you shouldn't need to worry about making sure only one NPC is spawned.
While you could modify the area's OnEnter event script (set in the .ARE file for the area, found under the "Static Area Info" heading in KotorTool) in this case it would mean extra work since the area already has an OnEnter event script assigned. Thus you'd need to either merge your script with the existing one, or make either script execute the other. Easier to just piggyback it from a dialog in this situation, in my opinion.
Another solution, somewhat overkill in this case, is to modify the area to place a new trigger by the Ebon Hawk exit ramp and use the trigger's OnEnter script to fire the script. The script would have to be modified so that it would only fire once though or you'd end up with an army of your NPC if the player moves by the exit ramp a lot. :)
OK I've done and spawned him alright but I have another question [don't wanna start a new thread]:
How could I script someone to be doing the same animation [the 2 I want are lightsaber duels (ie on Korriban) and dancing] without having to prompt them via dialogue, ie they automagically spawn dueling/dancing?
Cheers
OK I've done and spawned him alright but I have another question [don't wanna start a new thread]:
How could I script someone to be doing the same animation [the 2 I want are lightsaber duels (ie on Korriban) and dancing] without having to prompt them via dialogue, ie they automagically spawn dueling/dancing?
Cheers
This can be done using the heartbeat event, which fires once every round (roughly every 3 seconds IIRC). A simple example of a heartbeat script if you want the NPC to keep dancing continually:
void ST_ForceFacingAngle(float fAngle, object oCreature = OBJECT_SELF);
void main() {
if (!GetLocalBoolean(OBJECT_SELF, 62)) {
int iAnim = (d2() == 1 ? ANIMATION_LOOPING_DANCE : ANIMATION_LOOPING_DANCE1);
ST_ForceFacingAngle(90.0);
ActionPlayAnimation(iAnim, 1.0, RoundsToSeconds(1));
}
}
void ST_ForceFacingAngle(float fAngle, object oCreature = OBJECT_SELF) {
if (GetFacing(oCreature) != fAngle) {
AssignCommand(oCreature, SetFacing(fAngle));
}
}
(Change 90.0 to the angle (0-360) you want the NPC to be facing when they do their dancing.)
If I remember correctly the sparring on Korriban isn't just animations playing, those NPCs are fighting each other for real, just that they are set to be unkillable. Their AI scripts then abort the duel when the health of one of the combatants drops below a certain threshold, and they get healed automatically and start over a few moments later.