I've been trying to create a timed combat sequence to simulate a fight onboard a burning pirate ship. The captain takes the player(s) on deck to make them walk the plank, but during the conversation a fire starts and combat begins. After a period of time the ship will explode and all players will be ported to a new location on a beach near a wrecked pirate ship. This is part of a quest and the party port is the only way to advance to this location. Defeating the pirate caption rewards the player with the key to the pirate captain's house with some nice items stored inside.
If the player(s) defeat the pirates, the script works just fine, and everyone is ported. However the problem is that the party port will not fire if the fight has not been completed. My first guess would be that the port will not happen during combat. Is this a NWN limitation, or is it possible to make it work during combat?
The script is fired in a conversation with the pirate captain. Another script on the last line of the conversation will turn the captain hostile. The captain's corpse has been set to max, so his death will not end the script. I thought to have the script destroy the pirates just before time runs out to stop the combat, but I think that will end the script because the captain is gone. Perhaps using effect death on the captain would work. I figured I would ask here on this forum for a solution before making any changes. I know there are some expert scripters here, and I'm sure one of you would know the best solution for my problem.
Any help would be greatly appreciated. Thank you.
Here is the script:
#include "nw_i0_2q4luskan"
void main()
{
object oPC = GetPCSpeaker();
object oCaster;
oCaster = GetObjectByTag("sot_firebarrel");
object oTarget;
oTarget = GetObjectByTag("sot_firebarrel");
AssignCommand(oCaster, ActionCastSpellAtObject(SPELL_FIREBALL, oTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
object oSpawn;
location lTarget;
oTarget = GetWaypointByTag("sot_WPfire1a");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "plc_flamelarge", lTarget);
oTarget = GetWaypointByTag("sot_WPfire1b");
lTarget = GetLocation(oTarget);
DelayCommand(30.0, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "plc_flamelarge", lTarget));
oTarget = GetWaypointByTag("sot_WPfire1f");
lTarget = GetLocation(oTarget);
DelayCommand(60.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "northlandpirate", lTarget));
oTarget = GetWaypointByTag("sot_WPfire1c");
lTarget = GetLocation(oTarget);
DelayCommand(90.0, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "plc_flamelarge", lTarget));
oTarget = GetWaypointByTag("sot_WPfire1d");
lTarget = GetLocation(oTarget);
DelayCommand(120.0, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "plc_flamelarge", lTarget));
oTarget = GetWaypointByTag("sot_WPfire1f");
lTarget = GetLocation(oTarget);
DelayCommand(150.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "northpiratemage", lTarget));
oTarget = GetWaypointByTag("sot_WPfire1e");
lTarget = GetLocation(oTarget);
DelayCommand(180.0, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "plc_flamelarge", lTarget));
oTarget = GetWaypointByTag("sot_WPfire1g");
lTarget = GetLocation(oTarget);
DelayCommand(210.0, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "plc_flamelarge", lTarget));
oTarget = GetWaypointByTag("sot_WPfire1f");
lTarget = GetLocation(oTarget);
DelayCommand(240.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "northlandpirate", lTarget));
lTarget = GetLocation(oTarget);
DelayCommand(250.0, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "plc_flamelarge", lTarget));
oTarget = GetWaypointByTag("sot_WPfire1h");
lTarget = GetLocation(oTarget);
DelayCommand(270.0, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "plc_flamelarge", lTarget));
oTarget = GetWaypointByTag("sot_WPfire1i");
lTarget = GetLocation(oTarget);
DelayCommand(290.0, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "plc_flamelarge", lTarget));
oTarget = GetWaypointByTag("sot_WPfire1j");
lTarget = GetLocation(oTarget);
DelayCommand(310.0, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "plc_flamelarge", lTarget));
oTarget = GetWaypointByTag("sot_WPfire1k");
lTarget = GetLocation(oTarget);
DelayCommand(330.0, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "plc_flamelarge", lTarget));
oTarget = GetWaypointByTag("sot_WPfire1l");
lTarget = GetLocation(oTarget);
DelayCommand(340.0, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "plc_flamelarge", lTarget));
DelayCommand(350.0, AssignCommand(oPC, ActionSpeakString("THE SHIP'S GOING TO BLOW! JUMP IN THE WATER!")));
oCaster = GetObjectByTag("sot_firebarrel");
oTarget = GetObjectByTag("sot_WPfire1a");
DelayCommand(360.0, AssignCommand(oCaster, ActionCastSpellAtLocation(SPELL_FIREBALL, GetLocation(oTarget), METAMAGIC_ANY, TRUE,
PROJECTILE_PATH_TYPE_DEFAULT, FALSE)));
oCaster = GetObjectByTag("sot_firebarrel");
oTarget = GetObjectByTag("sot_WPfire1b");
DelayCommand(360.0, AssignCommand(oCaster, ActionCastSpellAtLocation(SPELL_FIREBALL, GetLocation(oTarget), METAMAGIC_ANY, TRUE,
PROJECTILE_PATH_TYPE_DEFAULT, FALSE)));
oCaster = GetObjectByTag("sot_firebarrel");
oTarget = GetObjectByTag("sot_WPfire1c");
DelayCommand(360.0, AssignCommand(oCaster, ActionCastSpellAtLocation(SPELL_FIREBALL, GetLocation(oTarget), METAMAGIC_ANY, TRUE,
PROJECTILE_PATH_TYPE_DEFAULT, FALSE)));
oCaster = GetObjectByTag("sot_firebarrel");
oTarget = GetObjectByTag("sot_WPfire1d");
DelayCommand(360.0, AssignCommand(oCaster, ActionCastSpellAtLocation(SPELL_FIREBALL, GetLocation(oTarget), METAMAGIC_ANY, TRUE,
PROJECTILE_PATH_TYPE_DEFAULT, FALSE)));
oCaster = GetObjectByTag("sot_firebarrel");
oTarget = GetObjectByTag("sot_WPfire1e");
DelayCommand(360.0, AssignCommand(oCaster, ActionCastSpellAtLocation(SPELL_FIREBALL, GetLocation(oTarget), METAMAGIC_ANY, TRUE,
PROJECTILE_PATH_TYPE_DEFAULT, FALSE)));
oCaster = GetObjectByTag("sot_firebarrel");
oTarget = GetObjectByTag("sot_WPfire1f");
DelayCommand(360.0, AssignCommand(oCaster, ActionCastSpellAtLocation(SPELL_FIREBALL, GetLocation(oTarget), METAMAGIC_ANY, TRUE,
PROJECTILE_PATH_TYPE_DEFAULT, FALSE)));
oCaster = GetObjectByTag("sot_firebarrel");
oTarget = GetObjectByTag("sot_WPfire1g");
DelayCommand(360.0, AssignCommand(oCaster, ActionCastSpellAtLocation(SPELL_FIREBALL, GetLocation(oTarget), METAMAGIC_ANY, TRUE,
PROJECTILE_PATH_TYPE_DEFAULT, FALSE)));
oCaster = GetObjectByTag("sot_firebarrel");
oTarget = GetObjectByTag("sot_WPfire1h");
DelayCommand(360.0, AssignCommand(oCaster, ActionCastSpellAtLocation(SPELL_FIREBALL, GetLocation(oTarget), METAMAGIC_ANY, TRUE,
PROJECTILE_PATH_TYPE_DEFAULT, FALSE)));
oCaster = GetObjectByTag("sot_firebarrel");
oTarget = GetObjectByTag("sot_WPfire1i");
DelayCommand(360.0, AssignCommand(oCaster, ActionCastSpellAtLocation(SPELL_FIREBALL, GetLocation(oTarget), METAMAGIC_ANY, TRUE,
PROJECTILE_PATH_TYPE_DEFAULT, FALSE)));
oCaster = GetObjectByTag("sot_firebarrel");
oTarget = GetObjectByTag("sot_WPfire1j");
DelayCommand(360.0, AssignCommand(oCaster, ActionCastSpellAtLocation(SPELL_FIREBALL, GetLocation(oTarget), METAMAGIC_ANY, TRUE,
PROJECTILE_PATH_TYPE_DEFAULT, FALSE)));
oCaster = GetObjectByTag("sot_firebarrel");
oTarget = GetObjectByTag("sot_WPfire1k");
DelayCommand(360.0, AssignCommand(oCaster, ActionCastSpellAtLocation(SPELL_FIREBALL, GetLocation(oTarget), METAMAGIC_ANY, TRUE,
PROJECTILE_PATH_TYPE_DEFAULT, FALSE)));
oCaster = GetObjectByTag("sot_firebarrel");
oTarget = GetObjectByTag("sot_WPfire1l");
DelayCommand(360.0, AssignCommand(oCaster, ActionCastSpellAtLocation(SPELL_FIREBALL, GetLocation(oTarget), METAMAGIC_ANY, TRUE,
PROJECTILE_PATH_TYPE_DEFAULT, FALSE)));
object oParty = GetFirstFactionMember(oPC);
oTarget = GetWaypointByTag("sot_WPruinedshipcove");
lTarget = GetLocation(oTarget);
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
AssignCommand(oPC, ClearAllActions());
DelayCommand(365.0, AssignCommand(oPC, ActionJumpToLocation(lTarget)));
oTarget = oPC;
while (GetIsObjectValid(oParty))
{
if(GetArea(oPC)==GetArea(oParty))
{
DelayCommand(365.0, AssignCommand(oParty, ActionJumpToLocation(lTarget)));
}
oParty = GetNextFactionMember(oPC);
}
}