[ZScript] 3D Platform Actor (v2.2b)

Post your example zscripts/ACS scripts/etc here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
doomzie
Posts: 94
Joined: Sat Apr 30, 2022 4:26 am

Re: [ZScript] 3D Platform Actor (v1.1.1)

Post by doomzie »

FishyClockwork wrote: Sat Feb 25, 2023 2:09 pm I think you can get away with 1080° just make sure "exactAngs" is false. (I'm assuming you want to rotate in one direction?)

Give it a try.
Yes on exactAngs and also need to pay better attention to :

Code: Select all

int/*fixed*/ ang
=) That comment matters =)

Also, just to be sure, do you need to check "IsPlatActive" after "MakeGroup" ? I assume it's not necessary right, since it's not "velocity based movement".
Last edited by doomzie on Sat Feb 25, 2023 3:24 pm, edited 1 time in total.
User avatar
Fishytza
Posts: 783
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: No Preference

Re: [ZScript] 3D Platform Actor (v1.1.1)

Post by Fishytza »

If the group is on the move then IsPlatActive returns true when you call it on any group member.
If I understand your question right, then yeah, group them together and then check if it's active.
doomzie
Posts: 94
Joined: Sat Apr 30, 2022 4:26 am

Re: [ZScript] 3D Platform Actor (v1.1.1)

Post by doomzie »

FishyClockwork wrote: Sat Feb 25, 2023 3:15 pm If the group is on the move then IsPlatActive returns true when you call it on any group member.
If I understand your question right, then yeah, group them together and then check if it's active.
Ok, but as long as there is no X,Y,Z movement ongoing, then it's not necessary to call IsPlatActive, if I understand it correctly. MakeGroup and LeaveGroup don't need no delay loop after it. Ok.
User avatar
Fishytza
Posts: 783
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: No Preference

Re: [ZScript] 3D Platform Actor (v1.1.1)

Post by Fishytza »

IsActive is for when it's currently (trying) to follow a path. HasMoved() is the one that checks if it's "active" and has moved since the last tic.
doomzie
Posts: 94
Joined: Sat Apr 30, 2022 4:26 am

Re: [ZScript] 3D Platform Actor (v1.1.1)

Post by doomzie »

FishyClockwork wrote: Sat Feb 25, 2023 1:39 pm So if I'm reading that right, you're checking if the (presumably idle) platform has the player as its passenger before you send that platform to its destination? Okay, so the Delay(1); part is useless in that case. I've changed the HasPassenger function so the platforms being checked will be forced to do a blockmap search for new passengers. I want you to fetch the latest commit and see if that fixes it.
Updated. HasPassenger() in my script works perfectly as expected now! =)) Going to do some more testing later in other setups I have, but the twin bridge is functional without making any change. Thanks so much.

If you have a group and you use either "Rotate" or "MoveAndRotate" with the master/primary platform, but only the primary platform rotates instead of the whole group, what does that mean? When I use "Move" on the same tag, the whole group moves, but Rotate doesn't? It all works great though on individual platforms, any kind of rotation, but when I pass the primary tag ID of the group, it only rotates that actor particulary. Too late now for further digging, but currently struggling on this. Enough for today. Be back later.
User avatar
Fishytza
Posts: 783
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: No Preference

Re: [ZScript] 3D Platform Actor (v1.1.1)

Post by Fishytza »

doomzie wrote: Sat Feb 25, 2023 6:15 pm If you have a group and you use either "Rotate" or "MoveAndRotate" with the master/primary platform, but only the primary platform rotates instead of the whole group, what does that mean?
Ideally it should mean those others are no longer in the group, but I strongly suspect that's not the case. At least I can't reproduce what you described on my end.
However I did a test where I gave each platform the same TID and set it so it groups with its own tid (yes you can do that), then I used _Rotate() on it. I was expecting only one of them would do the rotation but instead a bug reared its head and they all did the rotation command in turn (after one was done another one would do the same thing.) That wasn't supposed to happen so I fixed it.

Thanks for making me discover and fix a niche bug lmao xD
doomzie
Posts: 94
Joined: Sat Apr 30, 2022 4:26 am

Re: [ZScript] 3D Platform Actor (v1.1.1)

Post by doomzie »

FishyClockwork wrote: Sun Feb 26, 2023 5:08 am
doomzie wrote: Sat Feb 25, 2023 6:15 pm If you have a group and you use either "Rotate" or "MoveAndRotate" with the master/primary platform, but only the primary platform rotates instead of the whole group, what does that mean?
Ideally it should mean those others are no longer in the group, but I strongly suspect that's not the case. At least I can't reproduce what you described on my end.
Sent you a private message with a download link to a tiny test map demonstrating my issue.

