[Decorate] Object solid to projectiles but not for player.

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
TheGameratorT
Posts: 63
Joined: Sun Mar 04, 2018 4:42 am
Graphics Processor: nVidia with Vulkan support
Location: Portugal

[Decorate] Object solid to projectiles but not for player.

Post by TheGameratorT »

So I wander if It's possible for an actor to be solid to projectiles but not for the actor?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49095
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [Decorate] Object solid to projectiles but not for playe

Post by Graf Zahl »

In DECORATE you cannot do it, but in ZScript you can override the CanCollideWith method to exclude players.
User avatar
TheGameratorT
Posts: 63
Joined: Sun Mar 04, 2018 4:42 am
Graphics Processor: nVidia with Vulkan support
Location: Portugal

Re: [Decorate] Object solid to projectiles but not for playe

Post by TheGameratorT »

Ok thx
User avatar
TheGameratorT
Posts: 63
Joined: Sun Mar 04, 2018 4:42 am
Graphics Processor: nVidia with Vulkan support
Location: Portugal

Re: [Decorate] Object solid to projectiles but not for playe

Post by TheGameratorT »

I'm having problem with this CanCollideWith.

What I wan't to do is allow FlashLightLight and FlashLightLight2 to be blocked and all the other actors to not be blocked, but I don't know how I can do this :(

Can anyone help me?
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: [Decorate] Object solid to projectiles but not for playe

Post by Apeirogon »

If FlashLightLight and FlashLightLight2 is a aclor decorate/zscript class names, then

Code: Select all

class name : actor
{
override void cancollidewith(actor other)
{
if(other is "FlashLightLight" || other is "FlashLightLight2" ){return true;}

return false;
}

//other actor definition
}
This make actor collided only with FlashLightLight and FlashLightLight2 actors.
User avatar
TheGameratorT
Posts: 63
Joined: Sun Mar 04, 2018 4:42 am
Graphics Processor: nVidia with Vulkan support
Location: Portugal

Re: [Decorate] Object solid to projectiles but not for playe

Post by TheGameratorT »

Thx a lot for the help :)

But only launches like this:

Code: Select all

Class WallPizza : ACTOR
{
override bool CanCollideWith(Actor other, bool passive)
{
    if (!passive)
    {
        if(other is "FlashLightLight" || other is "FlashLightLight2" )
        return true;
    }
    return false;
}
    Default
    {
		Radius 30;
		Height 60;
		Scale 1.0;
		+NOGRAVITY;
		+NOTELEPORT;
		+CANNOTPUSH;
    }
    States
    {
	Spawn:
		CYBI A -1;
		Stop;
    }
}
And none of them are affected.
User avatar
TheGameratorT
Posts: 63
Joined: Sun Mar 04, 2018 4:42 am
Graphics Processor: nVidia with Vulkan support
Location: Portugal

Re: [Decorate] Object solid to projectiles but not for playe

Post by TheGameratorT »

Am I doing something wrong? I think I messed up something with the actors, because if I set !passive true and flashlightlight and flashlightlight2 false light is blocked
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: [Decorate] Object solid to projectiles but not for playe

Post by Apeirogon »

Of cource yes.

Remove line and brackets with (!passive).
"Non passive" means "if actor itself run into other actor", "passive" means "if some one other try to run into actor". Like, if YOU try to step on/in actor position, which have !passive argument, you cant do so, but actor ITSELF, if it try to step on/in you position can do so.
User avatar
TheGameratorT
Posts: 63
Joined: Sun Mar 04, 2018 4:42 am
Graphics Processor: nVidia with Vulkan support
Location: Portugal

Re: [Decorate] Object solid to projectiles but not for playe

Post by TheGameratorT »

Thx Apeirogon worked like a charm :)
And thx to Graf for telling me about CanCollideWith :p

Return to “Scripting”