I'm trying to modify the DS scenario of Onderon throneroom battle for TSLRP II. It was originally intended that Vaklu would arrive to the throneroom after the PC with some troops and fight his way towards the queen only to be stopped and stunned by Kavar. The PC would then step between Vaklu and Kavar leading to new dialogue between the two. The script I'm using for this scene has some serious problems however.
It appears that some of the commands in the script below work fine while other very similar commands don't work at all and I've no idea why. I've marked the parts that don't work with comments. Perhaps you guys could take a look at it and hopefully be able to tell me what is wrong with it. Any help would be appreciated.
void main() {
int nParam1 = GetScriptParameter(1);
object oPC = GetFirstPC();
object oKavar = GetObjectByTag("kavar", 0);
object oVaklu = GetObjectByTag("vaklu", 0);
object oTalia = GetObjectByTag("talia", 0);
object oSold1 = GetObjectByTag("te_va_sold", 0);
object oSold2 = GetObjectByTag("te_va_sold", 1);
object oSold3 = GetObjectByTag("te_va_sold", 2);
object oSold4 = GetObjectByTag("te_va_sold", 3);
int index;
float timer;
switch (nParam1) {
case 0:
{
// Command the two new Royalist soldiers.
object oRVictim1 = GetObjectByTag("te_ro_victim", 0);
object oRVictim2 = GetObjectByTag("te_ro_victim", 1);
ActionPauseConversation();
// Reposition the PC to an entirely new waypoint.
// Moved from the trigger "tr_kavar_enter" because
// for some reason this doesn't work there.
// This is in exactly same form as it was in another
// script.
if (GetIsObjectValid(oPC)) {
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ClearAllEffects());
location lPC = Location(Vector(-4.0, 169.0, 0.0), 55.0);
AssignCommand(oPC, ActionJumpToLocation(lPC));
}
// First waypoints for Vaklu and the soldiers.
location lVic1 = Location(Vector(4.0, 163.0, 0.0), 255.0);
location lVic2 = Location(Vector(3.5, 164.5, 0.0), 240.0);
location lVaklu1 = Location(Vector(0.0, 164.5, 0.0), 90.0);
location lSold1 = Location(Vector(-1.0, 157.0, 0.0), 85.0);
location lSold2 = Location(Vector(2.5, 156.0, 0.0), 90.0);
location lSold3 = Location(Vector(-3.5, 158.0, 0.0), 90.0);
location lSold4 = Location(Vector(-3.0, 157.5, 0.0), 115.0);
// Make recently spawned soldiers fight by changing their factions.
ChangeToStandardFaction(oSold1, 2);
ChangeToStandardFaction(oSold2, 2);
ChangeToStandardFaction(oSold3, 2);
ChangeToStandardFaction(oSold4, 2);
DelayCommand(3.5, ChangeToStandardFaction(oRVictim1, 1));
DelayCommand(3.5, ChangeToStandardFaction(oRVictim2, 1));
// Make Vaklu's guards advance and new Royalist confront them.
// DOES NOT WORK!!! Only Vaklu will start moving.
AssignCommand(oSold1, ClearAllActions());
DelayCommand(1.0, AssignCommand(oSold1, ActionForceMoveToLocation(lSold1, TRUE)));
AssignCommand(oSold2, ClearAllActions());
DelayCommand(1.0, AssignCommand(oSold2, ActionForceMoveToLocation(lSold2, TRUE)));
AssignCommand(oSold3, ClearAllActions());
DelayCommand(1.0, AssignCommand(oSold3, ActionForceMoveToLocation(lSold3, TRUE)));
AssignCommand(oSold4, ClearAllActions());
DelayCommand(1.0, AssignCommand(oSold4, ActionForceMoveToLocation(lSold4, TRUE)));
AssignCommand(oVaklu, ClearAllActions());
DelayCommand(2.0, AssignCommand(oVaklu, ActionForceMoveToLocation(lVaklu1, FALSE)));
AssignCommand(oRVictim1, ClearAllActions());
DelayCommand(1.0, AssignCommand(oRVictim1, ActionForceMoveToLocation(lVic1, TRUE)));
AssignCommand(oRVictim2, ClearAllActions());
DelayCommand(1.0, AssignCommand(oRVictim2, ActionForceMoveToLocation(lVic2, TRUE)));
// Vaklu's guards shoot the new royalists.
// DOES NOT WORK!!! They raise their blasters but no shots are fired.
ApplyEffectToObject(1, EffectAssuredHit(), oSold1, 10.0);
ApplyEffectToObject(1, EffectAssuredHit(), oSold2, 10.0);
DelayCommand(4.0, AssignCommand(oSold1, ClearAllActions()));
DelayCommand(4.2, AssignCommand(oSold1, ActionAttack(oRVictim1, 0)));
DelayCommand(4.5, AssignCommand(oSold2, ClearAllActions()));
DelayCommand(4.7, AssignCommand(oSold2, ActionAttack(oRVictim2, 0)));
// Kill off rest of the Royalist troops. Moved from "tr_kavar_enter"
// and modified so that they don't all die at same time.
index = 0;
timer = 6.0;
object oVa_sold_hvyThrone;
object oVa_sold_gunThrone;
object oRo_sold_hvyThrone;
object oRo_sold_gunThrone;
effect efDeath = EffectDeath(0, 1, 0);
while ((index < 4)) {
oVa_sold_hvyThrone = GetObjectByTag("va_sold_hvyThrone", index);
DelayCommand(timer, ChangeToStandardFaction(oVa_sold_hvyThrone, 5));
oVa_sold_gunThrone = GetObjectByTag("va_sold_gunThrone", index);
DelayCommand(timer, ChangeToStandardFaction(oVa_sold_gunThrone, 5));
oRo_sold_hvyThrone = GetObjectByTag("ro_sold_hvyThrone", index);
DelayCommand(timer, ApplyEffectToObject(0, efDeath, oRo_sold_hvyThrone, 0.0));
oRo_sold_gunThrone = GetObjectByTag("ro_sold_gunThrone", index);
DelayCommand(timer, ApplyEffectToObject(0, efDeath, oRo_sold_gunThrone, 0.0));
timer = (timer + 1.2);
(index++);
}
// Make Vaklu's guards neutral to prevent them from joining the battle between
// Kavar and the PC or being killed by Kavar.
DelayCommand(10.0, ChangeToStandardFaction(oSold1, 5));
DelayCommand(10.5, AssignCommand(oSold1, ClearAllActions()));
DelayCommand(10.0, ChangeToStandardFaction(oSold2, 5));
DelayCommand(10.5, AssignCommand(oSold2, ClearAllActions()));
DelayCommand(10.0, ChangeToStandardFaction(oSold3, 5));
DelayCommand(10.5, AssignCommand(oSold3, ClearAllActions()));
DelayCommand(10.0, ChangeToStandardFaction(oSold4, 5));
DelayCommand(10.5, AssignCommand(oSold4, ClearAllActions()));
// Second waypoints for Vaklu's guards.
lSold1 = Location(Vector(1.0, 163.5, 0.0), 90.0);
lSold2 = Location(Vector(3.5, 162.5, 0.0), 90.0);
lSold3 = Location(Vector(-2.0, 163.0, 0.0), 90.0);
lSold4 = Location(Vector(-3.0, 163.5, 0.0), 90.0);
// Vaklu's guards run towards Kavar and the queen.
DelayCommand(12.0, AssignCommand(oSold1, ActionForceMoveToLocation(lSold1, TRUE)));
DelayCommand(12.0, AssignCommand(oSold2, ActionForceMoveToLocation(lSold2, TRUE)));
DelayCommand(12.0, AssignCommand(oSold3, ActionForceMoveToLocation(lSold2, TRUE)));
DelayCommand(12.0, AssignCommand(oSold4, ActionForceMoveToLocation(lSold2, TRUE)));
DelayCommand(16.0, ActionResumeConversation());
}
break;
case 1:
{
ActionPauseConversation();
// Make starting locations for Vaklu and his troops close to Kavar.
location lVaklu = Location(Vector(0.0, 166.5, 0.0), 90.0);
location lLoc1 = Location(Vector(-1.5, 168.0, 0.0), 75.0);
location lLoc2 = Location(Vector(2.0, 168.0, 0.0), 115.0);
location lLoc3 = Location(Vector(-3.0, 169.0, 0.0), 35.0);
location lLoc4 = Location(Vector(3.5, 169.5, 0.0), 160.0);
// Jump Vaklu and his troops to their marks.
AssignCommand(oVaklu, ClearAllActions());
AssignCommand(oVaklu, ClearAllEffects());
AssignCommand(oVaklu, ActionJumpToLocation(lVaklu));
AssignCommand(oSold1, ClearAllActions());
AssignCommand(oSold1, ClearAllEffects());
AssignCommand(oSold1, ActionJumpToLocation(lLoc1));
AssignCommand(oSold2, ClearAllActions());
AssignCommand(oSold2, ClearAllEffects());
AssignCommand(oSold2, ActionJumpToLocation(lLoc2));
AssignCommand(oSold3, ClearAllActions());
AssignCommand(oSold3, ClearAllEffects());
AssignCommand(oSold3, ActionJumpToLocation(lLoc3));
AssignCommand(oSold4, ClearAllActions());
AssignCommand(oSold4, ClearAllEffects());
AssignCommand(oSold4, ActionJumpToLocation(lLoc4));
// Make new waypoints for Vaklu and his troops.
lVaklu = Location(Vector(0.0, 168.0, 0.0), 90.0);
lLoc1 = Location(Vector(-1.0, 169.5, 0.0), 75.0);
lLoc2 = Location(Vector(1.5, 169.5, 0.0), 115.0);
lLoc3 = Location(Vector(-2.5, 170.5, 0.0), 35.0);
lLoc4 = Location(Vector(3.0, 171.0, 0.0), 160.0);
// Vaklu and his troops approach Kavar.
DelayCommand(1.0, AssignCommand(oVaklu, ActionMoveToLocation(lVaklu, TRUE)));
DelayCommand(1.0, AssignCommand(oSold1, ActionMoveToLocation(lLoc1, TRUE)));
DelayCommand(1.0, AssignCommand(oSold2, ActionMoveToLocation(lLoc2, TRUE)));
DelayCommand(1.0, AssignCommand(oSold3, ActionMoveToLocation(lLoc3, TRUE)));
DelayCommand(1.0, AssignCommand(oSold4, ActionMoveToLocation(lLoc4, TRUE)));
effect ePush = EffectForcePushTargeted(GetLocation(oKavar), 0);
effect eStun = EffectStunned();
// Kavar Forcepushes and then stuns Vaklu and his troops.
DelayCommand(2.0, AssignCommand(oKavar, ActionPlayAnimation(ANIMATION_FIREFORGET_FORCE_CAS T, 1.0)));
DelayCommand(2.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, ePush, oVaklu));
DelayCommand(2.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, ePush, oSold1));
DelayCommand(2.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, ePush, oSold2));
DelayCommand(2.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, ePush, oSold3));
DelayCommand(2.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, ePush, oSold4));
DelayCommand(3.5, AssignCommand(oKavar, ActionPlayAnimation(ANIMATION_FIREFORGET_FORCE_CAS T, 1.0)));
DelayCommand(3.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eStun, oVaklu));
DelayCommand(3.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eStun, oSold1));
DelayCommand(3.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eStun, oSold2));
DelayCommand(3.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eStun, oSold3));
DelayCommand(3.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eStun, oSold4));
// DOES NOT WORK!!! Conversation does not seem to continue past this node.
// Leaves the player stuck. Only way to quit the game is to do so from the
// taskmanager.
DelayCommand(6.0, ActionResumeConversation());
}
break;
case 2:
{
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ClearAllEffects());
// PC moves to confront Kavar.
// DOES NOT WORK!!!
object oWP_MASTER_CUT_PC1 = GetObjectByTag("WP_MASTER_CUT_PC1", 0);
DelayCommand(0.5, AssignCommand(oPC, ActionForceMoveToLocation(GetLocation(oWP_MASTER_C UT_PC1), FALSE)));
DelayCommand(3.0, AssignCommand(oPC, ActionDoCommand(SetFacingPoint(GetPosition(oKavar) ))));
}
break;
}
}