So, I have a script, originally made by KevL_s, that I’ve modified. It’s a script attached to a Area Transition. If you controll your own character clicking the Area Transition everything works fine, but when controlling a companion it doesn’t work as I want it to. I would want to switch control to the owned character if one clicks on the Area Transition, and thus making the script work as intended. However, as the script looks now the game wont switch to the owned character. I’ve tried different things for a long while now but nothing seems to work. I found another thread about a similar thing by Aqvilinus, and I tried what he wrote about there, but…it didn’t help…
Here is the script:
const string sDEST_PC = "hang_wp"; // waypoint tag of the PC's destination
const string sDEST_SNOFWIN = "hangout_camp_snofwin"; // waypoint tag of the Companions' destination
const string sDEST_TYN = "hangout_camp_tyn"; // waypoint tag of the Companions' destination
const string sDEST_VALERIE = "hangout_camp_valerie"; // waypoint tag of the Companions' destination
const string sDEST_ANELIA = "hangout_camp_anelia"; // waypoint tag of the Companions' destination
const string sDEST_GARDOK = "hangout_camp_gardok"; // waypoint tag of the Companions' destination
const string sDEST_MEAH = "hangout_camp_meah"; // waypoint tag of the Companions' destination
void SwitchControl(object oControlled)
{
SetOwnersControlledCompanion(oControlled);
}
void main()
{
object oEnter = GetClickingObject();
object oPC = GetOwnedCharacter(GetFactionLeader(oEnter));
AssignCommand(oPC, ClearAllActions(TRUE));
object oDestSnofwin = GetWaypointByTag(sDEST_SNOFWIN);
object oDestTyn = GetWaypointByTag(sDEST_TYN);
object oDestValerie = GetWaypointByTag(sDEST_VALERIE);
object oDestAnelia = GetWaypointByTag(sDEST_ANELIA);
object oDestGardok = GetWaypointByTag(sDEST_GARDOK);
object oDestMeah = GetWaypointByTag(sDEST_MEAH);
string sRoster;
string sRosterListCurrent = "";
object oFaction = GetFirstFactionMember(oEnter, FALSE);
DelayCommand(0.0f, SwitchControl(GetControlledCharacter(oPC)));
if (GetIsOwnedByPlayer(oEnter))
{
while (GetIsObjectValid(oFaction))
{
sRoster = GetRosterNameFromObject(oFaction);
if (sRoster == "snofwin")
{
sRosterListCurrent += sRoster + ";";
if (GetIsPC(oFaction))
SetOwnersControlledCompanion(oFaction);
RemoveRosterMemberFromParty(sRoster, oEnter, FALSE);
AssignCommand(oFaction, ClearAllActions());
AssignCommand(oFaction, JumpToObject(oDestSnofwin));
oFaction = GetFirstFactionMember(oEnter, FALSE);
}
if (sRoster == "tyn")
{
sRosterListCurrent += sRoster + ";";
if (GetIsPC(oFaction))
SetOwnersControlledCompanion(oFaction);
RemoveRosterMemberFromParty(sRoster, oEnter, FALSE);
AssignCommand(oFaction, ClearAllActions());
AssignCommand(oFaction, JumpToObject(oDestTyn));
oFaction = GetFirstFactionMember(oEnter, FALSE);
}
if (sRoster == "valerie")
{
sRosterListCurrent += sRoster + ";";
if (GetIsPC(oFaction))
SetOwnersControlledCompanion(oFaction);
RemoveRosterMemberFromParty(sRoster, oEnter, FALSE);
AssignCommand(oFaction, ClearAllActions());
AssignCommand(oFaction, JumpToObject(oDestValerie));
oFaction = GetFirstFactionMember(oEnter, FALSE);
}
if (sRoster == "anelia")
{
sRosterListCurrent += sRoster + ";";
if (GetIsPC(oFaction))
SetOwnersControlledCompanion(oFaction);
RemoveRosterMemberFromParty(sRoster, oEnter, FALSE);
AssignCommand(oFaction, ClearAllActions());
AssignCommand(oFaction, JumpToObject(oDestAnelia));
oFaction = GetFirstFactionMember(oEnter, FALSE);
}
if (sRoster == "gardok")
{
sRosterListCurrent += sRoster + ";";
if (GetIsPC(oFaction))
SetOwnersControlledCompanion(oFaction);
RemoveRosterMemberFromParty(sRoster, oEnter, FALSE);
AssignCommand(oFaction, ClearAllActions());
AssignCommand(oFaction, JumpToObject(oDestGardok));
oFaction = GetFirstFactionMember(oEnter, FALSE);
}
if (sRoster == "meah")
{
sRosterListCurrent += sRoster + ";";
if (GetIsPC(oFaction))
SetOwnersControlledCompanion(oFaction);
RemoveRosterMemberFromParty(sRoster, oEnter, FALSE);
AssignCommand(oFaction, ClearAllActions());
AssignCommand(oFaction, JumpToObject(oDestMeah));
oFaction = GetFirstFactionMember(oEnter, FALSE);
}
else
oFaction = GetNextFactionMember(oEnter, FALSE);
}
}
if (sRosterListCurrent != "")
SetLocalString(oEnter, "CurrentRosterList", sRosterListCurrent);
SetLocalInt(oEnter,"gotocamp",GetLocalInt(oEnter,"gotocamp")+1);
AssignCommand(oEnter, ClearAllActions());
AssignCommand(oEnter, JumpToObject(GetWaypointByTag(sDEST_PC)));
}