TheGameCreators / GameGuruRepo

The GameGuru Repository For Community Collaboration
http://www.game-guru.com
137 stars 56 forks source link

GameGuru MAX - Request - "Trigger" by Volume not Center #2522

Closed MonkeyFrogStudio closed 10 months ago

MonkeyFrogStudio commented 2 years ago

For my test level, I've created custom custom triggers. These are just cubes that I use, attaching the Switch Behaviour, for example, and linking them to a door so the player can trigger a sliding door to open from a bit of a distance. Originally, what I tried to do was place the cube in the center of the door, which is a thick, steel door, and scale it outward so that it's sides would protrude enough into the hallway that the player could encounter it from either side of the hallway and, thus, be able to use the one trigger to activate the door by pressing "E". However, this did not work. It appears that the player needs to encounter the CENTER of the trigger object and not the BOUNDARY or VOLUME. And since the center was in the midst of the door, the player could never get to it and, thus, could never trigger the door to open via my custom trigger volume.

Because of this, I would like to request that we are able to use the volume of an object to trigger an event and not it's center. Therefore, if I set up a cube as a trigger that encompasses an entire room that, for example, allows a player to turn on all lights in that room by pressing "E", then they should be able to be anywhere within the volume of that trigger, press "E", and the lights go on or off.

BTW - the custom triggers use a material with the alpha clipping set to 0 so they are invisible and collision set to "no collision" so the player can walk through them.

Currently, I have two triggers, one on either side of my doors to open them (like using a visible switch on either side), but I would prefer to be able to use one trigger volume that is just placed over the door area. The player enters this from either side and the door opens or can be triggered to be opened. One and done. ;) And this sort of thing opens a lot of game play options since custom volumes can be used for a lot of different things.

MonkeyFrogStudio commented 2 years ago

@Necrym59 What is the file? Slider? Is it for a sliding door? If so, thanks. But my request is for something larger. I have a lot of uses for triggers in general and need them to work as a trigger volume, sort of like the Plrinzone, but that Behaviour removes the zone after it does it job. I need a permanent zone that is there to always do it's job. ;)

MonkeyFrogStudio commented 2 years ago

I really appreciate it. I really do. What I actually want is for TGC to implement a solution that all of us can use within MAX. Even if it's a Behaviour that works similar to the Plrinzone behavior, but doesn't remove the zone afterward. That way the zone can be used to trigger events of all kinds and be sized.

However, having the ability to use a trigger volume, which is pretty standard in most game engines, is preferred. You could use any geometric shape and it's boundary would be the volume that determines the trigger area. As long as the player is touching or within this volume, they can trigger whatever event is associated with the volume, whether that's an automatic door, a door that opens by key press, triggering the spawning of enemies, causing a message to play, springing a trap, alerting enemies, etc. Trigger volumes are quite versatile. But my current experiments show that bringing in geometry in an attempt to use as trigger volumes is not exactly working properly because it appears that MAX is using the volume's center instead of it's boundary. Thus, my request. :)

MonkeyFrogStudio commented 2 years ago

I'll start by saying, you rock! Thanks, really.

However, no. That's close. It sort of does what I want, but not quite. Because I can attach the marker behaviour you've created to the volume as a trigger, I cannot assign another behavior to it. For example, what if I want this area to act as a switch (i.e. use the Switch Behaviour while the player is inside the volume)? If Trigger volumes simply ... worked (i.e. MAX recognized the boundaries and not just the center) ... then I could use any of the stock Behaviours without worry.

With your solution, I hooked the my custom trigger volume up to a sliding door. With Toggle, the door opened and closed automatically over and over and over without the player being anywhere near the volume. With Activate, the door opened once without the player having entered the volume. So, the player didn't have to enter the volume for it to trigger the sliding door Behavior in this instance. By connecting the marker/volume to the door, it just opened.

Perhaps I am doing something incorrectly?

Don't get me wrong. It's really awesome that you're trying to help. I just think that if Trigger Volumes were an actual thing in MAX, then they would work out-of-the-box with MAX's standard Behaviours.

MonkeyFrogStudio commented 2 years ago

@Necrym59 You are amazing and so is this script! Thank you so very much! I love the automatic part, so I can have events happen just by the player entering the volume.

Having said that, the Behavior does seem a bit buggy. There are two things I've noticed already:

