Skip to content

Tiny Cutscene Script Help

ZephiriusZephirius Member Posts: 419
edited October 2022 in Builders - Scripting
I've got a small script set to have actor 1 (duergar slaver) and actor 2 (a stone golem) fight. To be clear, they are already in combat when you encounter them fighting. When you enter the trigger, she does a whirlwind attack on the stone golem, knocks him on his keister, and he dies, then she initiates a dialog with the PC. Trouble is they're busy fighting, and it won't start the script.

The problem is i want the PC to stumble upon them in combat...

I guess my question is this, how do I make it, so the two actors continue to fight until you cross the trigger. At this point I want the script to fire...

Right now, they continue to fight but won't initiate the cutscene.

rxx Cutscene:
#include "nw_i0_spells"
#include "in_g_cutscene"

//:///////////////////////////////////////
//::///////////////////////////////////////
// Cutscene #1 - "The Taming of the Shrewd!"
//:::://///////////////////////////////////
///////////////////////////////////////////

void main()
{
    object oPC = GetEnteringObject();
    if (!GetIsPC(oPC)) return; // Valid PC check.

    if ( GetLocalInt(oPC, "DO_ONCE__" + GetTag(OBJECT_SELF)) ) return;
         SetLocalInt(oPC, "DO_ONCE__" + GetTag(OBJECT_SELF), TRUE);

    SetCutsceneMode(oPC, TRUE, FALSE);

        // Disappear the PC for the duration of the script.
        ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect
        (VFX_DUR_CUTSCENE_INVISIBILITY), oPC);

   FadeToBlack(oPC, FADE_SPEED_FASTEST);
   DelayCommand(1.5, FadeFromBlack(oPC, FADE_SPEED_FASTEST));

   // Declare the actors of this shindig.
   object oGolem = GetObjectByTag("ST_GOLEM_ACTOR_01");
   object oSlaver = GetObjectByTag("DUERGAR001_SLAVER_GIRL");

   if (GetIsInCombat(oSlaver)||GetIsInCombat(oGolem))
   {

    // Begin camera movement.
    GestaltCameraMove(0.5, 220.0, 5.5, 80.0, 17.5, 12.5, 65.0, 4.5, 100.0, oPC, 0, 0, 0);

            DelayCommand(1.0, AssignCommand(oSlaver, DoWhirlwindAttack(TRUE, TRUE)));
            DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_INSTANT,
            EffectKnockdown(), oGolem));

            effect eEffect;
            // Apply an effect.
            oGolem = GetObjectByTag("ST_GOLEM_ACTOR_01");
            eEffect = SupernaturalEffect(EffectDeath());
            DelayCommand(2.3, ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oGolem));

    DelayCommand(4.0, SetCutsceneMode(oPC, FALSE, TRUE));
    DelayCommand(4.0, RemoveSpecificEffect(EFFECT_TYPE_VISUALEFFECT, oPC));

    DelayCommand(4.3, AssignCommand(oSlaver, ClearAllActions()));
    DelayCommand(4.7, AssignCommand(oSlaver, ActionForceMoveToObject(oPC)));

    DelayCommand(5.3, AssignCommand(oPC, SetFacing(90.0)));
    DelayCommand(5.8, AssignCommand(oSlaver, ActionStartConversation(oPC, "zc_duergar_slvr")));

    DelayCommand(6.0, SetImmortal(oSlaver, FALSE));

    DestroyObject(GetObjectByTag("BLOCK_01"), 7.0);
    DestroyObject(GetObjectByTag("BLOCK_02"), 8.0);
    DestroyObject(GetObjectByTag("BLOCK_03"), 9.0);
    DestroyObject(GetObjectByTag("BLOCK_04"), 10.0);
  }
}
Post edited by Zephirius on

Comments

  • ProlericProleric Member Posts: 1,316
    In order to get control of the situation, you have to stop combat with ClearAllActions(TRUE).

    Forgetting the Whirlwind Attack for a moment, when the PC triggers the cutscene, you could remove immortality from the golem, let the slaver kill them, then use the golem OnDeath event to clear the slaver's combat state and start conversation.

    Forcing specific moves during combat can be tricky in my experience. You could try stopping combat before the whirlwind attack. If that doesn't work reliably, I guess you could use the slaver's CombatRoundEnd event to detect that the cutscene has started, stop combat, and then whirlwind attack, hopefully by-passing the combat AI. Others probably know more.
  • ZephiriusZephirius Member Posts: 419
    Proleric, you're awesome! Gonna give this a try. Great information!
  • TerrorbleTerrorble Member Posts: 179
    Proleric wrote: »

    Forcing specific moves during combat can be tricky in my experience.


    I've used the End Combat Round event to check things and trigger all sorts of things with a lot of success. But, the same method gives inconsistent results when trying to get creatures to do specific things while in combat. I get better results when I use the End Combat Round event to determine when I want a specific combat behavior to occur, then set a custom AI script var on the creature. Then I have the code for the combat action occur inside that script. Once they've done the combat stuff, then I can delete the custom AI var which allows the default AI to pick up again. It's a nice way to have a certain thing happen (like a certain spell cast in a certain situation) without trying to write an entire AI scheme.

    I can't claim to understand all its parts, but if you find you're having trouble I can give you more info on how to setup the AI script part.
Sign In or Register to comment.