Page 1 of 1

Need help with CollisionZone

Posted: Mon Jun 12, 2017 11:16 pm
by PrinceOfFunky
I made this "one-line" code to make a zone acting like a wall, blocking actors.
Zb6TJnOvBZU
This is the code:

Code: Select all

class CollisionZone extends ZoneInfo;

event ActorEntered(Actor other) {
	other.HitWall(Normal(other.Location - Location), self);
}

defaultproperties
{
	bCollideActors=true
	bCollideWorld=true
	bBlockActors=true
	bBlockPlayers=true
}
As you can see from the video, projectiles act like it is a wall indeed, but few of them don't. Plus the player can still pass through it.
I tried putting "other.SetLocation(other.OldLocation)", but that completly blocks the player, like even in mid air.
Other things I tried are: - Calling other.Bump(self) - and other.Touch(self) - HitActor = Spawn(a blockall with bStatic set to False), still nothing.
Is what I'm trying to achieve even possible?

Re: Need help with CollisionZone

Posted: Tue Jun 13, 2017 1:44 am
by JackGriffin
I ran into the same issues when working on the frying pan. I wanted it to divert incoming projectiles back at the person shooting them. Ended up just giving up because projectile code is an absolute miasma of simulated, non-simulated, replicated, non-replicated voodoo. You will not be able to just do a simple "fix".

For the bonus round, just wait till you try this online. It's even worse.

Re: Need help with CollisionZone

Posted: Tue Jun 13, 2017 12:58 pm
by PrinceOfFunky
JackGriffin wrote:I ran into the same issues when working on the frying pan. I wanted it to divert incoming projectiles back at the person shooting them. Ended up just giving up because projectile code is an absolute miasma of simulated, non-simulated, replicated, non-replicated voodoo. You will not be able to just do a simple "fix".

For the bonus round, just wait till you try this online. It's even worse.
I think invertono the velocity would have been enough.

EDIT: I tried replacing the one-line code into this:

Code: Select all

Spawn(class'Blocker',,,other.Location).LifeSpan = 10;
But whenever something hits the zone the game crashes giving this error:

Code: Select all

Critical: DMMutator DM-CollisionZone.DMMutator0 (Function Botpack.DMMutator.CheckReplacement:0000) Infinite script recursion (250 calls) detected
I thought CheckReplacement was called only at the beginning of the game.

Re: Need help with CollisionZone

Posted: Tue Jun 13, 2017 2:59 pm
by JackGriffin
Not gonna work. A ton of projectile is simulated. The server may reorient or destroy the projectile but the client will still see it travel along the original path until it updates or times out. You can see this easily by scripting a zone that adds velocity to projectiles then shooting through it while online. You'll see different projectiles will do wildly different things depending on their settings.

You could create your own projectile class that will respond correctly to what you are doing but that won't help with default ones.

Re: Need help with CollisionZone

Posted: Tue Jun 13, 2017 9:04 pm
by Barbie
PrinceOfFunky wrote:I thought CheckReplacement was called only at the beginning of the game.
GameInfo.IsRelevant(), BaseMutator.IsRelevant(), $AllMutators.AlwaysRelevant() is always called for Actors entering the Level. Depending on its result $AllMutators.CheckReplacement() is called, too. See Wiki: Chain_Of_Events_When_Spawning_Actors for details.

Code: Select all

class CollisionZone extends ZoneInfo;
What is the aim of this? I'd realize that with a zone and invisible brush.

Re: Need help with CollisionZone

Posted: Wed Jun 14, 2017 12:42 am
by PrinceOfFunky
Barbie wrote:

Code: Select all

class CollisionZone extends ZoneInfo;
What is the aim of this? I'd realize that with a zone and invisible brush.
True but:
- 2 brushes are needed.
- The invisible brush cannot touch any surface.
If it is a zone, some stuff you could do is:
- Collision can eventually be toggled.
- Possibility to customize it, like letting only one team to pass through.