Aller au contenu

Photo

Run a script on enemy death


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
uberdowzen

uberdowzen
  • Members
  • 1 213 messages
I have a bad feeling by the time I've finished this module I'm going to have posted a hundred threads. Oh well, here goes...

I want a cinematic to trigger when I kill an enemy. I saw another thread on here Triggering a cutscene or conversation when an enemy is almost dead but I have absolutely no idea (well, I have a vague idea) how you implement this. Also if I want to assign a script or conversation to a core creature do I duplicate it and rename it first? Thanks

Modifié par uberdowzen, 13 juin 2010 - 03:00 .


#2
Proleric

Proleric
  • Members
  • 2 355 messages
As David Sims mentions in that thread, the most general way of detecting death events is to add a case for EVENT_TYPE_TEAM_DESTROYED to your area script.

In a big campaign, you might need to detect both individual deaths and team deaths. This method ensures that all the code is in the same place, for convenience.

The team number is specified on the creature properties. If there's only one creature, just give it a unique team number.

Alternatively, for single creatures only, you can intercept EVENT_TYPE_DYING in your creature script.

If you want to give a core creature a new script and conversation, the simplest way is to duplicate it into a new creature.

#3
uberdowzen

uberdowzen
  • Members
  • 1 213 messages
Did that and managed to get the cinematic to trigger when the creatured died the only issue was that is was a sort of killing boss cinematic and the boss had been dead for about 2 seconds before the cinematic ran.

#4
Mengtzu

Mengtzu
  • Members
  • 258 messages

uberdowzen wrote...

Did that and managed to get the cinematic to trigger when the creatured died the only issue was that is was a sort of killing boss cinematic and the boss had been dead for about 2 seconds before the cinematic ran.


Death events don't seem to fire until the actual death animation finishes.  That can be some time!

#5
Craig Graff

Craig Graff
  • Members
  • 608 messages
Have you tried EVENT_TYPE_DYING yet?

#6
uberdowzen

uberdowzen
  • Members
  • 1 213 messages
Small update. Managed to get the surrender code to work, but I only managed to get it to trigger a plot and am having a couple of issues moving on from there. I'll give EVENT_TYPE_DYING a go.

#7
uberdowzen

uberdowzen
  • Members
  • 1 213 messages
Event type dying worked perfectly thanks!