[ZScript] SpawnBlood() palette translation

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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
DnB-Freak
Posts: 304
Joined: Sun May 19, 2013 12:09 pm

[ZScript] SpawnBlood() palette translation

Post by DnB-Freak »

Akin to LineAttack() function, "Bulletpuff" is spawned by default as pufftype.
It seems to handle blood palette translation as well, but I cannot find the parts of code that does it,
I've looked into https://github.com/rheit/zdoom/blob/mas ... /p_map.cpp for it, but for no avail.

I'm attempting to make a customized melee attack combining DamageMobj() and (SpawnBlood() xor SpawnPuff()).
What doesn't work is the blood palette translations.

Actor A hits actor B whom Bloodcolor is set to "DarkGreen",
anyhow SpawnBlood doesn't take bloodcolor from actor B into account,
causing default blood color (red) to be spawned instead when struck.

My code looks like this:

Code: Select all

extend class AMonster
{
	void A_AMonsterAttack()
	{
		if (target == null) return;
		//... Unrelated attack code here...
		//...
		Vector3 bpos = target.pos;
		double bangle = angle;
		if (CheckMeleeRange())
		{
			SpawnPuff("Blood", bpos+(0, 0, target.height * 0.5), bangle, bangle, 1, 1, target);  // <<- Spawning blood in middle height on "target"
		}
	}
}
This code actually only spawns blood on the target hit, but only in the default color (red).
LineAttack spawns blood and translates it, but it's a hitscan attack which would screw up things in this situation.
If "AMonster" misses and hits a target far away instead, looks abit weird...

How do I translate the very blood spawned using either SpawnPuff(), SpawnBlood() or is there another way to make it?

Thanks in advance.
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: [ZScript] SpawnBlood() palette translation

Post by Matt »

Actor A hits actor B whom Bloodcolor is set to "DarkGreen",
anyhow SpawnBlood doesn't take bloodcolor from actor B into account,
So B.SpawnBlood() doesn't account for B's bloodcolor?
DnB-Freak
Posts: 304
Joined: Sun May 19, 2013 12:09 pm

Re: [ZScript] SpawnBlood() palette translation

Post by DnB-Freak »

Matt wrote:
Actor A hits actor B whom Bloodcolor is set to "DarkGreen",
anyhow SpawnBlood doesn't take bloodcolor from actor B into account,
So B.SpawnBlood() doesn't account for B's bloodcolor?
not if Spawnblood() is used directly, but now you got me:

Code: Select all

///...
Target.SpawnBlood(bpos+(0, 0, target.height * 0.5), angle, damage);
Don't judge me for this mistake thus I'm yet just a beginner of ZScript :roll:
I thought native void couldn't be called from actors directly,
Thanks for correcting me, Matt.
Post Reply

Return to “Scripting”