Flip the switch in the map to make the stacked cube pillar move. The script will do several movements, group based and non-group based, calling Move, Rotate and MoveAndRotate. There's prints in the script so you can follow along trying the map out. This is a cut-out of a much bigger concept, these pillars are the corners (side walls) and I want them to do dynamic moves (dynamic wall) back and forth and rotate and whatever. At the moment I'm focussing on what the issue is with rotating a group. It's quite possible I'm just doing something wrong.

The later part of this testing would be to have the second pillar mirror exactly what the other pillar is doing in the most efficient way. I've just started testing, so no idea what I have to do exactly. It's not yet doing what it's supposed to do obviously =)

Ok, thanks for having a look when you have some time.

I would not be against adding some special move to the pillar =)

Oh right, ignore the upper map spots in the cubes, I accidentally copied them in the demo map. It only uses the bottom map spot for start/base point XYZ reference data for the cube pillar. Everything is done through ACS with XYZ and arithmetic.
doomzie
Posts: 94
Joined: Sat Apr 30, 2022 4:26 am

Re: [ZScript] 3D Platform Actor (v1.1.1)

Post by doomzie »

I was wondering if you could make it so that you can chose whether you want the grouped members to rotate like the group master platform or not. I can think of situations where you would want both options, but maybe I'm not understanding well. Will wait for some feedback.

Something else to be sure. Spline paths are only possible with interpolation points? So you can't ACS a "spline path" with map spots (curved path, e.g. a circle/ellipse)?

And last thing I tried today was to implement spawning on a platform, but Spawn() doesn't spawn anything on a platform. The same statement with player based XYZ coordinates spawns just fine, but when I get XYZ from the platform, nothing happens. Yeah the tag ID is correct. Have you tried doing this? Should it work?
Last edited by doomzie on Tue Mar 14, 2023 1:19 pm, edited 1 time in total.
User avatar
Fishytza
Posts: 783
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: No Preference

Re: [ZScript] 3D Platform Actor (v1.1.1)

Post by Fishytza »

Regarding the rotation issue.
In your testmap you need to set the "Group move: Rotate Angle" option/flag if you want group members to rotate around/with the origin.
I admit it's my fault for not making it clear that "ACS commands don't need this" applies to individual platforms but not non-origin members. Sorry about that.
("Origin" is what you call the master/primary platform.)
doomzie wrote: Sun Feb 26, 2023 3:48 pm Splice paths are only possible with interpolation points? So you can't ACS a "splice path" with map spots (curved path, e.g. a circle/ellipse)?
I could add more ACS functions that define the "previous" point and "last" point. (The existing functions only define a "current" and "next" point internally so the movement logic is the same.)
doomzie wrote: Sun Feb 26, 2023 3:48 pmAnd last thing I tried today was to implement spawning on a platform, but Spawn() doesn't spawn anything on a platform. The same statement with player based XYZ coordinates spawns just fine, but when I get XYZ from the platform, nothing happens. Yeah the tag ID is correct. Have you tried doing this? Should it work?
I'm just guessing, but is there only one platform with that tag ID or are there more of them?
If there are multiple platforms with that same tag then depending on what you want you might want to use SpawnSpot() and not Spawn()
doomzie
Posts: 94
Joined: Sat Apr 30, 2022 4:26 am

Re: [ZScript] 3D Platform Actor (v1.1.1)

Post by doomzie »

FishyClockwork wrote: Mon Feb 27, 2023 4:04 am Regarding the rotation issue.
In your testmap you need to set the "Group move: Rotate Angle" option/flag if you want group members to rotate around/with the origin.
I admit it's my fault for not making it clear that "ACS commands don't need this" applies to individual platforms but not non-origin members. Sorry about that.
("Origin" is what you call the master/primary platform.)
Yes. Just did a quick test. Confirmed. Yeah, that's not obvious. Ok and with SetOptions I should be able to do all I want.
FishyClockwork wrote: Mon Feb 27, 2023 4:04 am
doomzie wrote: Sun Feb 26, 2023 3:48 pm Splice paths are only possible with interpolation points? So you can't ACS a "splice path" with map spots (curved path, e.g. a circle/ellipse)?
I could add more ACS functions that define the "previous" point and "last" point. (The existing functions only define a "current" and "next" point internally so the movement logic is the same.)
I'd very much appreciate it. Otherwise you're obliged to use map placed interpolation points for curved/spliced paths, which limits the possibilities.
FishyClockwork wrote: Mon Feb 27, 2023 4:04 am
doomzie wrote: Sun Feb 26, 2023 3:48 pmAnd last thing I tried today was to implement spawning on a platform, but Spawn() doesn't spawn anything on a platform. The same statement with player based XYZ coordinates spawns just fine, but when I get XYZ from the platform, nothing happens. Yeah the tag ID is correct. Have you tried doing this? Should it work?
I'm just guessing, but is there only one platform with that tag ID or are there more of them?
If there are multiple platforms with that same tag then depending on what you want you might want to use SpawnSpot() and not Spawn()
Spawn does work. Confirmed. Main issue was spawning (or rather trying to spawn) enemies inside the platform =-/ Just had to add actor Z height. However now I noticed that dead bodies still count as a passenger... and thus nothing is/was spawned.

