Fair Strides

NWN Adaptability

Recommended Posts

Hey guys! My comp is giving me a hassle:First it crashes, then the power box shorts out, and now I have "Video card or chip" errors when trying to turn on the power.

 

But, I'm still going to progress with this. 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:

 

 

int GetNumObjectsWithTag(string sTag)
{
[i]  	[/i]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" with the quotes in place of string sTag), and then make and fire a script with this code in it:

 

 

#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:

 

 

void DestroyObjectsWihTag(string sTag)
{
[i]  	[/i]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.

 

Thank you for reading this, and until next time, see ya!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.