// added after build 11 by KAM -->
void SetNextParty(bool bRight)
{
string tempstring;
int tempidx;
if (bRight)
{
curOfficer++;
if (curOfficer > ListMax) { curOfficer = 1; }
}
else
{
curOfficer--;
if (curOfficer < 1) { curOfficer = ListMax; }
}
tempstring = "member" + curOfficer;
tempidx = sti(MainChar.tempCharactersList.(tempstring).idx);
xi_refCharacter = GetCharacter(tempidx);
AddCharacterExp(xi_refCharacter,0);
}
void FillCharactersList(ref ViewingCharacter)
{
int tempnum1;
int tempnum2;
int tempnum3;
int tempnum4;
int tempnum5;
ref tempchar;
string tempstring1;
string tempstring2;
string tempstring3;
If (CheckAttribute(MainChar,"tempCharactersList"))
{
DeleteAttribute(MainChar,"tempCharactersList");
if (TRACELOG == 1) { Trace("deleted existing list"); }
}
ListMax = 1;
// ******* STEP 1/5: ADD MAIN CHARACTER *******
MainChar.tempCharactersList.member1.idx = sti(MainChar.index);
if (TRACELOG == 1) { Trace("added mainchar"); }
ListMax++;
// ******* STEP 2/5: ADD OFFICERS *******
for (tempnum1 = 1; tempnum1 < 4; tempnum1++)
{
tempnum2 = GetOfficersIndex(MainChar,tempnum1);
if (tempnum2 >= 0)
{
tempstring1 = "member" + ListMax;
MainChar.tempCharactersList.(tempstring1).idx = tempnum2;
if (TRACELOG == 1) { Trace("added list member " + ListMax + ": idx " + tempnum2 + " type 1"); }
ListMax++;
}
}
// ******* STEP 3/5: ADD COMPANIONS AND THEIR OFFICERS *******
for (tempnum1 = 1; tempnum1 < 4; tempnum1++)
{
tempnum2 = GetCompanionIndex(MainChar,tempnum1);
if (tempnum2 >= 0)
{
tempstring1 = "member" + ListMax;
MainChar.tempCharactersList.(tempstring1).idx = tempnum2;
if (TRACELOG == 1) { Trace("added list member " + ListMax + ": idx " + tempnum2 + " type 2"); }
ListMax++;
tempchar = GetCharacter(tempnum2);
for (tempnum3 = 1; tempnum3 < 4; tempnum3++)
{
tempnum4 = GetOfficersIndex(tempchar,tempnum3);
if (TRACELOG == 1) { Trace("checking officer " + tempnum3 + ", idx " + tempnum4 + ", of companion " + tempnum1 + ", idx " + tempnum2); }
if (tempnum4 >= 0)
{
tempstring1 = "member" + ListMax;
MainChar.tempCharactersList.(tempstring1).idx = tempnum4;
if (TRACELOG == 1) { Trace("added list member " + ListMax + ": idx " + tempnum4 + " type 3"); }
ListMax++;
}
}
}
}
// ******* STEP 4/5: ADD NON-OFFICER PASSENGERS *******
for (tempnum1 = 0; tempnum1 < GetPassengersQuantity(MainChar); tempnum1++)
{
tempnum2 = GetPassenger(MainChar,tempnum1);
if (tempnum2 >= 0)
{
tempchar = GetCharacter(tempnum2);
if (IsOfficer(tempchar) == false)
{
tempstring1 = "member" + ListMax;
MainChar.tempCharactersList.(tempstring1).idx = tempnum2;
if (TRACELOG == 1) { Trace("added list member " + ListMax + ": idx " + tempnum2 + " type 4"); }
ListMax++;
}
}
}
// ******* STEP 5/5: ADD CAPTAINS ON SHORE LEAVE AND THEIR OFFICERS *******
for (tempnum1 = 0; tempnum1 < 8; tempnum1++)
{
tempstring1 = "port" + tempnum1;
for (tempnum2 = 1; tempnum2 < 5; tempnum2++)
{
tempstring2 = "slot" + tempnum2;
if (sti(MainChar.ShipBerthing.(tempstring1).(tempstring2).status) == 2)
{
tempnum3 = sti(MainChar.ShipBerthing.(tempstring1).(tempstring2).captainindex);
tempstring3 = "member" + ListMax;
MainChar.tempCharactersList.(tempstring3).idx = tempnum3;
if (TRACELOG == 1) { Trace("added list member " + ListMax + ": idx " + tempnum3 + " type 5"); }
ListMax++;
tempchar = GetCharacter(tempnum3);
for (tempnum4 = 1; tempnum4 < 4; tempnum4++)
{
tempnum5 = GetOfficersIndex(tempchar,tempnum4);
if (TRACELOG == 1) { Trace("checking officer " + tempnum4 + ", idx " + tempnum5 + ", of shore leave captain idx " + tempnum3); }
if (tempnum5 >= 0)
{
tempstring1 = "member" + ListMax;
MainChar.tempCharactersList.(tempstring1).idx = tempnum5;
if (TRACELOG == 1) { Trace("added list member " + ListMax + ": idx " + tempnum5 + " type 6"); }
ListMax++;
}
}
}
}
}
ListMax--;
if (TRACELOG == 1) { Trace("list total: " + ListMax); }
curOfficer = 1;
xi_refCharacter = GetMainCharacter();
tempnum3 = sti(ViewingCharacter.index);
for (tempnum1 = 1; tempnum1 <= ListMax; tempnum1++)
{
tempstring1 = "member" + tempnum1;
tempnum2 = sti(MainChar.tempCharactersList.(tempstring1).idx);
if (tempnum2 == tempnum3)
{
curOfficer = tempnum1;
xi_refCharacter = GetCharacter(tempnum2);
}
}
AddCharacterExp(xi_refCharacter,0);
}
void FillCharactersList_EncOfficerOnly(ref tempEncOfficer)
{
If (CheckAttribute(MainChar,"tempCharactersList"))
{
DeleteAttribute(MainChar,"tempCharactersList");
if (TRACELOG == 1) { Trace("deleted existing list"); }
}
ListMax = 1;
curOfficer = 1;
MainChar.tempCharactersList.member1.idx = sti(tempEncOfficer.index);
xi_refCharacter = GetCharacter(sti(MainChar.tempCharactersList.member1.idx));
AddCharacterExp(xi_refCharacter,0);
if (TRACELOG == 1) { Trace("added enc officer id " + sti(MainChar.tempCharactersList.member1.idx) + ". list total: " + ListMax); }
}
// <-- added after build 11 by KAM