Aller au contenu

Photo

Triggering a cutscene or conversation when an enemy is almost dead


6 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
Mengtzu

Mengtzu
  • Members
  • 258 messages
Yes, just put a custom script on the creature, test for the health threshold you're looking for under EVENT_TYPE_DAMAGED, then use UT_CombatStop and whatever else you want to do.



There's also some surrender stuff in creature variables that might do this; I preferred to just script it out so I understood what was happening.

#3
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.

#4
Kilrogg_

Kilrogg_
  • Members
  • 296 messages
Great, thanks David :)

#5
RecklezzRogue

RecklezzRogue
  • Members
  • 193 messages
It could be me, but I can't seem to get surrender working using the variables (either in the area instance or the creature template), but UT_SetSurrenderFlag does work (as follows):



UT_SetSurrenderFlag(oGerl, TRUE, PLT_DMO001_DAFL001D_PLOT, 39); // DEBUG



I suspect it might because I am not sure what the format needs to be for SURR_PLOT_NAME and SURR_DIALOG_OVERRIDE, I have tried many :-\\



Anyway, the UT command works, so I am just going to script surrenders. I figured I would post this in case anyone else is having a similar, or can set me straight.


#6
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.

#7
RecklezzRogue

RecklezzRogue
  • Members
  • 193 messages
David - thanks - of all that you mentioned above, the two things I was missing was the Immortal setting (funny though, the NPC did not die, he just stopped fighting and rubber went home). I didn't realize that the conversation would be the one assigned to the creature - therein may be my core mistake...(on the road so I can't test it right now).

DavidSims said...

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.



Thanks much for the format info - very hard to find that stuff ;-)

ps - I prolly will stick with the function, I like centralizing things in scripts as opposed to going to multiple other places for similarly achievable functionality (but I do like plots) - that said - I will definitely get the variables working, it's how I teach myself ;-)

Modifié par RecklezzRogue, 18 mai 2010 - 04:43 .