int nNth=1 ?
 Zephirius                
                
                    Member Posts: 419
Zephirius                
                
                    Member Posts: 419                
            
                    What does this mean in neverwinter script?  I 've been trying to figure out how to plug this into a logical statement but do not understand the meaning of it.
Would someone type me an example of how you to complete a statement using the nNth component?
Thanks guys...
                Would someone type me an example of how you to complete a statement using the nNth component?
Thanks guys...
0        
             
                                
Comments
I'm guessing it's one of the GetNearestObject() type calls. There a lot's of examples of using those in the lexicon.
example:
void main( ) { object oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC); }In the toolset example, nNth is the fourth parameter in the function. What am I suppose to do with it?
Often, you just want the nearest object, so you can omit the final parameter (it defaults to one). Sometimes, though, you want to loop through all the objects, nearest first.
int i = 0; object oTest = GetNearestObject(OBJECT_TYPE_CREATURE, GetFirstPC(), ++i); while (GetIsObjectValid(oTest)) { // Do stuff to object oTest = GetNearestObject(OBJECT_TYPE_CREATURE, GetFirstPC(), ++i); }But you don't have to do anything with it in your example.
You could use it in a loop to find, say the 4 nearest creatures, for example. Or you could set it to say 3 to get the third nearest creature.
TR