Jump to content
  • 0

Custom blood Actors not Spawning


Neccronixis

Question

Hi,

 

I'm trying to create a custom blood effect, but I have a problem. If I spawn "NewBlood" (in front of the player) using the console, everything works correctly, however when a monster takes damage, "Bloodimpact" does not spawn all of the time when the monster bleeds. Can someone explain to me why this is happening and offer a fix? Here's the code:

 

actor NewBlood replaces blood
{
    +FORCEXYBILLBOARD
    +ALLOWPARTICLES
    +PUFFGETSOWNER
    +NOBLOCKMAP
    +NOTELEPORT
    +NOTONAUTOMAP
    +THRUACTORS
    +DONTSPLASH
    States
    {
    Spawn:
        TNT1 A 0 Nodelay A_spawnitemEx("Bloodimpact", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
        TNT1 AAAAAAAA 0 A_spawnitemEx("Flyingbloodparticle", frandom(-5,5), frandom(-5,5), frandom(-5,5), frandom(2,4), frandom(0,0), frandom(-4,4), frandom(0,360), SXF_TRANSFERTRANSLATION)
        TNT1 A 0 A_spawnitemEx("FlyingBlood",0,0,0,frandom(-2,2),frandom(-4,4),frandom(8,10),frandom(0,360), SXF_TRANSFERTRANSLATION, 128)
        TNT1 A 0 A_spawnitemEx("Blooddrop",0,0,0,frandom(-4,4),frandom(-4,4),frandom(0,0),frandom(0,360), SXF_TRANSFERTRANSLATION, 192)
    Stop
    }
}

 

actor Bloodimpact : Newblood
{
    +NOINTERACTION
    States
    {
    Spawn:
        BLOD BCD 3    
        Stop
    }
}

Edited by Neccronixis

Share this post


Link to post

11 answers to this question

Recommended Posts

  • 0

Erm... I have a hunch. Does it appear to spawn only on walls? Or does it spawn on floors, ceilings and walls but just not all the time?

Share this post


Link to post
  • 0
12 minutes ago, Wo0p said:

Erm... I have a hunch. Does it appear to spawn only on walls? Or does it spawn on floors, ceilings and walls but just not all the time?

 

Sorry, but I don't know what you mean when you say does it spawn on walls, ceilings or floors; it's just a replacement for the existing DOOM blood effect.

 

If I remove "Flyingbloodparticle", "FlyingBlood" and "Blooddrop" from the spawn code, then "Bloodimpact" will always spawn when monsters bleed.

Share this post


Link to post
  • 0

Well cl_bloodspats is the console command that determines if bloodspatter decals show up on walls. And if that is on (As it is by default and you haven't messed with it) then there's "a chance" that a blood decal spawns. So it's not always. It also depends on the given amount of damage the actor receives. Beyond that, I don't know much else about how blood functions.

 

But if you want blood to spawn on floors and ceilings then you need an actual flat model for the texture to be attached to since ZDoom (Or is it GZDoom?) doesn't support decals on floors or ceilings by default.

Edited by Wo0p

Share this post


Link to post
  • 0
21 hours ago, Wo0p said:

Well cl_bloodspats is the console command that determines if bloodspatter decals show up on walls. And if that is on (As it is by default and you haven't messed with it) then there's "a chance" that a blood decal spawns. So it's not always. It also depends on the given amount of damage the actor receives. Beyond that, I don't know much else about how blood functions.

 

But if you want blood to spawn on floors and ceilings then you need an actual flat model for the texture to be attached to since ZDoom (Or is it GZDoom?) doesn't support decals on floors or ceilings by default.

 

My issue has has nothing to do with generating decals on the walls or spawning flat model textures on the floor. I am trying to create a custom actor that spawns four independent actors simultaneously from the same position without delay. The problem is the first actor in the series (and some instances of the second actor) randomly fail to spawn for some reason I'm not aware of. It may have something to do with the way A_spawnitemEx works.

 

Share this post


Link to post
  • 0

Ah.. you haven't used a function. I think that's the problem.

 

Try putting this:

 

A_spawnitemEx("Bloodimpact", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
        TNT1 AAAAAAAA 0 A_spawnitemEx("Flyingbloodparticle", frandom(-5,5), frandom(-5,5), frandom(-5,5), frandom(2,4), frandom(0,0), frandom(-4,4), frandom(0,360), SXF_TRANSFERTRANSLATION)
        TNT1 A 0 A_spawnitemEx("FlyingBlood",0,0,0,frandom(-2,2),frandom(-4,4),frandom(8,10),frandom(0,360), SXF_TRANSFERTRANSLATION, 128)
        TNT1 A 0 A_spawnitemEx("Blooddrop",0,0,0,frandom(-4,4),frandom(-4,4),frandom(0,0),frandom(0,360), SXF_TRANSFERTRANSLATION, 192)

 

into a function like this:

 

TNT1 A 0 Nodelay

{

A_spawnitemEx("Bloodimpact", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
        TNT1 AAAAAAAA 0 A_spawnitemEx("Flyingbloodparticle", frandom(-5,5), frandom(-5,5), frandom(-5,5), frandom(2,4), frandom(0,0), frandom(-4,4), frandom(0,360), SXF_TRANSFERTRANSLATION);
        TNT1 A 0 A_spawnitemEx("FlyingBlood",0,0,0,frandom(-2,2),frandom(-4,4),frandom(8,10),frandom(0,360), SXF_TRANSFERTRANSLATION, 128);
        TNT1 A 0 A_spawnitemEx("Blooddrop",0,0,0,frandom(-4,4),frandom(-4,4),frandom(0,0),frandom(0,360), SXF_TRANSFERTRANSLATION, 192);

}

 

"Nodelay" forces the first state to execute its "action functions". But "action functions" don't run in the first sequence of spawn when an actor is first spawned (That's why you need NoDelay to force the runtime). "Action functions" and "functions" aren't the same, but you probably know that. Just stating for clarification.

Edited by Wo0p

Share this post


Link to post
  • 0
17 hours ago, Wo0p said:

Ah.. you haven't used a function. I think that's the problem.

 

Try putting this:

 

A_spawnitemEx("Bloodimpact", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
        TNT1 AAAAAAAA 0 A_spawnitemEx("Flyingbloodparticle", frandom(-5,5), frandom(-5,5), frandom(-5,5), frandom(2,4), frandom(0,0), frandom(-4,4), frandom(0,360), SXF_TRANSFERTRANSLATION)
        TNT1 A 0 A_spawnitemEx("FlyingBlood",0,0,0,frandom(-2,2),frandom(-4,4),frandom(8,10),frandom(0,360), SXF_TRANSFERTRANSLATION, 128)
        TNT1 A 0 A_spawnitemEx("Blooddrop",0,0,0,frandom(-4,4),frandom(-4,4),frandom(0,0),frandom(0,360), SXF_TRANSFERTRANSLATION, 192)

 

into a function like this:

 

TNT1 A 0 Nodelay

{

A_spawnitemEx("Bloodimpact", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
        TNT1 AAAAAAAA 0 A_spawnitemEx("Flyingbloodparticle", frandom(-5,5), frandom(-5,5), frandom(-5,5), frandom(2,4), frandom(0,0), frandom(-4,4), frandom(0,360), SXF_TRANSFERTRANSLATION);
        TNT1 A 0 A_spawnitemEx("FlyingBlood",0,0,0,frandom(-2,2),frandom(-4,4),frandom(8,10),frandom(0,360), SXF_TRANSFERTRANSLATION, 128);
        TNT1 A 0 A_spawnitemEx("Blooddrop",0,0,0,frandom(-4,4),frandom(-4,4),frandom(0,0),frandom(0,360), SXF_TRANSFERTRANSLATION, 192);

}

 

"Nodelay" forces the first state to execute its "action functions". But "action functions" don't run in the first sequence of spawn when an actor is first spawned (That's why you need NoDelay to force the runtime). "Action functions" and "functions" aren't the same, but you probably know that. Just stating for clarification.

 

Do you have a solution in DECORATE? I'm not too familiar with Zscript (and coding in general, for that matter).

Share this post


Link to post
  • 0
On 5/30/2023 at 2:16 AM, Wo0p said:

Try adding a duration of 1 to your last TNT1 A entry.

 

 

actor NewBlood replaces blood
{
    +FORCEXYBILLBOARD
    +ALLOWPARTICLES
    +PUFFGETSOWNER
    +NOBLOCKMAP
    +NOTELEPORT
    +NOTONAUTOMAP
    +THRUACTORS
    +DONTSPLASH
    States
    {
    Spawn:
        TNT1 A 0 NoDelay A_spawnitemEx("Bloodimpact", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
        TNT1 AAAAAAAA 0 A_spawnitemEx("Flyingbloodparticle", frandom(-5,5), frandom(-5,5), frandom(-5,5), frandom(2,4), frandom(0,0), frandom(-4,4), frandom(0,360), SXF_TRANSFERTRANSLATION)
        TNT1 A 0 A_spawnitemEx("FlyingBlood",0,0,0,frandom(-2,2),frandom(-4,4),frandom(8,10),frandom(0,360), SXF_TRANSFERTRANSLATION, 128)
        TNT1 A 1 A_spawnitemEx("Blooddrop",0,0,0,frandom(-4,4),frandom(-4,4),frandom(0,0),frandom(0,360), SXF_TRANSFERTRANSLATION, 192)
    Stop
    }
}

 

I tried that and it doesn't work?

Share this post


Link to post
  • 0

Hm have you tried using the A_CustomMissile instead of A_SpawnItemEx? That's how the mod "Brutal Bolognese Gore" by Sgt Mark does it and it works cos I've used it in my project "Exousiastes." 

 

And if you try it, remember to add the +Missile flag to your blood actors.

Edited by Wo0p

Share this post


Link to post
  • 0

I don't know why, but what seems to work well is placing a couple of TNT1 A 0 before spawning the actors:
    

Spawn:
        TNT1 A 0
        TNT1 A 0
        TNT1 A 0 A_spawnitemEx("Bloodimpact", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
        TNT1 AAAAAAAA 0 A_spawnitemEx("Flyingbloodparticle", frandom(-5,5), frandom(-5,5), frandom(-5,5), frandom(2,4), frandom(0,0), frandom(-4,4), frandom(0,360), SXF_TRANSFERTRANSLATION)
        TNT1 A 0 A_spawnitemEx("FlyingBlood",0,0,0,frandom(-2,2), frandom(-4,4), frandom(8,10), frandom(0,360), SXF_TRANSFERTRANSLATION, 128)
        TNT1 A 0 A_spawnitemEx("Blooddrop",0,0,0, frandom(-4,4), frandom(-4,4), frandom(0,0), frandom(0,360), SXF_TRANSFERTRANSLATION, 192)
    Stop
    }
}

Share this post


Link to post
  • 0

Hm alright. Well that's great! :)

 

I think it must be some quirk of how the engine goes through animation states. For some reason it skips some states the first time Spawn is run so I'm guessing that's why your method now works? Oh well! All that matters is that it works.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...