I have a conversation that needs some party leader scripts added. I’m wanting players to have the option to join their party leader’s quest.
The first part I need help with, is a starting conditional that only displays the conversation option if the player is NOT the party leader.
If they aren’t the party leader, then when selecting that option in the conversation, they’ll be teleported to a waypoint. However, they can only teleport to the party leader if the party leader has an item in their inventory.
If party leader has an item with the tag “quest” and that item has a local int (“PC_QUEST”, 1), then teleport the player to “waypoint001”
else if party leader has an item with the tag “quest” and that item has a local int (“PC_QUEST”, 2), then teleport the player to “waypoint002”
else do nothing and send a floating text over the player’s head “Your party leader is not currently on a quest.”
void main()
{
object oPC = GetPCSpeaker();
object oLeader = GetFactionLeader(oPC);
object oItem = GetItemPossessedBy(oLeader, "quest");
// If the party leader possesses the item:
if (oItem != OBJECT_INVALID)
{
string sTargetWP;
int nJump;
int nQuest = GetLocalInt(oItem, "PC_QUEST");
switch (nQuest)
{
case 1:
nJump = TRUE;
sTargetWP = "waypoint001";
break;
case 2:
nJump = TRUE;
sTargetWP = "waypoint002";
break;
default:
SendMessageToPC(oPC, "This quest is not listed as joinable.");
break;
}
if (nJump)
{
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, JumpToObject(GetWaypointByTag(sTargetWP)));
}
}
else
{
// The party leader does not possess the quest item.
SendMessageToPC(oPC, "Your party leader is not currently on a quest.");
}
}
I don’t think there are events for that. What exactly do you need to happen on party join/leave, and why? Maybe there are alternatives. Party management usable item? If party joining/leaving was handled via an item or custom spells, you could tie scripted events into the item/spell script.
Possibly a case for the archmage rungs of NWN wizardry. @Shadooow, I invoke you! The question is “How to have stuff happen when players join or leave a party?”.
If this is persistent world it would be doable easier as player doesn’t need the nwnx plugin.
I guess, you need to do it via hearbeat which obviously won’t be as precise. And are you tracking henchmans or players? Anyway, it would be something like this:
in henchman heartbeat:
check if GetMaster() is valid
if yes
– check if master matches last master stored in local variable, if yes return
– if no, set master into local variable, run OnPartyLeft on last master, run OnPartyJoin on current master
if no
– check if there is a valid master stored in local variable, if no return
– if yes, run OnPartyLeft on him and delete the variable containing master
If you want to track players leaving party, you cannot use GetMaster, it would be bit more complicated. Also you need to use script named ‘default’.
if (!GetIsPC(oPC)) return;
ExploreAreaForPlayer(GetArea(oPC), oPC);
int nBosscount = GetLocalInt(oTarget, "BOSS_COUNTER");
++nBosscount;
SetLocalInt(oTarget, "BOSS_COUNTER", nBosscount);
}
This works great, it’s adding the int on the area as needed for each player that enters. However, I’m trying to also have the int count a specific creature that may enter the area with players also.