AddRosterMemberToParty(string sRosterName, object oPC)
RemoveRosterMemberFromParty(string sRosterName, object oPC, int bDespawnNPC)
The description for the first one says "This script will add a Roster Member to the same party that the player character object passed in belongs to." That would indicate that the sRosterName refers to the roster member name and oPC refers to the player character. The description for the second one though says "This function removes a roster member from the party." This is much more ambiguous. sRosterName could be the roster name and oPC could be the roster member, or sRosterName could be the roster member and oPC could be the PC.
But if sRosterName refers to the roster member, that would be contrary to how I've used the variable with the premade scripts in conversations. With ga_party_add, ga_roster_add_object, and ga_roster_selectable, sRosterName refers to the roster name (not the member name), at least as far as I can tell (and they all seem to work when I use them that way).
Here's the script I have that removes the NPC from the party and clears his actions to prepare him to be moved:
#include "x0_i0_assoc"
void main(string sHench)
{
object oPC = GetPCSpeaker() ;
object oHench = StringToObject(sHench) ;
if (GetIsObjectValid(oHench))
{
SetAssociateState(NW_ASC_MODE_STAND_GROUND, TRUE, oHench);
AssignCommand(oHench, ClearAllActions(TRUE));
RemoveRosterMemberFromParty(sHench, oPC, FALSE);
}
else
{
SendMessageToPC(oPC, "Where is your henchman?!");
}
}
And here's the script I have to add him back to the party:
#include "x0_i0_assoc"
void main(string sHench)
{
object oPC = GetPCSpeaker() ;
object oHench = GetLocalObject(oPC, sHench) ;
if (GetIsObjectValid(oHench))
{
SetAssociateState(NW_ASC_MODE_PUPPET, FALSE, oHench) ;
AssignCommand(oHench, ClearAllActions(TRUE));
if (GetIsRosterMemberAvailable(sHench))
AddRosterMemberToParty (sHench, oPC);
}
}
The problem though, is when I use these scripts, the NPC sometimes follows the PC and sometimes goes to the waypoint. It seems totally random.
Modifié par Artfoundry, 18 janvier 2011 - 01:31 .





Retour en haut






