Hi,
I want to start off by saying I’m new to Neverwinter the game and the tool set as well.
I also know a little bit about C++ and Im currently writing Scripts on a module with friends and wanted to better.
So I’m going to paste a function that I do not quite understand to the fullest but would like to go into more, This is also from the Secret Door template from the expansion pack 2 Underdark.
int nBestSkill = -50;
object oidBestSearcher = OBJECT_INVALID;
int nCount = 1;
// Find the best searcher within the search radius.
object oidNearestCreature = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);
int nDoneSearch = 0;
int nFoundPCs = 0;
while ((nDone == 0) &&
(nDoneSearch == 0) &&
(oidNearestCreature != OBJECT_INVALID)
)
{
if(GetMaster(oidNearestCreature) != OBJECT_INVALID || GetIsPC(oidNearestCreature))
{
// what is the distance of the PC to the door location
float fDist = GetDistanceBetween(OBJECT_SELF,oidNearestCreature);
if (fDist <= fSearchDist)
{
if (LineOfSightObject(OBJECT_SELF, oidNearestCreature) == TRUE)
{
int nSkill = GetSkillRank(SKILL_SEARCH,oidNearestCreature);
if (nSkill > nBestSkill)
{
nBestSkill = nSkill;
oidBestSearcher = oidNearestCreature;
}
nFoundPCs = nFoundPCs +1;
}
else
{
//The Secret door is on the other side of the wall - so don't find it
nDoneSearch = 1;
}
}
else
{
// If there is no one in the search radius, don't continue to search
// for the best skill.
nDoneSearch = 1;
}
}
nCount = nCount +1;
oidNearestCreature = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, OBJECT_SELF ,nCount);
}
This is the text I think is relevant in better understanding the while loop which is the function. I guess my question would be for the parameters next to the while function, what would make the statement false, And in turn breaking the loop. I have a hard time understanding that part of the function in this script. I also think I get confused on the two && symbols In the parameters.
Thank you for the help in advance.