Aller au contenu

Photo

Triggering a cutscene or conversation when an enemy is almost dead


2 réponses à ce sujet

#1
Kilrogg_

Kilrogg_
  • Members
  • 296 messages
Is it possible to have a cutscene or conversation trigger when an enemy is almost dead (since doing it on the killing blow would probably look weird)?

I cannot remember if it was done in the main campaign and it's something I'm considering doing for our mod.

At this point I just want to know whether or not its possible, I'm not to the point where I can implement and test it.

Thanks :)

Modifié par Kilrogg_, 11 mai 2010 - 04:30 .


#2
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
There is a robust surrender system built into creature_core. The system triggers when the enemy runs out of health, and prevents them from dying. It's run entirely off of local variables. The creature will automatically initiate conversation when their health is low. The system may do this automatically, but set them to be immortal using the creature editor or a scripting command to be safe.



I think the controlling variable for the system is SURRENDER_ENABLED, or at least something very similar. If you set that to 1, it will do the basics and should initiate whatever conversation is attached to the creature. There are more variables to control the details, but I can't remember them off hand. What Mengtzu suggest is basicaly the same thing as this system, but if you use the existing one you take advantage of the testing and debugging that has already been done.



One thing to realize is that the surrender will happen when the particular creature is at low health, regardless of the status of their allies. It will put the allies into the neutral group to end the combat, within a fairly large radius. Be careful about nearby creatures the player is required to kill that they may have drawn into the combat that you weren't expecting to be there. An example of this type of surrender in the main campaign is when you recruit Leliana in the tavern in Lothering.



If you want everyone to have to "die", your best bet is to use the team death event. Put all the creatures involved in the combat in one team, and add a handler for that team's death on the area script. Set the "surrender" creature to no permanent death (a property in the creature editor) to stop beheadings and it turning into a loot bag. I find it's best to have two versions of the surrendering creature. Deactivate the one you're fighting, then activate a new one and start the conversation with it. If you try and resurrect the old creature, it may get stuck playing combat animations in a permanent loop. An example of this style of surrender is fighting Teagan in the main hall of Redcliffe Castle.

#3
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
UT_SetSurrenderFlag does a few things that you might be missing when you try setting it up on the template manually.



First, it sets the SURR_SURRENDER_ENABLED flag to 1. This variable must be set for surrender to work.



Second, it sets the creature to be immortal. This is something I forgot to mention above. Immortal creatures cannot go below 1 health, and without it, a creature will only surrender on the rare occurrence that they are reduced to 1 health without being killed.



Third, it sets the SURR_INIT_CONVERSATION flag to 1. Without this flag, enemies will stop fighting, but they won't talk when they get to low health.



Fourth, it sets the SURR_PLOT_NAME and SURR_PLOT_FLAG variables. If you wish to set these on the local variables, the format for the plot name is in the above example, plt_dmo001_dafl001d_plot. You don't put the .plt. The flag is the flag number, which is 39 above.



SURR_DIALOG_OVERRIDE is only used if you want to use a conversation other than the one attached to the creature. The format, for a conversation file my_conversation.dlg is my_conversation.



Using the function is a good way to set up a surrender as it does the work for you, so I'd recommend sticking with that. However, it should still be possible to set it up manually.