Is the NOCLIP flag impossible to change?

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
nuclear_shmatt
Posts: 5
Joined: Fri Apr 23, 2021 9:17 pm

Is the NOCLIP flag impossible to change?

Post by nuclear_shmatt »

I'm making a multiplayer mod, group of players vs an omnipotent monster that can noclip around to stop the group from exiting the level.

Code: Select all

IfNoclipOn:
		UDM2 A 0 A_SetTranslucent(0, 0)
		UDM2 A 0 A_ChangeFlag("FLOATBOB", true)
		UDM2 A 0 A_ChangeFlag("NOCLIP", true)
		UDM2 A 0 A_ChangeFlag("SOLID", false)
		UDM2 A 0 SetPlayerProperty (0, 1, 3)
		UDM2 A 0
		UDM2 A 1
		Goto Spawn
IfNoclipOff:
		UDM2 A 0 A_SetTranslucent(1, 0)
		UDM2 A 0 A_ChangeFlag("FLOATBOB", false)
		UDM2 A 0 A_ChangeFlag("NOCLIP", false)
		UDM2 A 0 A_ChangeFlag("SOLID", true)
		UDM2 A 0 SetPlayerProperty (0, 0, 3)
		UDM2 A 0
		UDM2 A 1
		Goto Spawn
I want to the monster to hop in and out of noclip. A_ChangeFlag doesn't seem to work though.
I can just leave the monster in noclip if I'm left with no other choice.
User avatar
Player701
 
 
Posts: 1710
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Is the NOCLIP flag impossible to change?

Post by Player701 »

Changing NOCLIP to true both via ZScript (bNoclip = true) and DECORATE (A_ChangeFlag("NOCLIP", true)) works fine for me. Perhaps you're using an outdated (and potentially buggy) version of GZDoom, or maybe the problem is somewhere else in your code. Please make sure that you're using the latest GZDoom release, and if that's the case and the flag is still not changing for you, then you should post your entire code here for us to take a look at.
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: Is the NOCLIP flag impossible to change?

Post by Apeirogon »

If I understand what you are trying to do correctly, you have wrong state labels for actions.
In IfNoclipOn you
UDM2 A 0 A_ChangeFlag("FLOATBOB", true)
UDM2 A 0 A_ChangeFlag("NOCLIP", true)
UDM2 A 0 A_ChangeFlag("SOLID", false)
and in IfNoclipOff
UDM2 A 0 A_ChangeFlag("FLOATBOB", false)
UDM2 A 0 A_ChangeFlag("NOCLIP", false)
UDM2 A 0 A_ChangeFlag("SOLID", true)
while it should be vice versa.
If noclip is on, in IfNoclipOn you should turn it off and make monster solid and floatbob, and in IfNoclipOff you should turn noclip on and disable "solidness" and "floatbobignes".
User avatar
Player701
 
 
Posts: 1710
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Is the NOCLIP flag impossible to change?

Post by Player701 »

Apeirogon wrote:If I understand what you are trying to do correctly, you have wrong state labels for actions.
Yeah, didn't notice that, so could be the problem as well. Like I said before, if it still doesn't work, we need to see the full code.
nuclear_shmatt
Posts: 5
Joined: Fri Apr 23, 2021 9:17 pm

Re: Is the NOCLIP flag impossible to change?

Post by nuclear_shmatt »

I'm using Q-Zandronum, which is the a fork of the Zandronum 3.0. I would use GZdoom but GZdoom lacks full and proper multiplayer support and the concept doesn't work without it since you can't respawn once you die. Q-Zandronum doesn't support ZScript yet, I'm hoping they can do that soon. I would use a multiplayer port with ZScript if I could find one somewhere.
Originally, I used a script in ACS to tell the game to run the console command "noclip" but I couldn't get the script to get past sv_cheats 0 in multiplayer, so, I bailed on that.
I'll post the full code later on though.
nuclear_shmatt
Posts: 5
Joined: Fri Apr 23, 2021 9:17 pm

Re: Is the NOCLIP flag impossible to change?

Post by nuclear_shmatt »

This is the decorate for the monster or 'entity'.

Code: Select all

