Jump to content

Need Help With Cutscene Scripting


Castus

Recommended Posts

Hi.

 

I have a problem with a cutscene I'm writing. When it finishes the player's party is confronted with several hostiles. At this point the hostile characters immediately make a move, i.e. attack. However, I would like the player to make the first move. Any ideas on how do that?

 

I noticed that when I activate the special encounter that triggers the cutscene while being in combat mode I get to make the first move. So I thought maybe there is a way to initiate combat from script but so far I have been unable to find a suitable call to do that.

 

Any help would be appreciated. Thanks.

Link to comment
Share on other sites

One way might be to explore means of immobilizing the enemies until the correct time for them to move. If the enemies use basicnpc or a derived script, you could set their zeroth memory cells to 2 initially, so that they can't walk, and then only once the cutscene is properly triggered set those memory cells to different values and use set_mobility to allow them to move. Another option is to make them initially neutral and switch their attitude to hostile only at the appropriate time.

 

There is no way to start combat mode from a script; the best you can do is ask the player to do it. It's probably better to make your scripts robust enough to do the right thing in or out of combat mode if possible.

Link to comment
Share on other sites

Thanks for the reply.

 

The problem is that the correct time for the creatures to move is after the script, just not directly after it. So there is no real way for me to set anything that doesn't also affect the the creatures directly after the script. In other words, when it's time for them to move there is no script running.

Link to comment
Share on other sites

There's never no script running. (Unless you crash all of the ones that should be.) In particular, the scenario script and town script's START_STATEs are run every turn (which in combat translates into each round). Since the code is assumedly specific to a single town, I would put this in the town script. What it sounds like you need to do is set a flag, to act like a count down, at the end of the cutscene. The town START_STATE could check if the flag is greater than zero, and if so decrement it. If decrementing it makes it zero, the count down is done and you do whatever it is you want to do with the enemies. If you don't want to use an exact count of ticks from the end of the cutscene, instead of having the scenario script count down, just have it evaluate whatever condition will tell it when the correct time is.

 

Another option is the enemies' own creature scripts, which are also running anytime the creatures themselves are alive. This might be more work, and trickier to get right (in part since creature scripts run less frequently by default), or it might be much simpler, depending on what exactly you have in mind: have the cutscene code set the flag, and have the enemies behave differently when they note that the flag is set, like by delaying an extra turn before beginning to move and attack.

Link to comment
Share on other sites

I used your second idea and changed the modified basicnpc script that I'm using. It now has a memory cell that can be filled with an action delay value.

I've tried it and it seems to work flawlessly. The fact that the creature scripts don't run as frequently as the town script is not an issue here, because in the cases where I need the action delay functionality, the creatures are already very close to the party, so the script will definitely run.

Thanks for the help.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...