custom TeleportFog

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
BrickJove
Posts: 25
Joined: Thu May 27, 2021 7:54 am
Contact:

custom TeleportFog

Post by BrickJove »

I’m trying to create a custom TeleportFog effect but I’m running into issues. I tried overriding the TeleportFog class with replaces, but it conflicts with the original class. How can I properly create and use a custom teleport fog without causing errors? Any help would be appreciated!
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: custom TeleportFog

Post by Jarewill »

Replacing TeleportFog will work, you just have to give your custom class a unique name.
User avatar
BrickJove
Posts: 25
Joined: Thu May 27, 2021 7:54 am
Contact:

Re: custom TeleportFog

Post by BrickJove »

I already did that—my class is named CustomTeleportFog, and I even added the actor parameter TeleFogSourceType "CustomTeleportFog", but it still doesn’t work.
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: custom TeleportFog

Post by Jarewill »

Could you show your code?
User avatar
BrickJove
Posts: 25
Joined: Thu May 27, 2021 7:54 am
Contact:

Re: custom TeleportFog

Post by BrickJove »

Code: Select all

class CustomTeleportFog : Actor
{
    override void PostBeginPlay()
    {
        Super.PostBeginPlay();
        A_PlaySound("jbonus", CHAN_BODY);
    }

    override void Tick()
    {
        // Custom logic, if needed
        Super.Tick();
    }

    States
    {
        Spawn:
            SPEX ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 Bright;
            Stop;
    }
}
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: custom TeleportFog

Post by Jarewill »

You didn't actually replace the vanilla TeleportFog, you have to use the replaces keyword for this, like so:
class CustomTeleportFog : Actor replaces TeleportFog
User avatar
BrickJove
Posts: 25
Joined: Thu May 27, 2021 7:54 am
Contact:

Re: custom TeleportFog

Post by BrickJove »

I had already tried that as well, but it still doesn't work. Do you perhaps have a simple WAD with an example?
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: custom TeleportFog

Post by Jarewill »

I have just copied your code, added the replacement line and changed the sound/sprites to make it appear on my end.
Could you send your project here so I can see your file structure and test it?
User avatar
BrickJove
Posts: 25
Joined: Thu May 27, 2021 7:54 am
Contact:

Re: custom TeleportFog

Post by BrickJove »

Sorry, my project is divided into several PK3s, and uploading it would be too complicated. Let me show you the folder structure first; maybe the problem lies there. By the way, jupiter_classes.txt is correctly implemented because I can already access the class DeathAnimation.

Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: custom TeleportFog

Post by Jarewill »

I was more curious about the sprites and sounds folders, as well as your SNDINFO.
User avatar
BrickJove
Posts: 25
Joined: Thu May 27, 2021 7:54 am
Contact:

Re: custom TeleportFog

Post by BrickJove »

The problem is that the original TeleportFog is displayed no matter what I do, even if I assign the actor the CustomTeleportFog.

User avatar
Enjay
 
 
Posts: 26935
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: custom TeleportFog

Post by Enjay »

Just a thought: Have you checked that your actor actually works regardless of whether it replaces the default teleport fog or not?

What happens if you type:
summon CustomTeleportFog
at the console? Does your actor appear?
User avatar
BrickJove
Posts: 25
Joined: Thu May 27, 2021 7:54 am
Contact:

Re: custom TeleportFog

Post by BrickJove »

@Enjay

Yes, CustomTeleportFog does appear when summoned that way.
User avatar
BrickJove
Posts: 25
Joined: Thu May 27, 2021 7:54 am
Contact:

Re: custom TeleportFog

Post by BrickJove »

@Enjay

Yes, CustomTeleportFog does appear when summoned that way.
User avatar
Enjay
 
 
Posts: 26935
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: custom TeleportFog

Post by Enjay »

OK, so the actor is fine - there is just something about the how replacing the original is being implemented.

However, when I tried this (which is just you code with the sprite name replaced and "replaces TeleportFog" added, it works on my system.

Code: Select all

class CustomTeleportFog : Actor replaces TeleportFog
{
    override void PostBeginPlay()
    {
        Super.PostBeginPlay();
        A_PlaySound("jbonus", CHAN_BODY);
    }

    override void Tick()
    {
        // Custom logic, if needed
        Super.Tick();
    }

    States
    {
        Spawn:
            VILE ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 Bright;
            Stop;
    }
}
So, there must be something about the structure of your project file that means the actor isn't being allowed to replace the default teleport fog.

Do you get any messages at the console? If you don't already have developer mode set, type developer 2 at the console and then restart to possibly get more error messages than you would with developer mode set to the default of 0.
Post Reply

Return to “Scripting”