Jump to content

Home

Need Help With Cutscene


deathdisco

Recommended Posts

I need some help with a cutscene. I'm scripting an ambush scenario but my Sith assassins won't attack.

The first two scripts work fine:

1st script, spawn Sith assassins.

2nd script, remove stealth effect, change faction of Rep Soldiers to 2 (assassins are faction 1).

 

http://home.comcast.net/~deathdisco/images/cut1.jpg

 

The third script is suppost to have assassins attack and neutralize Rep Soldiers but all they do is drop to a ready stance and do nothing else.

 

http://home.comcast.net/~deathdisco/images/cut2.jpg

 

Here's the script I'm using.

void main()  
{  
object oNPC = GetObjectByTag("n_sithsoldier002");
 	object oNPC1 = GetObjectByTag("n_sithsoldier003");
 	object oTarget = GetObjectByTag("repfod");
 	object oTarget1 = GetObjectByTag("repfod1");
 	AssignCommand(oNPC, ActionDoCommand(CutsceneAttack(oTarget, 416, 2, 500)));
 	AssignCommand(oNPC1, ActionDoCommand(CutsceneAttack(oTarget1, 416, 2, 500)));
 	SendMessageToPC(GetFirstPC(), "Fire3");  
}

 

I also need them to move to a location or waypoint after they're done but the script I'm using isn't working.

void main()  
{  	location locA = Location(Vector(0.33,-173.79,-1.55), 0.0);
 	object oNPC = GetObjectByTag("n_sithsoldier002");
 	object oNPC1 = GetObjectByTag("n_sithsoldier003");
 	AssignCommand(oNPC, ActionMoveToLocation(locA, FALSE));
 	AssignCommand(oNPC1, ActionMoveToLocation(locA, FALSE));
 	SendMessageToPC(GetFirstPC(), "Fire5");  
}

The scripts are firing as they show up in my message feedback. I'm guessing the commands are getting hung up somewhere in the script (maybe needs to be streamlined) or I'm using the wrong animation number (2HS_Perform_Flurry_3 in animations.2da). But even after the Rep Soldiers start firing on them, they won't attack.

 

My scripting knowledge is limited to trial and error and picking apart existing scipts/nwscript. So any help is greatly appreciated.

TIA.

Link to comment
Share on other sites

I am getting a bit rusty with this but in the first script, instead of using

AssignCommand(oNPC, ActionDoCommand(CutsceneAttack(oTarget, 416, 2, 500)));

 

Try:

AssignCommand(oNPC, ActionDoCommand(CutsceneAttack(oTarget, 416, ATTACK_RESULT_CRITICAL_HIT, 500)));

 

Note that if the npcs don't have the specified animation, they can't play it.

 

Also, how are you firing your scripts? It may be a problem with the action queue. Try to use the DelayCommand function.

Link to comment
Share on other sites

These variants worked when I tested:

 

void main() {  
   object oNPC = GetObjectByTag("n_sithsoldier002");
   object oNPC1 = GetObjectByTag("n_sithsoldier003");
   object oTarget = GetObjectByTag("repfod");
   object oTarget1 = GetObjectByTag("repfod1");

   SetLocalBoolean(oNPC, 87, TRUE);
   SetLocalBoolean(oNPC1, 87, TRUE);
   SetLocalBoolean(oTarget, 87, TRUE);
   SetLocalBoolean(oTarget1, 87, TRUE);

   ChangeToStandardFaction(oNPC, STANDARD_FACTION_HOSTILE_1);
   ChangeToStandardFaction(oNPC1, STANDARD_FACTION_HOSTILE_1);
   ChangeToStandardFaction(oTarget, STANDARD_FACTION_FRIENDLY_1);
   ChangeToStandardFaction(oTarget1, STANDARD_FACTION_FRIENDLY_1);

   DelayCommand(0.1, AssignCommand(oNPC, CutsceneAttack(oTarget, 416, ATTACK_RESULT_CRITICAL_HIT, GetCurrentHitPoints(oTarget))));
   DelayCommand(0.1, AssignCommand(oNPC1, CutsceneAttack(oTarget1, 416, ATTACK_RESULT_CRITICAL_HIT, GetCurrentHitPoints(oTarget1))));

   SendMessageToPC(GetFirstPC(), "Fire3");  
}

 

