Petrification Effect, Is it possible?
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!)
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!)
- Ashat Maself
- Posts: 61
- Joined: Fri Apr 02, 2021 5:32 am
Petrification Effect, Is it possible?
I'm currently working on an item that would turn enemies to stone, similar to the freeze effect, but not destroyable and can be pushed around, Is this possible and if so, how (zscript, acs and decorate accepted)
Re: Petrification Effect, Is it possible?
There may be neater ways but you could set your petrification weapon to do a custom damage type and create new items that look like the relevant enemies (but petrified) and spawn them in a special "pertrification" death sequence to replace the actual actor which would be set to vanish at the same time. So you wouldn't be pushing around the actual corpse, but no one would know.
Re: Petrification Effect, Is it possible?
I would write an inventory class that the monsters get, which in DoEffect() makes the monster be pushable, set tics to -1, and possibly also set it's translation to greyscale. Make sure to store the relevant flags and variables before the petrification occurs, so you can reset it afterwards should the monster turn to flesh again.
- Ashat Maself
- Posts: 61
- Joined: Fri Apr 02, 2021 5:32 am
Re: Petrification Effect, Is it possible?
Thanks for the help, I'll try this tomorrow, and the effect is designed to be permanent so turning back to flesh shouldn't be an issueCherno wrote:I would write an inventory class that the monsters get, which in DoEffect() makes the monster be pushable, set tics to -1, and possibly also set it's translation to greyscale. Make sure to store the relevant flags and variables before the petrification occurs, so you can reset it afterwards should the monster turn to flesh again.
- Ashat Maself
- Posts: 61
- Joined: Fri Apr 02, 2021 5:32 am
Re: Petrification Effect, Is it possible?
Update, I am currently using a Morphprojectile, can a morphclass inherit the last used frames of the class that morphed into it?
Re: Petrification Effect, Is it possible?
You can set the sprite and frame manually via the sprite and frame variables.
- Ashat Maself
- Posts: 61
- Joined: Fri Apr 02, 2021 5:32 am
Re: Petrification Effect, Is it possible?
Could you elaborate further?
Re: Petrification Effect, Is it possible?
You can find information about that on this wiki page.
You can copy the current sprite and frame of another actor doing
You can copy the current sprite and frame of another actor doing
Code: Select all
self.sprite = pointer.sprite;
self.frame = pointer.frame;
- Ashat Maself
- Posts: 61
- Joined: Fri Apr 02, 2021 5:32 am
Re: Petrification Effect, Is it possible?
Using this with GetSpriteIndex gives me multiple errorsJarewill wrote:You can find information about that on this wiki page.
You can copy the current sprite and frame of another actor doingCode: Select all
self.sprite = pointer.sprite; self.frame = pointer.frame;
Re: Petrification Effect, Is it possible?
My fault for not being clearer.Ashat Maself wrote:Using this with GetSpriteIndex gives me multiple errors
The reason I linked that wiki page is because it shows how you can change the sprite and frame variables if you don't have a direct pointer.
If you do have a pointer however, you can use that, like in the code I provided. (self.sprite = pointer.sprite)
I have never used MorphProjectiles, so I don't know if they return a pointer to the actor pre-morph, so you can get it's variables before morphing though.
- Ashat Maself
- Posts: 61
- Joined: Fri Apr 02, 2021 5:32 am
Re: Petrification Effect, Is it possible?
I'm still confused on where self.sprite = pointer.sprite even goes? Every logical place to use it just causes errors
Re: Petrification Effect, Is it possible?
Like I said, I never used MorphProjectile, so I don't know how it works.
You might need to check inside the gzdoom.pk3's ZScript files to see how MorphProjectile morphs the actor and override it with your own code.
However, the first method Cherno posted would work well here:
Put it in a TRSNLATE file.
You might need to check inside the gzdoom.pk3's ZScript files to see how MorphProjectile morphs the actor and override it with your own code.
However, the first method Cherno posted would work well here:
Spoiler:And here's the petrification translation I used:
Code: Select all
Petrified = "16:46=80:111", "48:79=80:111", "112:127=80:111", "128:159=80:111", "168:191=80:111", "160:167=96:111", "192:207=80:99", "240:247=101:111", "208:223=80:111", "224:231=80:95", "232:239=96:111", "248:255=96:111", "9:15=5:8"
- Ashat Maself
- Posts: 61
- Joined: Fri Apr 02, 2021 5:32 am
Re: Petrification Effect, Is it possible?
Thank You for this, I'll credit you for the code
- Ashat Maself
- Posts: 61
- Joined: Fri Apr 02, 2021 5:32 am
Re: Petrification Effect, Is it possible?
One last thing, Upon startup I get these errors
MedusaHead.pk3:zscript, line 1: Parent class EventHandler of PetrificationHandler not accessible to ZScript version 2.3.0
MedusaHead.pk3:zscript, line 3: Type WorldEvent not accessible to ZScript version 2.3.0
MedusaHead.pk3:zscript, line 3: Invalid type Type for function parameter
MedusaHead.pk3:zscript, line 3: Attempt to override non-existent virtual function WorldThingDied
MedusaHead.pk3:zscript, line 1: Parent class EventHandler of PetrificationHandler not accessible to ZScript version 2.3.0
MedusaHead.pk3:zscript, line 3: Type WorldEvent not accessible to ZScript version 2.3.0
MedusaHead.pk3:zscript, line 3: Invalid type Type for function parameter
MedusaHead.pk3:zscript, line 3: Attempt to override non-existent virtual function WorldThingDied
Re: Petrification Effect, Is it possible?
That means you haven't specified the ZScript version.
Look at the first line of the code I provided.
Look at the first line of the code I provided.