collision fails after entering custom player state, despite having nothing mentioning said collision

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!)
Protozoare
Posts: 15
Joined: Sat Oct 08, 2022 2:51 am
Preferred Pronouns: He/Him

collision fails after entering custom player state, despite having nothing mentioning said collision

Post by Protozoare »

I was debugging a mod I am working on, and I have the player enter a custom state through a short pain state and then it goes into a "sports state". This locks player movement and shows the player from third person performing squats, while also making it frightening for monsters, and making him invincible while he does that, so that the state won't be interrupted by enemy hits. The problem is that upon entering this state (which is not based on death states) the player loses all collision with monsters, despite not having code to lose said collision. Upon the squats being finished, and the state ending, the collision still remains broken. I did use PROP_INVULNERABILITY, which is deprecated, but the unintended behavior still occurs without it. I am wondering if there is a way to restore collision, sort of like an opposite to A_Noblocking, but so far have found nothing about such a function, though my question remains. Why does the collision with monsters fail from the moment the player state is entered? And what should I
change in this code to prevent that from happening again? Note that the player can still take damage after the state, but just passes through the monsters when moving.

Code: Select all

Pain.Sports:
        STUD H 1;
		TNT1 A 0{
			cam = Spawn("BackCamera",pos); 
			cam.target=self; 
		}
		STUD I 1 A_Playsound("student/thanks");
		Goto Squats;
	Squats:
		STUD JKL 10 {
			squatcount++; 
			Thing_Stop(0);
			SetPlayerProperty(0, 1, PROP_FRIGHTENING);
                        SetPlayerProperty(0, 1, PROP_TOTALLYFROZEN);
			SetPlayerProperty(0, 2, PROP_INVULNERABILITY);
		}
		TNT1 A 0 A_JumpIf(squatcount < 250,"Squats"); //Loop the animation if the condition has not been met
		STUD E 1 { 
			squatcount=0; //Reset the counter
			 A_Jump(256,"see"); 
			 A_Playsound("bostan/PushUps");
			 SetPlayerProperty(0, 0, PROP_FRIGHTENING);
			 SetPlayerProperty(0, 0, PROP_TOTALLYFROZEN);
			 SetPlayerProperty(0, 0, PROP_INVULNERABILITY);
		}
		TNT1 A 0{
			SetCamera(null); 
			cam.Destroy(); 
		}
User avatar
Player701
 
 
Posts: 1707
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support

Re: collision fails after entering custom player state, despite having nothing mentioning said collision

Post by Player701 »

I am unable to replicate this. Could you please post the entire mod in question, or at least a self-contained example that reproduces the issue?
Protozoare
Posts: 15
Joined: Sat Oct 08, 2022 2:51 am
Preferred Pronouns: He/Him

Re: collision fails after entering custom player state, despite having nothing mentioning said collision

Post by Protozoare »

:-| I've managed to fix it. It's my fault for not looking at it more, and feeling discouraged to work on this for a while due to me not figuring it out. Today when I check, there was an obvious A_NoBlocking() somewhere in a previous playerstate :) , that then sent me into this one. And I was was wasting my time looking at the loop instead of the other state. So this mystery is closed.

Return to “Scripting”