It is supposed to remove a party member without despawning, but when I looked at the code, the function
RemoveRosterMemberFromParty() did not have the FALSE parameter needed to keep the character from despawning and the function is reported to default to TRUE for that parameter.
Here is the code:
/////////////////////////////
#include "ginc_param_const"
void main(string sRosterName, string sTarget)
{
object oTarget = GetTarget(sTarget, TARGET_PC);
RemoveRosterMemberFromParty(sRosterName, oTarget);
}
//////////////////////////////////
To avoid despawning the companion, it should look like this:
///////////////////////////////////////////
#include "ginc_param_const"
void main(string sRosterName, string sTarget)
{
object oTarget = GetTarget(sTarget, TARGET_PC);
RemoveRosterMemberFromParty(sRosterName, oTarget,FALSE);
}
////////////////////////////
Note the FALSE parameter added to RemoveRosterMemberFromParty()
ga_roster_party_remove doesn't appear to work as advertised
Débuté par
M. Rieder
, déc. 19 2011 03:02
#1
Posté 19 décembre 2011 - 03:02
#2
Posté 19 décembre 2011 - 03:34
That's why I use my own set of scripts for adding/removing party members:
// ga_add_to_party
//
// If no sTag specified, use conversation owner
// If no sRosterName specified, use companion's first name
// sRosterName not required if already in the roster
void main(string sTag, string sRosterName)
{
object oCompanion = OBJECT_SELF;
if (sTag != "")
oCompanion = GetNearestObjectByTag(sTag, GetFirstPC());
if (!GetIsObjectValid(oCompanion))
return;
if (!GetIsRosterMember(oCompanion))
{
string sName = GetFirstName(oCompanion);
if (sRosterName != "")
sName = sRosterName;
AddRosterMemberByCharacter(sName, oCompanion);
}
else
sName = GetRosterNameFromObject(oCompanion);
SetIsRosterMemberSelectable(sName, 1);
AddRosterMemberToParty(sName, GetFirstPC());
}
--
//ga_remove_from_party
//
// If no sTag specified, use conversation owner
// Will work as an OnDeath script if required
void main(string sTag)
{
object oCompanion = OBJECT_SELF;
if (sTag != "")
oCompanion = GetNearestObjectByTag(sTag, GetFirstPC());
if (!GetIsObjectValid(oCompanion))
return;
string sName = GetRosterNameFromObject(oCompanion);
RemoveRosterMemberFromParty(sName, GetFirstPC(), FALSE);
if (GetIsDead(oCompanion))
SetIsDestroyable(FALSE, TRUE, TRUE);
}
--
//gc_is_in_party
//
// If no sTag specified, use conversation owner
#include "ginc_param_const"
int StartingConditional(string sTag)
{
object oPC = GetPCSpeaker();
object oCompanion = OBJECT_SELF;
if (sTag != "")
oCompanion = GetNearestObjectByTag(sTag, oPC);
int bRet = GetFactionEqual(oPC, oCompanion);
return (bRet);
}
// ga_add_to_party
//
// If no sTag specified, use conversation owner
// If no sRosterName specified, use companion's first name
// sRosterName not required if already in the roster
void main(string sTag, string sRosterName)
{
object oCompanion = OBJECT_SELF;
if (sTag != "")
oCompanion = GetNearestObjectByTag(sTag, GetFirstPC());
if (!GetIsObjectValid(oCompanion))
return;
if (!GetIsRosterMember(oCompanion))
{
string sName = GetFirstName(oCompanion);
if (sRosterName != "")
sName = sRosterName;
AddRosterMemberByCharacter(sName, oCompanion);
}
else
sName = GetRosterNameFromObject(oCompanion);
SetIsRosterMemberSelectable(sName, 1);
AddRosterMemberToParty(sName, GetFirstPC());
}
--
//ga_remove_from_party
//
// If no sTag specified, use conversation owner
// Will work as an OnDeath script if required
void main(string sTag)
{
object oCompanion = OBJECT_SELF;
if (sTag != "")
oCompanion = GetNearestObjectByTag(sTag, GetFirstPC());
if (!GetIsObjectValid(oCompanion))
return;
string sName = GetRosterNameFromObject(oCompanion);
RemoveRosterMemberFromParty(sName, GetFirstPC(), FALSE);
if (GetIsDead(oCompanion))
SetIsDestroyable(FALSE, TRUE, TRUE);
}
--
//gc_is_in_party
//
// If no sTag specified, use conversation owner
#include "ginc_param_const"
int StartingConditional(string sTag)
{
object oPC = GetPCSpeaker();
object oCompanion = OBJECT_SELF;
if (sTag != "")
oCompanion = GetNearestObjectByTag(sTag, oPC);
int bRet = GetFactionEqual(oPC, oCompanion);
return (bRet);
}
#3
Posté 19 décembre 2011 - 09:06
nevermind
Modifié par Morbane, 19 décembre 2011 - 09:07 .
#4
Posté 19 décembre 2011 - 01:05
I like the look of those scripts, Dann, especially the feature where you can add to the roster and to the party using just one script.
#5
Posté 19 décembre 2011 - 08:15
I also have a ga_super_add script if you are interested I will post it.
#6
Posté 19 décembre 2011 - 10:41
M. Rieder wrote...
I like the look of those scripts, Dann, especially the feature where you can add to the roster and to the party using just one script.
I made the add/remove scripts so that I didn't need to populate any variables and they'd still work. Provided every companion has a unique first name, and you are adding or removing them from their own conversation, then the default values do all the work for you. That was handy when testing modules, since I could initially give every companion the same conversation with nothing but add/remove options in it.
The only thing they don't do is make the roster member non-selectable when they leave the party. That means that you can add them back into the party at any time by using the roster GUI without having to go and find them and talk to them (provided they've been added to the roster at least once). I only discovered the roster GUI recently though, since I rarely use any of the menu functions you get by clicking on the NWN eye symbol in the lower-left of the screen.
#7
Posté 20 décembre 2011 - 08:10
This is my ga_super_add which is a combined script from the stock scripts - there were originally 4 of them that had to be added to a conversation (from the tutorials anyway) and I had frequent problems with them working without having to tweak something most of the time.
#include "ginc_param_const"
#include "ginc_debug"
#include "ginc_misc"
void main(string sRoster_Name, int bSelectable = 1)
{
//ga_roster_add_object
object oCharacter = GetTarget(sRoster_Name, TARGET_OWNER);
int bResult = AddRosterMemberByCharacter(sRoster_Name, oCharacter);
//ga_roster_selectable
bResult = SetIsRosterMemberSelectable(sRoster_Name, bSelectable);
//ga_roster_party_add
object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());
bResult = AddRosterMemberToParty(sRoster_Name, oPC);
//ga_reset_level
object oCreature = GetObjectByTag( sRoster_Name );
int nXP = GetPCAverageXP();
SetXP(oCharacter, nXP);
ForceRest( oCreature );
}
mayhap it will be useful as I have had good success with it.
#include "ginc_param_const"
#include "ginc_debug"
#include "ginc_misc"
void main(string sRoster_Name, int bSelectable = 1)
{
//ga_roster_add_object
object oCharacter = GetTarget(sRoster_Name, TARGET_OWNER);
int bResult = AddRosterMemberByCharacter(sRoster_Name, oCharacter);
//ga_roster_selectable
bResult = SetIsRosterMemberSelectable(sRoster_Name, bSelectable);
//ga_roster_party_add
object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());
bResult = AddRosterMemberToParty(sRoster_Name, oPC);
//ga_reset_level
object oCreature = GetObjectByTag( sRoster_Name );
int nXP = GetPCAverageXP();
SetXP(oCharacter, nXP);
ForceRest( oCreature );
}
mayhap it will be useful as I have had good success with it.
Modifié par Morbane, 20 décembre 2011 - 08:11 .
#8
Posté 20 décembre 2011 - 05:58
Dann and Morbane, those are both very useful looking scripts. I really like tha automation built into the scripts.
So have either of you ever had problem with the stock script for removal and despawning?
So have either of you ever had problem with the stock script for removal and despawning?
#9
Posté 20 décembre 2011 - 08:56
To be honest - recently I have been using the roster GUI - but I havent had problems with removing and despawning from there.





Retour en haut