1 - On manual mode I get the message "E to switch on" and can activate the door from very, very far away from the actual volume ... and I've not even scaled the volume in this test. I can create a video, if you'd like to see it.

2 - After doing a test and switching to Automatic Mode and then back to Manual Mode, the script refused to work in Manual Mode. A restart of MAX caused it to work again.

This is amazing work and makes me jealous that I have such a huge mental block when it comes to coding. Thank you again for your effort. This should become a standard part of MAX, imo.

Necrym59 commented 2 years ago

Ill have a look at it, Max can hold on to things in its cache i have noticed sometimes a save/reload or at worst rest fixes it, yeah please send me a vid link so i can debug it. I think it could be a good addition to max.

MonkeyFrogStudio commented 2 years ago

Here's the video:

https://user-images.githubusercontent.com/36735507/158949515-7b7f95aa-80f4-4dea-ae1e-00b088457dab.mp4

Now, in this case, I couldn't get manual to work (pressing "E" would not open the door), even with a restart, but automatic was working ... though from a great distance (and all the way up to the door). But you can see when the Open message was appearing (and disappearing). When manual does work, it works like automatic ... from a great distance away.

In another test level, it was working from around a corner, indicating that the trigger volume was really large in all directions.

MonkeyFrogStudio commented 2 years ago

@Necrym59 This one is also opening from very far away despite the size of the trigger volume, both in automatic and manual mode.

MonkeyFrogStudio commented 2 years ago

Do you mean "Switched on"? No, I don't have that checked.

Necrym59 commented 2 years ago

OK this one is better for now, we have to lose the invisibility or there is nothing to check collisions with so just make it invisible with alpha clipping in materials. Also added a range limiter for tweaking far activation which shouldnt happen now anyway. I will have to do some deeper checking for extraneous collisions and will work on it. Give this a go trigvolume_v4.zip

Granada1 commented 2 years ago

Is it ok if I try this !

MonkeyFrogStudio commented 2 years ago

@Necrym59 This is mostly working. I still get the "E to switch ON" text at "random" intervals as I approach the Trigger Volume going down the long hall. And when on automatic, there's one area before the volume that actually opens the door and then closes it, all before I actually get to the trigger volume. Other than that, it works great!

I'll do a video of what it's doing ... be just a moment.

MonkeyFrogStudio commented 2 years ago

Here they are:

https://user-images.githubusercontent.com/36735507/158977498-550b88d7-9bad-4dd3-8803-ab08fbd242fb.mp4

https://user-images.githubusercontent.com/36735507/158977508-324887dd-04fc-44e1-90af-0dcf7630e3ce.mp4

As you can see, on automatic, the door rises early at one spot. On manual, the message shows up several times way before the player gets to the trigger volume.

Fortunately, for me, I don't care about the message one on manual because I don't like them. I like having no message and the player having to just try doors to see if they open or not using whatever the designated action key is. ;)

MonkeyFrogStudio commented 2 years ago

@Granada1 - I certainly don't mind. I believe that @Necrym59 made this for anyone, not just me.

Granada1 commented 2 years ago

👍

MonkeyFrogStudio commented 2 years ago

@Necrym59 There are other issues I am running into with this. I tried using this to automatically open the door, then close it on the opposite side. Exiting the volume does not trigger the toggle. So, I tried attaching a second Trigger volume (one to one side and one to the other) to toggle the door state. For whatever reason, the second one would not do anything. It just wouldn't work.

A nice feature to have (perhaps a check box or some such) would be an Entry and Exit state. So, toggle the state on Entry of the volume and toggle again on Exit of the volume. This way, one Trigger Volume could be used for something like an automatic door. The Trigger Volume would be positioned centered on the door, but extended outward beyond the front and the back, far enough for the player to interact with it before encountering the door from either end. As they approach the door, they Enter the Trigger Volume and it toggles the state of the door (it opens). After the player goes through the door, on the other side, they Exit the Trigger Volume, toggling the state of the door again (it closes).

EDIT - In most game engines, Trigger Volumes have THREE states that are tracked or can be used:

With these three, it enable the end-user to configure events for any of them - X happens when player ENTERS the trigger volume, X happens when player EXITS the trigger volume, or X happens only while the player REMAINS INSIDE the trigger volume. The first two are the most common ones used, though.

MonkeyFrogStudio commented 2 years ago