Great.
User avatar
Fishytza
Posts: 783
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: No Preference

Re: [ZScript] 3D Platform Actor (v1.1.1)

Post by Fishytza »

doomzie wrote: Mon Feb 27, 2023 6:00 am Spawn does work. Confirmed. Main issue was spawning (or rather trying to spawn) enemies inside the platform =-/ Just had to add actor Z height. However now I noticed that dead bodies still count as a passenger... and thus nothing is/was spawned.
Try SpawnForced().
doomzie
Posts: 94
Joined: Sat Apr 30, 2022 4:26 am

Re: [ZScript] 3D Platform Actor (v1.1.1)

Post by doomzie »

Can you somehow find out if a platform is "stuck" (actually collided) with another platform? I would do a check and see if 60 seconds later the platform is still stuck, then flip the FPLAT_OPTFLAG_IGNOREGEO for 1 second or whatever.

FishyPlat_HasCollided(tid)

I understand this shouldn't be necessary, but with added randomness in movement, things become unpredictable. A possibility to override exists, but I don't know how to trigger it.

In the same context, could you trigger actor Death state if they collide?
User avatar
Fishytza
Posts: 783
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: No Preference

Re: [ZScript] 3D Platform Actor (v1.1.1)

Post by Fishytza »

Does it have to to be explicitly another platform or is it enough if anything blocks it?

If it's the later, try

Code: Select all

if (FishyPlat_IsActive(tid) == true && FishyPlat_HasMoved(tid, false) == false)
{
    //In the case it's "active" but hasn't moved it's most likely blocked
}
Also, wanting a Death state via collision sounds more like ZScript territory.

Actually hold on.
What about

Code: Select all

if (FishyPlat_IsActive(tid) == true && FishyPlat_HasMoved(tid, false) == false)
{
    SetActorState(tid, "Death");
}
?
doomzie
Posts: 94
Joined: Sat Apr 30, 2022 4:26 am

Re: [ZScript] 3D Platform Actor (v1.1.1)

Post by doomzie »

FishyClockwork wrote: Mon Feb 27, 2023 9:55 am Does it have to to be explicitly another platform or is it enough if anything blocks it?
I was thinking about actual platforms colliding yes, but rethinking after your comment. I'll try out some set ups and let you know. I think you're right and I won't need to actually check if it's collided against a platform or map geometry, it's something that I can handle on my side (map design wise). Generally speaking I won't have the platforms collide with geometry, even if I do "random" movements.

Thanks for being so helpful.
User avatar
Fishytza
Posts: 783
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: No Preference

Re: [ZScript] 3D Platform Actor (v1.1.1)

Post by Fishytza »

So about the spline thing being set from ACS, I need to know one thing.

Would you prefer one function with a lot of parameters that you have to call just once right after calling any of the _Move/Rotate functions? (It sets "previous" and "last" points in one call.)

Or would you be ok with calling the same function twice, first time to set the "previous" point and second time to set the "last" point, and again after the Move/Rotate stuff?

Or... do you want one function to set it all up in one call, but with a truckload of paremeters?
We're talking about the position and angle for "previous"(p1), "current"(p2), "next"(p3), and "last"(p4).
And since this is ACS that means three parameters x y z for the position, and of course three for angle, pitch, roll.

(And just as a reminder, "current" is where the platform is right now, "next" is the destination, with "previous" and "last" influencing the spline.)

Tbh, I'm wondering if this isn't overkill.


EDIT: Another idea would be to have a special function that for one tic only changes the behaviour of the _Move/Rotate functions. Something like FishyPlat_MarkForSlineSetup(tid)
followed by calling exactly 3 times any combination of the existing _Move/Rotate functions.
First call, sets p1
Second sets p3,
and the third and final one sets p4.
p2 is the platform's current position/angle/pitch/roll.

This would cut down on the ridiculous amount of parameters and also I wouldn't have to have variations of Move(), Rotate() and MoveAndRotate() for each separate point.

I should sleep on this.

Return to “Script Library”