Page 1 of 1

How do I fix monsters not working with portals?

Posted: Wed Sep 06, 2017 8:39 am
by stan423321
I have recently been experimenting with altering small fragments of a map during runtime by dynamically setting up interactive line portals to prefabricated areas. This unfortunately messes with A_Chase monsters, since they follow the players by looking in their direction, map coordinate wise. So a monster that is behind a portal can, generally, end up going into a completely random direction after getting its sights on you. It doesn't have to, but it usually does.

The thing is, I think A_Chase would generally work well enough as is if I could supply my very own difference vector between player and the monster, or alternatively my very own player position instead of the true one. Is there any obvious method of doing this, especially something involving ZScript? The only thing that comes to mind is setting up some sort of fake target actor for every combination of map-misplaced room and a player, but that sounds like an overkill if I have a non-single digit amount of rooms, plus maybe it wouldn't even be working? I am assuming here I can mod the monster's code and supply my own A_Chase equivalent, though a method not involving this would obviously be better.

Re: How do I fix monsters not working with portals?

Posted: Wed Sep 06, 2017 12:43 pm
by Rachael
My first question is, have you tried using Static (Eternity) style portals? If you do that, then A_Chase should become portal-aware and monsters will chase you through them like normal. They can also attack you from the other side of a portal, as well, and dynamic lights should also render through the other side.

Re: How do I fix monsters not working with portals?

Posted: Wed Sep 06, 2017 2:34 pm
by Amuscaria
Rachael wrote:My first question is, have you tried using Static (Eternity) style portals? If you do that, then A_Chase should become portal-aware and monsters will chase you through them like normal. They can also attack you from the other side of a portal, as well, and dynamic lights should also render through the other side.
Oh Snap... Gotta make use of this.

Re: How do I fix monsters not working with portals?

Posted: Thu Sep 07, 2017 12:49 am
by stan423321
I admit I have not experimented with static line portals, but according to wiki, they are mutually exclusive with setting up the connection during runtime, as you cannot run Line_SetPortalTarget on them, and Line_SetPortal appears to work exclusively during map loading, at which point target is constant. So this feature doesn't sound fit for described purposes.

Re: How do I fix monsters not working with portals?

Posted: Thu Sep 07, 2017 2:55 am
by Rachael
Then, unfortunately, what you want is not currently available to the engine.

Re: How do I fix monsters not working with portals?

Posted: Thu Sep 07, 2017 4:09 am
by Graf Zahl
Keep in mind that in order for the AI to be able to look through portals, the offset needs to be static throughout the level's duration and that's simply not doable with portals that can be retargeted.

Re: How do I fix monsters not working with portals?

Posted: Thu Sep 07, 2017 9:09 am
by stan423321
Well, if that's the case, then wiki description of interactive portals is wrong at the moment - it explicitly says monsters looking through them work. I'll try to fix that soonish, but someone more knowledgeable with the specifics should probably refine the portals article then, as I will just delete the erroneous part.