Adding a custom switch texture

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
TheSartremaster
Posts: 17
Joined: Thu Jun 15, 2023 1:29 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows10 / Ubuntu 22.04.3
Graphics Processor: ATI/AMD (Modern GZDoom)

Adding a custom switch texture

Post by TheSartremaster »

Hi,

I am trying to add a custom switch texture and I am at a loss.
in my PK3, I have an "ANIMDEFS" with the following code:

Code: Select all

switch SWoffBark 	on 	
	sound WoodSwitch 	
	pic SWonBark 	tics 0

switch SWonBark 	off 
	sound WoodSwitch 	
	pic SWoffBark tics 0
The code is basically copied from the "Simple toggle switch" example from https://zdoom.org/wiki/ANIMDEFS#Switches.

I tried to make a switch in my UDMF map, but the texture does not react to being used. The texture does not change and no sound is played.
Trouble shooting I did:
1: Animated textures from the ANIMDEFS file work in the map, so the ANIMDEFS file is read and works.
2: Exchanging my custom switch texture with a build in switch plays a sound and changes the texture.
3: I used both my custom sound and "Door1" from the example code. The sound is not played, making me think it is the definition that is not working.

I assume, I am missing something, but I am stumped as to what it is.
User avatar
The DANDY Company
Posts: 40
Joined: Sat Jul 09, 2022 2:51 am
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: Houston, TX, USA
Contact:

Re: Adding a custom switch texture

Post by The DANDY Company »

Could it be because SWoffBark is more than 8 characters? I think texture names can’t have more than 8 unless you put the full path to the image in quotes.

Andarch
The DANDY Company
TheSartremaster
Posts: 17
Joined: Thu Jun 15, 2023 1:29 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows10 / Ubuntu 22.04.3
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Adding a custom switch texture

Post by TheSartremaster »

Aaaaah that was it!
I switched the names to be 8 symbols long and it works like a charm with sound and everything.
Thank you so much!.
User avatar
The DANDY Company
Posts: 40
Joined: Sat Jul 09, 2022 2:51 am
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: Houston, TX, USA
Contact:

Re: Adding a custom switch texture

Post by The DANDY Company »

You’re welcome!

Andarch
The DANDY Company
Post Reply

Return to “Scripting”