You'll need to block out the combat AI if you want it to work reliably, or there is a chance it might clear the action queue and initiate normal attacks when the NPCs go hostile to each other instead. Further, ActionDoCommand() is unnecessary to use here and only make the script less reliable since the action queue might be cleared. Better to make them do things directly when possible in a cutscene.

 

void main()  {      
   location locA = Location(Vector(0.33,-173.79,-1.55), 0.0);

   object oNPC = GetObjectByTag("n_sithsoldier002");
   object oNPC1 = GetObjectByTag("n_sithsoldier003");

   SetLocalBoolean(oNPC, 87, TRUE);
   SetLocalBoolean(oNPC1, 87, TRUE);   

   CancelCombat(oNPC);
   CancelCombat(oNPC1);
   AssignCommand(oNPC, ClearAllActions());
   AssignCommand(oNPC1, ClearAllActions());

   AssignCommand(oNPC, ActionMoveToLocation(locA, FALSE));
   AssignCommand(oNPC1, ActionMoveToLocation(locA, FALSE));

   SendMessageToPC(GetFirstPC(), "Fire5");  
}

 

Here it's safer to make sure the NPC isn't in combat mode and have any actions queued before starting to move, and to disable the AI as well to block out any combat or patrolling actions it may issue.

 

Also make sure your coordinates are set to a walkable/reachable location in the area. If the coordinates cannot be reached the character will not move at all.

Link to comment
Share on other sites

Still no luck. :(

Since you tested the scripts, maybe the problem is in the dialog file?

The dialog is fired when my PC passes over a trigger. I'm using a camera to set the field of view. All scripts are fired from the entries. I playing with the entry delays to set pacing and maybe giving the scripts enough time to fire. There're seven scripts total only these two are not working.

 

This is the order of the scripts I'm using.

1.spawn assassins

2.remove stealth effect

3.attack--->not working

4.open door

5.walk to location--->not working(z cord was slightly off but still same result)

6.re-apply stealth effect, destroy object

7.close door

 

TIA.

Link to comment
Share on other sites

Ok, the scripts are firing but the commands are not being carried out. If I change the faction ID of the Rep Soldiers in the script before the attack script they always turn around and attack. If I do it in the attack script they just stand there.

 

Also now when the attack script runs only the first assassin(n_sithsoldier002) drops into a combat stance.

 

I also tried changing the faction ID of n_sithsoldier002 in the UTC file to friendly. When the script runs he first runs up to n_sithsoldier003 and drops into a combat stance(as to attack him) before turning hostile to the Rep soldiers.

 

Any ideas why the commands are not running?

Link to comment
Share on other sites

Ok, the scripts are firing but the commands are not being carried out. If I change the faction ID of the Rep Soldiers in the script before the attack script they always turn around and attack. If I do it in the attack script they just stand there.

 

Also now when the attack script runs only the first assassin(n_sithsoldier002) drops into a combat stance.

 

I also tried changing the faction ID of n_sithsoldier002 in the UTC file to friendly. When the script runs he first runs up to n_sithsoldier003 and drops into a combat stance(as to attack him) before turning hostile to the Rep soldiers.

 

Any ideas why the commands are not running?

 

No idea, the modified scripts posted above worked every time I tried them in-game, the attackers always whacked the targets and killed them with one blow. Though admittedly not while inside a cutscene. I just used a force power to fire the scripts. Perhaps has something to do with how the scripts are run?

 

The NPCs should not attack each other when they turn hostile if you've disabled their AI, but to be safe you should switch their factions just prior to them attacking. (LocalBoolean 87 set to TRUE.)

 

If you test running the scripts outside of dialog/cutscene mode, do they still not work?

Link to comment
Share on other sites

It's the cutscene dialog. The scripts work fine when I fire them from the whereami armband. I guess I'll start playing with the entry delays and see what I come up with.

 

One thing of note, my script to open the door fails(from whereami armband). Feedback says the door is locked(it is). In the cutscene dialog it works fine.

 

If you have any ideas on the cutscene dialog set-up let me know otherwise thank you for the scripting help.

Link to comment
Share on other sites

Try inserting ActionPauseConversation(); at the beginning of your script and DelayCommand(x.xf,ActionResumeConversation()) at the end (replace x.x by the appropriate time in seconds). Note that in Kotor 2, you can also set a delay before the next dialogue branch is fired. I remember running into a similar problem doing some cutscenes for a mod. I'd like to give you more details but it's been a little while and I can't check what I did from this computer.

 

If you want to have a look at a cutscene I made with several actions, you can check this mod: http://lucasfiles.com/?s=&action=file&id=1489 (the dlg file is d3_holocron.dlg and all the source code it there too)

Link to comment
Share on other sites

Perhaps a bit late in the discussion, but I have found this to always be reliable. The only time you should need CutsceneAttack is if you need to specify the actual animation being used. But given that you've armed them with blasters there shouldn't be.

#include "k_inc_fakecombat"

void main(){
ActionPauseConversation();
object oNPC = GetObjectByTag("n_sithsoldier002");
object oNPC1 = GetObjectByTag("n_sithsoldier003");
object oTarget = GetObjectByTag("repfod");
object oTarget1 = GetObjectByTag("repfod1");
FAI_EnableFakeMode( oNPC, STANDARD_FACTION_PREY );
FAI_EnableFakeMode( oNPC1, STANDARD_FACTION_PREY );
FAI_EnableFakeMode( oTarget, STANDARD_FACTION_PREDATOR );
FAI_EnableFakeMode( oTarget1, STANDARD_FACTION_PREDATOR );
FAI_PerformFakeAttack( oNPC, oTarget, TRUE );
FAI_PerformFakeAttack( oNPC1, oTarget1, TRUE );
DelayCommand( 3.0f, FAI_DisableFakeMode( oNPC, STANDARD_FACTION_NEUTRAL ) );//or w/e faction you want him to end up with
DelayCommand( 3.0f, FAI_DisableFakeMode( oNPC1, STANDARD_FACTION_NEUTRAL ) );//or w/e faction you want him to end up with
DelayCommand( 3.2f, ActionResumeConversation() );
}

 

Enabling Fake Combat Mode disables the AI under the hood. Disabling it reenables the AI. If you want them to be walking away at the time of the attack you can just delay the PerformFakeAttack, (increasing the delays already present by that amount of course) and insert the ActionWalkToObject/Location.

Link to comment
Share on other sites

UPDATE: Sorry Dashus, your script does work. In experimenting I changed the UTC's and tags of the assassins and forgot to update the tags in your script. Everything else seems to be working fine in the cutscene now.

What would you suggest so the the Rep Soldiers don't attack at all? I want them to be blind-sided.

TIA.

 

Thanks to everyone who posted, I appreciated all the help. Hopefully this thread will help someone else in the future. :)

