How to make actor solid for monsters, but not for players

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: How to make actor solid for monsters, but not for player

Post by Graf Zahl »

Vaecrius wrote:ZScript is your friend for something like this.

Here is a barrel that players can pass through but nothing else can:

Code: Select all

class MonsterBlocker : ExplosiveBarrel
{
	override bool CanCollideWith(actor other, bool passive)
	{
		 if(other is "PlayerPawn") return false;
		 else return super.CanCollideWith(other, passive);
	}
}
For performance reasons better do:

Code: Select all

class MonsterBlocker : ExplosiveBarrel
{
	override bool CanCollideWith(actor other, bool passive)
	{
		 return !(other is "PlayerPawn");
	}
}
The super call is not needed here and only wastes time in a time critical piece of code.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: How to make actor solid for monsters, but not for player

Post by Graf Zahl »

UsernameAK wrote:But... the players will cross players
There is no solution for Zandronum. It doesn't have any feature that allows such fine grained distinction for what an actor can collide with.

Nevander wrote: And the ZScript method does not? I fail to see the difference besides the method of how you make the engine do the things, or why only ZScript has access to engine parameters that other lumps don't.
I fail to see your point. Why should there be any native implementation that only creates more overhead for something there's already a solution for?

In terms of feature implementation DECORATE is deprecated, i.e. there won't be any new engine features whose only purpose is to avoid writing some ZScript code.
Either way you could never use said feature with an old pre-ZScript engine version.
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm
Contact:

Re: How to make actor solid for monsters, but not for player

Post by Arctangent »

UsernameAK wrote:But... the players will cross players
You have to take what you can get when you're working with Zan.
Kotti
Posts: 86
Joined: Tue Dec 27, 2016 4:08 am

Re: How to make actor solid for monsters, but not for player

Post by Kotti »

Nevander wrote:What I'd like to know is if ZScript can do that, then why can't something like

-SOLIDFORMONSTERS
+SOLIDFORPLAYERS

be done? The engine is obviously capable of distinguishing them.
I beg your pardon?
Are you even aware of the distinction between implementing this feature on the mod side vs. the engine side?

To make it short: The check required here can be done without modifying the engine, but what you propose is a dedicated new engine feature with extremely low usability. Do you have any other motivation outside of "I don't want to use ZScript at all costs"?
User avatar
UsernameAK
Posts: 83
Joined: Wed Jul 15, 2015 5:26 am
Location: Ukraine

Re: How to make actor solid for monsters, but not for player

Post by UsernameAK »

I want to just not support Zandronum, but our main developer says that WE NEED TO SUPPORT THAT
User avatar
UsernameAK
Posts: 83
Joined: Wed Jul 15, 2015 5:26 am
Location: Ukraine

Re: How to make actor solid for monsters, but not for player

Post by UsernameAK »

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA THAT IDIOT WANTS BOOM
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: How to make actor solid for monsters, but not for player

Post by Graf Zahl »

Well, there goes any modding choice. Welcome Dehacked! :mrgreen:
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm
Contact:

Re: How to make actor solid for monsters, but not for player

Post by Arctangent »

Time to find a new head dev!
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: How to make actor solid for monsters, but not for player

Post by Matt »

Graf Zahl wrote:For performance reasons better do:

Code: Select all

class MonsterBlocker : ExplosiveBarrel
{
	override bool CanCollideWith(actor other, bool passive)
	{
		 return !(other is "PlayerPawn");
	}
}
The super call is not needed here and only wastes time in a time critical piece of code.
Thanks! This will help me in something else I'm working on...
Locked

Return to “Editing (Archive)”