This is basically an idea I got while going through NWN's include files in the Lexicon. I think that it is possible to re-create some of the scripts in the Lexicon for use in the Kotor games. I already had/have two from the one of the destruction includes from the Lexicon. The first one counts the number of objects with sTag:
Show spoiler
Code:
int GetNumObjectsWithTag(string sTag)
{
int Nth = 0;
int Number = 0;
object oItem = GetObjectByTag(sTag, Nth);
while(GetIsObjectValid(oItem))
{
Number++;
Nth++;
oItem = GetObjectByTag(sTag, Nth);
}
return Number;
}
This should work. I carried it in my head for the past 5 days, so it might not be accurate. A way of testing it is by spawning four of something, say a boma( put "c_boma01" without the quotes in place of string sTag), and then make and fire a script with this code in it:
Show spoiler
Code:
#include "<whatever you named the file with the above function>"
void main()
{
string message = "There are " + IntToString(GetNumObjectsWithTag("c_boma01")) + "bomas around.";
SendMessageToPC(GetFirstPC(), message);
}
If it doesn't report right, try changing "int Nth = 0;" to "int Nth = 1;". The second code I will post when I have access to a computer I can mod on to see that it works before posting it. The gist of it is:
Show spoiler
Code:
void DestroyObjectsWihTag(string sTag)
{
int Nth = 0;
int Max = GetNumObjectsWithTag(sTag);
int current;
for(current; current <= Max; current++)
{
oItem = GetObjectByTag(sTag, Nth);
DestroyObject(oItem);
Nth++;
}
}
Hopefully, you see the idea that I'm trying to get across. If you manage to find and "adapt" a script in working condition, please feel free to PM it to me, along with whatever name you want in the credits section, seeing as I intend to release this as a scripting resource.
I have a bunch of scripts tucked away in a .nss; some I can test, but others(like those that deal with vector and location) I can't because I don't have much experience with them.
Thank you for reading this, and until next time, see ya! Download progress