Hello all.
So, I have been working on a mod to add new merchants to the game. I can do this most of the time via mandatory dialog sequences, however there are some points where I can't, or where that would be impractical. So, delving back into my memory from the days of yore I remembered adding a character to an area via the onEnter script. After searching through some dusty threads on LF I believed that I had found the information on how to do this once again, and quickly did so. However; upon loading the files into the override and starting the game, I found a problem existed. Namely the new character doesn't appear.
Here I'll explain the steps I took:
Opened Kotor Tool
Looked up tar_m02ab
Checked the .ARE file for onEnter
Found and extracted k_ptar_02ab_en
Renamed it old_k_ptar_02ab_en
Used the following code. (Named it k_ptar_02ab_en and compiled it with the KT):
void main() {
ExecuteScript("k_benjo_spawn", OBJECT_SELF);
ExecuteScript("old_k_ptar_02ab_en", OBJECT_SELF);
}
Used the following code. (Named it k_benjo_spawn and compiled it):
void main() {
object oEntering = GetEnteringObject();
object oCreature = GetObjectByTag("benjo");
if (GetIsPC(oEntering))
if (GetIsObjectValid(oCreature) == FALSE)
CreateObject (OBJECT_TYPE_CREATURE, "benjo", Location(Vector (88.48, 94.40, 0.00), 0.00));
}
I then created the UTC file for Benjo taking care to replace the existing tag with "benjo". (I also replaced all scripts with "hen" in place of "def". I believe I remember that being a requirement.
Finally I created a dialog file for Benjo and attached it in his UTC file. Then, thinking I was done, I loaded everything into my Override folder.
Here is what went into the override:
benjo_dlg.dlg
k_benjo_spawn.ncs
k_ptar_02ab_en.ncs
old_k_ptar_02ab_en.ncs
benjo.utc
Any suggestions / help would be much appreciated. Thanks in advance,
~Dr. Hal
In this line in your script
CreateObject (OBJECT_TYPE_CREATURE, "benjo", Location(Vector (88.48, 94.40, 0.00), 0.00));
}
I see from your script that "benjo" is the tag of your utc, is is also its ResRef b/c the resref of the utc needs to follow object_type_creature.
just a thought
Hey newbiemodder, thanks for replying.
Well I made sure the ResRef's were identical, (which they were), but just to make sure I renamed the ResRef to: k_benjo. This is the new spawn code. I'm actually beginning to think there might be something wrong with the spawn code itself?
void main() {
object oEntering = GetEnteringObject();
object oCreature = GetObjectByTag("benjo");
if (GetIsPC(oEntering))
if (GetIsObjectValid(oCreature) == FALSE)
CreateObject (OBJECT_TYPE_CREATURE, "k_benjo", Location(Vector (88.48, 94.40, 0.00), 0.00));
}
Any thoughts?
I'm not the greatest scripter, heck I'm no even good...but there must be something wrong with your conditional "if" statements b/c they do not look right
Try this...again this could be totally wrong
void main() {
object oEntering = GetEnteringObject();
object oCreature = GetObjectByTag("benjo");
if (GetIsPC(oEntering)) {
if (GetIsObjectValid(oCreature) == FALSE) {
CreateObject (OBJECT_TYPE_CREATURE, "k_benjo", Location(Vector (88.48, 94.40, 0.00), 0.00));
}}}
I figured out the problem on my own however. It seems that there were two .ncs files with almost identical names. I extracted the wrong one, (which obviously created the problem). Everything is working now, and I think I have relearned that oh-so-valuable lesson of modding. 'Have patience!'
Thanks again for all your help, your name will be appearing in the readme.
~Dr. Hal