Petrification Effect, Is it possible?

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!)
User avatar
Ashat Maself
Posts: 61
Joined: Fri Apr 02, 2021 5:32 am

Petrification Effect, Is it possible?

Post by Ashat Maself »

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)
User avatar
Enjay
 
 
Posts: 27087
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Petrification Effect, Is it possible?

Post by Enjay »

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.
User avatar
Cherno
Posts: 1337
Joined: Tue Dec 06, 2016 11:25 am

Re: Petrification Effect, Is it possible?

Post by Cherno »

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.
User avatar
Ashat Maself
Posts: 61
Joined: Fri Apr 02, 2021 5:32 am

Re: Petrification Effect, Is it possible?

Post by Ashat Maself »

Cherno 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.
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 issue
User avatar
Ashat Maself
Posts: 61
Joined: Fri Apr 02, 2021 5:32 am

Re: Petrification Effect, Is it possible?

Post by Ashat Maself »

Update, I am currently using a Morphprojectile, can a morphclass inherit the last used frames of the class that morphed into it?
User avatar
Cherno
Posts: 1337
Joined: Tue Dec 06, 2016 11:25 am

Re: Petrification Effect, Is it possible?

Post by Cherno »

You can set the sprite and frame manually via the sprite and frame variables.
User avatar
Ashat Maself
Posts: 61
Joined: Fri Apr 02, 2021 5:32 am

Re: Petrification Effect, Is it possible?

Post by Ashat Maself »

Could you elaborate further?
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: Petrification Effect, Is it possible?

Post by Jarewill »

You can find information about that on this wiki page.
You can copy the current sprite and frame of another actor doing

Code: Select all

self.sprite = pointer.sprite;
self.frame = pointer.frame;
User avatar
Ashat Maself
Posts: 61
Joined: Fri Apr 02, 2021 5:32 am

Re: Petrification Effect, Is it possible?

Post by Ashat Maself »

Jarewill wrote:You can find information about that on this wiki page.
You can copy the current sprite and frame of another actor doing

Code: Select all

self.sprite = pointer.sprite;
self.frame = pointer.frame; 
Using this with GetSpriteIndex gives me multiple errors
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: Petrification Effect, Is it possible?

Post by Jarewill »

Ashat Maself wrote:Using this with GetSpriteIndex gives me multiple errors
My fault for not being clearer.
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.
User avatar
Ashat Maself
Posts: 61
Joined: Fri Apr 02, 2021 5:32 am

Re: Petrification Effect, Is it possible?

Post by Ashat Maself »

I'm still confused on where self.sprite = pointer.sprite even goes? Every logical place to use it just causes errors
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: Petrification Effect, Is it possible?

Post by Jarewill »

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:
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"
Put it in a TRSNLATE file.
User avatar
Ashat Maself
Posts: 61
Joined: Fri Apr 02, 2021 5:32 am

Re: Petrification Effect, Is it possible?

Post by Ashat Maself »

Thank You for this, I'll credit you for the code
User avatar
Ashat Maself
Posts: 61
Joined: Fri Apr 02, 2021 5:32 am

Re: Petrification Effect, Is it possible?

Post by Ashat Maself »

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
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: Petrification Effect, Is it possible?

Post by Jarewill »

That means you haven't specified the ZScript version.
Look at the first line of the code I provided.
Post Reply

Return to “Scripting”