Actor The_Entity : PlayerPawn 900
{
	  limitedtoteam 1
	  
	  Speed 1
	  Health 100
	  Radius 16
	  Height 56
	  Mass 100
	  PainChance 255
	  Player.Maxhealth 100
	  Player.DisplayName "The Entity"
	  Player.CrouchSprite "PLYC"
	  Player.StartItem "TheEntity_Power"
	  Player.StartItem "TheEntity_Eye"
	  Player.StartItem "TheEnt_Noises"
	  Player.StartItem "TheEnt_Sight"
	  Player.StartItem "TheEht_Ammo1"
	  Player.SoundClass "theent"
	  Player.WeaponSlot 1, TheEntity_Power
	  Player.ColorRange 112, 127
	  
	  -PICKUP
	  -SHOOTABLE
	  +SHADOW
	  +INVULNERABLE
	  +NODAMAGE
	  +NEVERTARGET
	  +NOTRIGGER
	  +NOSKIN
	  +NOCLIP
	  
	  States
	  {
	  Spawn:
		UDM2 A 0 ACS_ExecuteAlways(992)
		UDM2 A 0 SetPlayerProperty(0, 1, 1)
		UDM2 A 1
		Loop
	  See:
		UDM2 ABCD 4 
		Loop
	  Missile:
		UDM2 E 12
		Goto Spawn
	  Melee:
		UDM2 F 6 BRIGHT
		Goto Missile
	  Pain:
		UDM2 G 4 
		UDM2 G 4 A_Pain
		Goto Spawn
	  IfNoclipOn:
		UDM2 A 0 A_SetTranslucent(0, 0)
		UDM2 A 0 A_ChangeFlag("THRUACTORS", true)
		UDM2 A 0 A_ChangeFlag("FLOATBOB", true)
		//UDM2 A 0 A_ChangeFlag("NOCLIP", true)
		UDM2 A 0 A_ChangeFlag("SOLID", false)
		UDM2 A 0 SetPlayerProperty (0, 1, 3)
		UDM2 A 0
		UDM2 A 1
		Goto Spawn
	  IfNoclipOff:
		UDM2 A 0 A_SetTranslucent(1, 0)
		UDM2 A 0 A_ChangeFlag("THRUACTORS", false)
		UDM2 A 0 A_ChangeFlag("FLOATBOB", false)
		//UDM2 A 0 A_ChangeFlag("NOCLIP", false)
		UDM2 A 0 A_ChangeFlag("SOLID", true)
		UDM2 A 0 SetPlayerProperty (0, 0, 3)
		UDM2 A 0
		UDM2 A 1
		Goto Spawn
	  Death:
		TNT1 A 0 ACS_ExecuteAlways(993, 0)
		UDM2 I 10 A_PlayerScream
		UDM2 J 10 A_NoBlocking
		UDM2 KLM 10
		UDM2 N -1
		Stop
	  XDeath:
		TNT1 A 0 ACS_ExecuteAlways(993, 0)
		UDM2 O 5
		UDM2 P 5 A_XScream
		UDM2 Q 5 A_NoBlocking
		UDM2 RSTUV 5
		UDM2 W -1
		Stop
	  }
}

Actor TheEntity_Power : Weapon
{
	Weapon.SelectionOrder 3700
	Weapon.Kickback 100
	Weapon.AmmoType "TheEnt_Ammo1"
	Weapon.AmmoUse 100
	Obituary "%o was killed by the entity."
	Tag "Kill & Noclip"
	+WEAPON.NOALERT
	
	States
	{
	Ready:
		TNT1 A 1 A_WeaponReady
	Loop
	
	Deselect:
		TNT1 A 1 A_Lower
	Loop
	
	Select:
		TNT1 A 1 A_Raise
	Loop
	
	Fire:
		TNT1 B 1
		TNT1 C 1 A_FireBullets(1.2, 1.2, 64, 999, TheEnt_Puff)
		TNT1 D 1
		TNT1 C 1
		TNT1 B 1 A_ReFire
		Goto Ready
	
	AltFire:
		TNT1 A 0 ACS_ExecuteAlways(994, 0)
		TNT1 A 16
		Goto Ready
	  }
}
ACS for the noclip to activate since I have the noclip be used as a custom key.

Code: Select all

Script 998 (Void) net CLIENTSIDE {
	LocalAmbientSound("misc/p_pkup", 0.5);
	
	if(TheEntNoclip == false) {
	
		TheEntNoclip = true;
		SetActorProperty(0, APROP_Speed, 1.5);
		SetActorState(0, "IfNoclipOn");
		//ConsoleCommand("noclip");
		
	} else {
		
		TheEntNoclip = false;
		SetActorProperty(0, APROP_Speed, 1.0);
		SetActorState(0, "IfNoclipOff");
		//ConsoleCommand("noclip");
	}
	
	//if(TheEntNoclip == true) TheEntNoclipHUD = true; else TheEntNoclipHUD = false;
	Hudmessage(s: "Flight + Invisibility: ", d:TheEntNoclip; HUDMSG_PLAIN, 1, CR_WHITE, 0.1, 0.1, 0);
}

Script 997 (Void) net {

	if(TheEntNoclip == true) {
		
		TheEntNoclip = false;
		SetActorProperty(0, APROP_Speed, 1.0);
		//ConsoleCommand("noclip");
		Print(s: "Noclip Off");
	}
	
	/*if(davidNotarget == false) {
		
		davidNotarget = true;
	}*/
}
Post Reply

Return to “Scripting”