Choppy monster movement?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Gifty
Posts: 615
Joined: Sat Jun 15, 2013 8:21 pm

Choppy monster movement?

Post by Gifty »

Hi, I'm trying to implement a Quake-esque hitmarker sound on enemies by giving all the enemies a 100% pain chance, but it's messing with their movement and I'm not sure how to fix it.

Code: Select all

ACTOR GorePinky : Demon replaces Demon
{
	Painchance 256
	states
	{
	Pain:
		TNT1 a 0 a_playsound("gore/hitmarker", 0, 0.8, false, 0.3, false)
		TNT1 a 0 a_jump(180, "TruePain")
		goto see
		
	TruePain:
		SARG H 2 Fast
		SARG H 2 Fast A_Pain
		Goto See
This pinky has a 100% pain chance so that the sound will always play, but in order to retain the pinky's original pain behavior, there's a jump at the end which can stun, or not stun the pinky. Just like normal. The problem is that with all these checks and state jumps, the pinky is now less responsive when coming out of Pain. When I hit the pinky with lots of projectiles at once, like in a shotgun blast, the pinky will stutter and jump to a new position while doing the painstate calculations. Sometimes I'll kill a pinky and his death animation will appear several feet away from where I shot him. I'm not sure how to keep the hitmarker functionality while retaining smooth movement for the monster. Any ideas?
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Choppy monster movement?

Post by Matt »

Any chance of switching the actor over to ZScript? If you do you can have the actor play the sound every time it's hit without needing to enter any states at all - and even have them play originating from the player hitting it:

Code: Select all

class qimp:doomimp replaces doomimp{
    override int DamageMobj(
        Actor inflictor, Actor source, int damage,
        Name mod, int flags = 0, double angle = 0
    ){
        //attenuation set high so only the attacker can hear this
        if(source is "PlayerPawn")source.A_PlaySound("gore/hitmarker",CHAN_AUTO,attenuation:30);
        return super.damagemobj(
            inflictor,source,damage,
            mod,flags,angle
        );
    }
} 
EDIT: that attenuation should be 30 not 6!
Last edited by Matt on Sun Jul 30, 2017 11:54 pm, edited 1 time in total.
User avatar
Gifty
Posts: 615
Joined: Sat Jun 15, 2013 8:21 pm

Re: Choppy monster movement?

Post by Gifty »

Thanks! I haven't learned much Zscript yet but I'll give this a try

EDIT: worked beautifully, thanks again!
Locked

Return to “Editing (Archive)”