Changing BloodType and specific DamageFactor via ZScript

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
D2JK
Posts: 543
Joined: Sat Aug 30, 2014 8:21 am

Changing BloodType and specific DamageFactor via ZScript

Post by D2JK »

Code: Select all

Class SomeMonster: Actor
{
	Default
	{
		BloodType "none";		DamageFactor "PlasmaDamage", 1;
	}
Above are two actor properties I'd like to change via ZScript after the monster has spawned. Is this possible?

In the wiki, I at least found int ApplyDamageFactor(Name damagetype, int damage) (source), but it didn't seem to modify the specified damage factor (perhaps I used it wrong; it has no documentation page).

I know something like damagefactor = 2; is possible, but it would affect all damage types, I think.
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: Changing BloodType and specific DamageFactor via ZScript

Post by Blue Shadow »

For BloodType, there's GetBloodType virtual function. As for typed damage factors, no, there isn't a way to change those.
D2JK
Posts: 543
Joined: Sat Aug 30, 2014 8:21 am

Re: Changing BloodType and specific DamageFactor via ZScript

Post by D2JK »

Hmm, doesn't the function you linked only get a BloodType, not set it?

Also, after reading its code I tried BloodType = "SomeBlood";, but this only resulted in an error: "Expression must be a modifiable value".

Actually... did you mean I should replace the virtual function code with my own, and the engine would then use that for this actor whenever spawning blood?

EDIT: Yes, that was it. Thank you, Blue Shadow.
Post Reply

Return to “Scripting”