The manual side of this is working great ... other than the random "E to switch ON" text ... which I've turned off. ;)

Again, thank you so very much for creating this!

Necrym59 commented 2 years ago

HI Argent V5 for your appraisal trigvolume_v5.zip Modes now are

MonkeyFrogStudio commented 2 years ago

Thanks! You rock!

Necrym59 commented 2 years ago

Hopefully its functional all i have to do now is tidy it up a bit and do some scale checks etc.

MonkeyFrogStudio commented 2 years ago

Have you tested this on the latest MAX build? For whatever reason, it's not working at all. I've even restarted MAX a few times. I'll test some more.

Necrym59 commented 2 years ago

just downloading now ill check it over

MonkeyFrogStudio commented 2 years ago

Yeah, I can't get manual mode to work at all. In fact, none of the On Text/Off Text is even showing up.

Necrym59 commented 2 years ago

hmm try deleting the offending box and put a fresh one in then resave some times max hangs onto things but let me check first after ive downloaded the updatet incase they broke somthing :)

MonkeyFrogStudio commented 2 years ago

I've done that as well. Several times. I even started a fresh project with just a door and the new trigger volume in it. It won't work. :)

Necrym59 commented 2 years ago

OK ill investigate:) you still have the previous one

Necrym59 commented 2 years ago

Hey Argent can you send me a sample map with a corrior or door your using so i can test it

MonkeyFrogStudio commented 2 years ago

Sorry. I was away from my PC. Give me a moment and I will send you the small test map. It's just a door with the trigger volume.

MonkeyFrogStudio commented 2 years ago

Here you go:

http://www.argentarts.com/uploads/TriggerTest.zip

I hope I've given you everything you need. If I'm missing anything, let me know. It's just a door and your trigger in an empty. Of course, you have the standard MAX behaviors for the door to slide up (which is already attached to the door).

Necrym59 commented 2 years ago

OK the only problem i see is the Volume is below floor level the bas must be seen for collision purposes I will make this better later on

MonkeyFrogStudio commented 2 years ago

That did it! Works perfectly now. I didn't even pay attention to that. Just dropped it into the scene to test.

If you need help with a model or texture, let me know. That's my area of expertise. :)

Necrym59 commented 2 years ago

lol when i get time to actually build i just might - i do like some of the stuff you have done especially the doom redo :) (im old school i know), in fact im sure ive bought some flags or somthing from tcg store of yours.

MonkeyFrogStudio commented 2 years ago

Old school is the best!

Nope. Not from me. I've not made anything for the store.

Necrym59 commented 2 years ago

ah no that was avenging angel lol sorry So how is it going is it ok - no biggie problems - ready for me to tidy up the code!

MonkeyFrogStudio commented 2 years ago

Let me test it some more. Give me about 5 more minutes. I was testing the new demos, doing FPS tests, etc. Just a moment ...

MonkeyFrogStudio commented 2 years ago

There appears to be the old issue on both automatic modes of it opening/closing the door way before getting to the actual trigger volume. I'll do a video.

MonkeyFrogStudio commented 2 years ago

Here you go:

https://user-images.githubusercontent.com/36735507/159103432-07bcf27a-b604-4841-9385-5be08361f88f.mp4

There appear to be two spots that cause the door to just open/close right away ... like there's a trigger that's paper thin.

Necrym59 commented 2 years ago

Change your range limiter for that volume. Until i code the auto range limiter stuff. and make sure you have the Switched on box -OFF

MonkeyFrogStudio commented 2 years ago

Works like a charm. Setting it to 100 is like magic. All functions (manual, automatic, and automatic entry/exit all work as expected. I love this script. :)

Necrym59 commented 2 years ago

Glad you like it enjoy! Any other bright ideas let me know :)

MonkeyFrogStudio commented 2 years ago

Oh, that's a dangerous box to open, there! :P

MonkeyFrogStudio commented 2 years ago

Thank you! I'll definitely look through them. I am code-blind, I suppose. Never really took to it. So, I do art. Any code help I can get, I appreciate. :)

Necrym59 commented 2 years ago

If you need somthing special for your project just email me Ill see what can be done.

MonkeyFrogStudio commented 2 years ago

Can you send me an email to: contact@argentarts.com That way I can have your email on file. Thanks again. :)

MonkeyFrogStudio commented 10 months ago

This is no longer needed.