Link to comment
Share on other sites

UPDATE: Sorry Dashus, your script does work. In experimenting I changed the UTC's and tags of the assassins and forgot to update the tags in your script. Everything else seems to be working fine in the cutscene now.

 

Odd, not using CutsceneAttack() seems to be the only difference how that include file does things.

 

Seems pretty peculiar that this function, given its name, would not work in cutscene mode, but work fine otherwise, but I suppose nothing should be surprising any more when it comes to KotOR modding. :)

Link to comment
Share on other sites

SetLockOrientationInDialog( object, TRUE ) might work, though I'm not certain about that as I've never tried to move characters while not allowing them to turn. Call it before the moves obviously.

 

@stoffe: I've found that CutsceneAttack is finicky. It worked dealing with Handmaiden sparring in the Hawk (though we no longer do it this way because it causes 783).

 

My guess is that the issue is because you were using 416 which is 2HS_Perform_Flurry_3 which is for double bladed swords/double-bladed vibro swords/quaterstaffs/wookie warblades/force pikes. My guess is that 239 which is RF_(Rifle)_Attack_1 would have worked. Despite the fact that the function description claims CutsceneAttack will always play the animation regardless of whether or not it is correct, if I have learned anything from modding for two years, it's that when the developers don't use a function and there's an alternative, use the the alternative, because there's probably a good reason they don't use it :)

 

Though TA and I do have a working theory that the Aurora engine is based on magic. It requires regular sacrifices of goats and dark voodoo rituals to get it to behave as it claims.

 

[Edit - Though if you mean how do you keep them from responding to the attack, they should already being doing that. The SW_FLAG_AI_OFF is set to false with fake mode on and there should be no reaction. If they are you could try to fudge it by setting up a userdef that catches the KOTOR_DEFAULT_EVENT_ON_ATTACKED event and plays some idle animation. Though the foolproof solution would be to give the Sith sabres/staffs and not move the soldiers. Throwing movement into the mix when dealing with anything related to animations or combat has proven problematic for us in the past.]

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...