LOL!
OK, grabbing the can 'o worms opener … the bottom line is I would currently have to rely on a player using the right-click “attack target” option that allows the “GetPlayerCurrentTarget” to become the player’s “chosen” option to allow combat to occur.
Here is my function (part of a larger script) that cycles through the party for those PCs with a target and unlocks their non-attack stance … NB: This function fires for the HOST (or single leader player) only to prevent loop overload. This then loops through the party members and applies the same as your script when the controlled PC does not have a valid target (stops the retaliation). When the right-click attack is used by the player, the target becomes valid for them and allows them to attack as normal. In my code, I also reallocate the target in the DisplayTargets(oPC); function that comes after so that they only have to keep the target “targeted” for the first attack. Thereafter, they can “lose the target” by right-clicking anywhere on the screen and the target is NOT lost. To lose the target again, the player would click the attack icon in their PC queue (to remove it), which would end their attacks. I also added the same end if they moved, which this function handles. NB: At some point I may consider making a normal “left click” select the target (like a right-click), but that may not be possible as I have not looked too close at the xml callbacks required - so it may not be possible. (Although, a normal right-click attack for a possessed PC to get the action started for the player seemed reasonable to me anyway.)
Let me know if you want further clarification on what I do …
void UpdateTargetGUI(object oPC);
void UpdateTargetGUI(object oPC)
{
object oFM = GetFirstFactionMember(oPC, FALSE);
while(oFM != OBJECT_INVALID)
{
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// KEEP A POSSESSED PC NO ACTION UNLESS A VALID TARGET GIVEN - THIS DOES WORK BUT ...
// NEEDS SOME REPORT FEEDBACK TIDYING UP AND REQUIRES RIGHT CLICK TO INITIATE (AND MUST KEEP TARGET FOR 1 ROUND)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(GetControlledCharacter(oFM) == oFM)
{
int iACTION = GetCurrentAction(oFM);
//SendMessageToPC(oFM, " >>> " + IntToString(iACTION));
//SendMessageToPC(GetFirstPC(), GetFirstName(oFM) + " CURRENT TARGET >>> " + GetName(GetLocalObject(oFM, "N2_PLAYER_QUEUED_TARGET")));
if(iACTION == ACTION_MOVETOPOINT)
{
DeleteLocalObject(oFM, "N2_PLAYER_QUEUED_TARGET");
}
object oTarget = GetPlayerCurrentTarget(oFM);
if(oTarget == OBJECT_INVALID && GetLocalObject(oFM, "N2_PLAYER_QUEUED_TARGET") == OBJECT_INVALID)
{
if(iACTION == ACTION_ATTACKOBJECT || iACTION == ACTION_INVALID)
{
AssignCommand(oFM, ClearAllActions());
DeleteLocalObject(oFM, "N2_PLAYER_QUEUED_TARGET");
}
}
else
{
SetLocalObject(oFM, "N2_PLAYER_QUEUED_TARGET", oTarget);
}
}
else
{
AssignCommand(oFM, StorePlayerQueuedTarget());
}
oFM = GetNextFactionMember(oPC, FALSE);
}
//SendMessageToAllPCs("<<< UPDATING >>>");
DisplayTargets(oPC);
}
And here is a snippet from the DisplayTargets function that also stores the target … via another loop!
// VALID TARGET - RETRIEVE ANY POTENTIAL ATTACK TARGET OBJECT NAME (RISK)
object oEnemyTarget = GetLocalObject(oFM, "N2_PLAYER_QUEUED_TARGET");
if(oEnemyTarget == OBJECT_INVALID){oEnemyTarget = GetAttackTarget(oFM);}
if(GetIsDead(oEnemyTarget)){oEnemyTarget = OBJECT_INVALID;}
// STORE
SetLocalObject(oFM, "N2_PLAYER_QUEUED_TARGET", oEnemyTarget);
CAVEAT: This assumes the OC combat system is still working along the lines mine does after all the alterations I have made … which I believe it should do at this point. i.e. This code would only be currently applied when using my TB mode in my own setup.
Retiring from main computer for the night now … … But will hang around for brief response if needed. If I miss any now, I’ll get back to you tomorrow.