#1, in morrowind, theres a command called "Disable" which makes the refrence its attached to dissapear, and stop all scripts on that refrence from running, I'm wondering if theres a similar style thing in kotor.
KOTOR and Morrowind handles game objects a bit differently if I remember correctly. You can't actually delete anything from the game world in Morrowind, and all objects are pretty much pre-placed, while in Kotor you can create and delete many objects when necessary.
You should be able to somewhat simulate the behavior of the enable/disable functions in TESScript (i.e. hide an object present in the game world and later be able to reveal it) in K2:TSL by doing something like:
// ST: Support function, enable creature
void Enable(object oActor) {
AssignCommand(oActor, ClearAllActions());
SetLocalBoolean(oActor, 87, FALSE); // Enable combat AI scripts
EnableRendering(oActor, TRUE);
ResetCreatureAILevel(oActor);
}
// ST: Support function, disable creature
void Disable(object oActor) {
CancelCombat(oActor);
AssignCommand(oActor, ClearAllActions());
SetLocalBoolean(oActor, 87, TRUE); // Disable combat AI scripts
EnableRendering(oActor, FALSE);
SetCreatureAILevel(oActor, AI_LEVEL_VERY_LOW);
}
// ST: Main function, do things.
void main() {
object oNPC = GetObjectByTag("TagOfNPC");
// ST: Disable the creature with tag TagOfNPC
Disable(oNPC);
// ST: Enable the creature with tag TagOfNPC
Enable(oNPC);
}
Though in most cases you wouldn't pre-place characters who should appear/disappear dynamically, you just place a waypoint instead and create the creature at it, and destroy them, as needed. Like:
void main() {
// ST: Create a creature in UTCfilename.utc at waypoint with tag WP_TagOfNPC
location lLoc = GetLocation(GetWaypointByTag("WP_TagOfNPC"));
object oNPC = CreateObject(OBJECT_TYPE_CREATURE, "UTCfilename", lLoc);
// ST: Destroy the creature again
DestroyObject(oNPC);
}
This one may be blatently simple : / but, in morrowind, you started the script with:
Am I right at assuming you gotta start scripts in kotor with:
"void main()
{"
...and ending them with:
"}"
NWScript uses a syntax that reminds a bit of C. Scripts will need a starting function where the game begins execution of it. For most scripts this function is called main() and has no return value (void), though in dialog conditional scripts the function is called StartingConditional() and returns an integer value (int). The function name and parameter list is then followed by the { } block delimiters. Everything between those belongs to the function. Like:
normal script:
void main() {
SendMessageToPC(GetFirstPC(), "Hello World!");
}
conditional script:
int StartingConditional() {
return GetGender(GetFirstPC()) == GENDER_MALE;
}
Overall TESScript is a lot more primitive than NWScript, though there are some things you can do with one that is impossible with the other, and vice versa.
not to mention how Kotor's Dialog system destroys morrowinds dialog system.
Morrowind barely has a dialog system, it felt more like browsing a bulletin board than talking to someone. :)
Heh, and I'm gonna have to get used to compiling my scripts
Kotor may not have a fancy toolset integrating things for you, but if you have a good text editor (like UltraEdit) you can set it up to do it for you with nwnnsscomp. Makes it a lot more hassle-free when you can compile with a mouseclick and see the result directly in the window. :) Like:
http://img366.imageshack.us/img366/5393/ultraeditnssze7.jpg)