[SOLVED] Is a way to change Blood color\type?

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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

[SOLVED] Is a way to change Blood color\type?

Post by Void Weaver »

Subj.
Aside from ZScript Color var?
---
Added:
Need to change already defined Blood(Type\Color).
Last edited by Void Weaver on Sat Sep 14, 2019 7:06 pm, edited 3 times in total.
User avatar
Dan_The_Noob
Posts: 880
Joined: Tue May 07, 2019 12:24 pm
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Is a way to change Blood color\type?

Post by Dan_The_Noob »

BloodColor color

Sets the actor's blood color. There can be up to 256 different custom blood colors at the same time. color is either specified as 3 integers, a string "rr gg bb" or a string containing one of the special color names.

in decorate ?
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: Is a way to change Blood color\type?

Post by Void Weaver »

It's an actor property, not function. But I need to change already exist blood type or color.
Deco solution is preferable, but ACS is fine too.
User avatar
Nash
 
 
Posts: 17500
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Is a way to change Blood color\type?

Post by Nash »

No, this isn't possible even with ZScript. There was some technical discussion on why this is, if you're willing to do a forum search.

EDIT: nvm did that for you

viewtopic.php?f=15&t=59424&hilit=bloodcolor
https://github.com/coelckers/gzdoom/pull/640
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: Is a way to change Blood color\type?

Post by Blue Shadow »

For blood type, there's only ZScript: override GetBloodType.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: Is a way to change Blood color\type?

Post by Void Weaver »

Thank you guys, it's very interesting.

So such shame on my head since I hasn't found that thread before, but I stil confused about classic 'Blood' pointer logic.

As Matt had remind about PUFFGETSOWNER magic the solution have seemed so close but for some reason changing 'Blood' actor translation by condition from its AAPTR_TARGET also affect 'Blood' translation of all ither actors with the same BloodType, despite that other ones aren't linked by pointer with current 'Blood' actor. Also translation of blood doesn't affect transltion of its perticles.

I've totally messed up. x_x
---
TRNSLATE
Bloody="0:255=%[0,0,0]:[1,0,0]"

Actor BSSBlood1 : Blood
{
+PUFFGETSOWNER
-ALLOWPARTICLES
States
{
Spawn:
TNT1 A 0 NoDelay A_JumpIfInTargetInventory("BladeShieldSentinelUberToken",1,1)
Goto Super::Spawn
TNT1 A 0 A_SetTranslation("Bloody")
Goto Super::Spawn
}
}

Actor BladeShieldSentinel1 //Lets say that this actor have "BladeShieldSentinelUberToken" while BladeShieldSentinel2 haven't
{
BloodType "BSSBlood1"
BloodColor "Light Blue"
}

Actor BladeShieldSentinel2 : BladeShieldSentinel1 //But for some reason that actor also changes its blood color, EVEN if when defined "BSSBlood2" blood type
{
//BloodType "BSSBlood2"
}

Actor BSSBlood2 : Blood
{
+PUFFGETSOWNER
-ALLOWPARTICLES
States
{
Spawn:
TNT1 A 0 NoDelay A_JumpIfInTargetInventory("BladeShieldSentinelUberToken",1,1)
Goto Super::Spawn
TNT1 A 0 A_SetTranslation("Bloody")
Goto Super::Spawn
}
}
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: [SOLVED] Is a way to change Blood color\type?

Post by Void Weaver »

Oh...

Seems that Blood's translation can't be altered directly from its property, and cant be transferred to its parent actor too, so just need to call changing translation in each frame of custom blood actor. Also particles can't be re-colored anyway. :(

That's work:

Code: Select all

ACTOR BSSBlood : Blood
{
+PUFFGETSOWNER
Renderstyle Translucent
Alpha 0.9
States
{
Spawn:
TNT1 A 0 NoDelay A_JumpIfInTargetInventory("BladeShieldSentinelUberToken",1,4)
BLUD CBA 8 //Bleeding actor uses custom BloodColor "Light Blue" by default
Stop
TNT1 A 0 {bALLOWPARTICLES=0;}
BLUD CBA 8 A_SetTranslation("Bloody") //Also hardcoded bleeding algorithm doesn't work here but it can be easy replicated
Stop
}
}
But anyway it's the same thing that I want. Image
Image Image
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1118
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Re: [SOLVED] Is a way to change Blood color\type?

Post by Jekyll Grim Payne »

It's worth noting that in ZScript you can read 'target.BloodTranslation' from the blood actor and then just do 'Translation = Bloodtranslation' so that the blood gets the appropriate translation. But those blood actors won't be able to leave properly-colored blood decals (unless you make fake decals with more actors).

Also, Void Weaver, remember that blood spawning has some hardcoded behavior: when used as blood, it can randomly skip up to the first 3 frames based on damage received by the target. So, you should use "TNT1 AAA 0" at the beginning of Spawn to avoid that.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: [SOLVED] Is a way to change Blood color\type?

Post by Void Weaver »

Oh, yeah! You are absolutely right, but in my case the damage-based spawn algorithm is contrary needed. So more correct form will be (now with particles):

Code: Select all

ACTOR BSSBlood : Blood
{
+PUFFGETSOWNER
Renderstyle Translucent
Alpha 0.9
var int user_ParticleCount;
States
{
Spawn:
BLUD C 8 NoDelay A_JumpIfInTargetInventory("BladeShieldSentinelUberToken",1,3)
BLUD B 8 A_JumpIfInTargetInventory("BladeShieldSentinelUberToken",1,3)
BLUD A 8 A_JumpIfInTargetInventory("BladeShieldSentinelUberToken",1,3)
Stop
BLUD CBA 8
{
bALLOWPARTICLES=0;
A_SetTranslation("Bloody");
For(user_ParticleCount=0;user_ParticleCount<random(40,60);user_ParticleCount++)
    {
		A_SpawnParticle("dark red",SPF_RELATIVE|SPF_FULLBRIGHT,random(8,17),frandom(0.7,0.9),frandom(0,360),frandom(-20,20),frandom(-20,20),frandom(-15,15),0,0,0,0,0,0,frandom(0.85,0.95),-1,frandom(1,1.005));		
	}
}
Stop
}
}
But the decals still aren't possible recolored by this way at all.
And thank you for the ZScript hint.
Post Reply

Return to “Scripting”