[ZScript] [ACS] Play dialogue when monster killed

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

[ZScript] [ACS] Play dialogue when monster killed

Postby Laskow » Wed Oct 06, 2021 10:51 am

Like Duke Nukem, Caleb and Lo Wang, I'd like to make the player taunts when he kills monsters by the specified damage type.

ZScript:
Spoiler:


ACS:
Spoiler:


There are no warnings or errors, but it doesn't work.

I've found a few topics similar to my topic here. Well, they use DECORATE. That is not a bad method though, it takes time to set it to each monster.
Does anyone know why?


Thanks in advance!
User avatar
Laskow
 
Joined: 16 Feb 2021

Re: [ZScript] [ACS] Play dialogue when monster killed

Postby Laskow » Sat Oct 09, 2021 12:40 am

2021-10-09 15.36.11 zdoom.org bdef1d01077b.png

Oh gosh, that was my misunderstanding...

Is it impossible to check damage types when an actor dies by using Zscript?
You do not have the required permissions to view the files attached to this post.
User avatar
Laskow
 
Joined: 16 Feb 2021

Re: [ZScript] [ACS] Play dialogue when monster killed

Postby Virathas » Sat Oct 09, 2021 2:23 am

You can alwyas do something "tricky" - use WorldThingDamged, and simply check if monster that was damaged has 0 or less health. Just remember to have plenty of failsafe's, that the one doing the damage must be a player.
User avatar
Virathas
 
Joined: 10 Aug 2017

Re: [ZScript] [ACS] Play dialogue when monster killed

Postby Laskow » Sat Oct 09, 2021 2:43 am

Virathas wrote:You can alwyas do something "tricky" - use WorldThingDamged, and simply check if monster that was damaged has 0 or less health. Just remember to have plenty of failsafe's, that the one doing the damage must be a player.


Spoiler:


Finally it works!! Still having a problem with the ACS code though I took a step forward. Thanks!
User avatar
Laskow
 
Joined: 16 Feb 2021

Re: [ZScript] [ACS] Play dialogue when monster killed

Postby Virathas » Sat Oct 09, 2021 5:27 am

Do you really need ACS for this? Can't you play the audio directly from the KillDialogue inventory item? Since it is ZScript, you can add your own variables for delay between "speeches". The only thing that would (probably) not be as easy to do is have the logged messager in "specific" location, but a message could still be easily sent (like the ones when picking up items)

If ACS is something that you really want to use, make sure that:
1) the ACS is called
2) the script Activator is set properly (make sure that the player is the activator, and not item or world or none)
3) the random in the script is giving only integers

(I don't have time at the moment to debug it :P )
User avatar
Virathas
 
Joined: 10 Aug 2017

Re: [ZScript] [ACS] Play dialogue when monster killed

Postby Laskow » Sat Oct 09, 2021 6:53 am

Virathas wrote:Do you really need ACS for this?

Displaying subtitles in a specific location is easier than other ways and this is the reason why I'm using ACS.
(I hope there is a way to set it as simple as ACS in Zscript... :? )

Well, I'm not sure whether this is a rational way or not though, it works.

ZScript:
Spoiler:


ACS:
Spoiler:


I was expecting it was easy, but it wasn't!

Thanks for helping me.
User avatar
Laskow
 
Joined: 16 Feb 2021


Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest