Spawning Trigger Boxes for Horror Game!

i want to make a horror game but im not sure how people go past an area then comeback later on and something triggers, is it like they spawn a trigger box or something please help if you have any idea

The way i would do it is to have the trigger boxes already set up and ready in the level but have a variable that prevents them from functioning until you want them to. Its like having a locked door in a boss room, the door stays locked until a certain condition is met ie killing the boss, then it opens. you can do it all pretty easily through the level blueprint. i would have one blueprint for the trigger box and its functionality and within that blueprint have a onbeginoverlap node which is immediately followed by a branch. have a variable for the bool condition and call it something like canbeactivated. then in the level blueprint get a reference to the triggerboxBP and set the value of canbeactivated based on whatever condition youd like.

1 Like

im basically a beginner in UE4 so its hard to understand what to do but i will keep this handy if i figure it out thanks man

Hey i got it worked out but i want it to trigger like an animation or something but you cant reference anything in a blueprint. and it only worked when i deleted the branch and make literal bool in the level blueprint

you can actually reference almost anything in blueprint. whats your aim?

im trying to make it so when you come back to the area and overlap the triggerbox it will spawn a mannequin somewhere but when i try to drag it in it doesnt let me ( its in a trigger box blueprint not the level blueprint by the way ). its kinda like a nox timre sort of game, you know when it loops

in the picture i posted above the top half is in a blueprint i made and the lower half is in the level blueprint. i see one problem with the way you want this all to function. im my eyes you want there to be some condition that needs to be accomplished to to set the can be activated variable. this way it gets set to true then the next time the player walks through the trigger the mannequin will spawn. if you have it spawn from just walking through the trigger twice you may not get a good effect. the player might walk through it then immediately turn around and walk through again. Thinking aback on classic horror games youd go down a hall and enter a room but its when you go to leave that something happens. or its after you progress the story in that room or collect a certain item. thats where the bit in the level blueprint comes in. in the lower half of the picture the first comment section is where you would have the logic that upon being run your saying ok the next time the player passes through the trigger ill spawn the mannequin. thats the logic that allows the triggerBP to be triggered.

Now im not sure what you meant when you said you tried to drag it in, did you mean the mannequin? to spawn in the mannequin you could either use a spawnactor or you could just have the mannequin as part of the trigger bp and set it to hidden in game until the trigger is overlapped then toggle its hidden in game. of course you could just do all of this in the level blueprint and reference each item.

Lastly you references the nox timre game, im not familiar with it so i cant help to be like that one.

i made a actor blueprint and added a box collision in it but in the event graph i tried to drag my manniquin into the blueprint event but it doesnt work, again im very new so everything your saying is confusing to me is there any chance you could make a quick setup like this and send pictures ( i know you did before but i dont know how to add the manniquin

it all comes down to how you want the mannequin to show up . you can either spawn an actor that contains the mannequin, have the mannequin as part of the triggerBP, or have the mannequin placed in your level and hidden until the trigger is fired.

The first method is to spawn in a actor that contains the mannequin. this method is pretty easy and relatively straight forward with good adaptability. essentially you do as shown in the picture and add a spawn actor of class node. for this to work your mannequin needs to be a separate actor. you will also need to specify the location (to get the node to look as it does in the picture right click where it says spawn transform and select split struct pin)/

The next method is to have the mannequin as a static mesh thats part of your triggerBP. to do this; within your triggerbp go to the components section at the top left and click add component. search for static mesh and click it. then with static mesh selected go to the details panel on the right and look for the static mesh section and select your mannequin from the drop down. while your in the details panel also go to the collision section and set collision preset to no collision, and go to the rendering section and tick hidden in game.
now to setup the event graph. go to the components section on the left and drag in the static mesh you created earlier this will create a reference to it in the graph. drag off this reference and type set hidden in game, you want the new hidden box to unchecked. drag off the static mesh reference again and search for set collision enabled, on this node you want the new type to be set to collision enabled. now connect the nodes as seen in the following picture.

The last method is similar to the previous one but it is completed entirely in the level blueprint instead of a separate actor. the main difference here is that the trigger box is one just dragged in from the modes panel into the level and the mannequin similarly is dragged directly into the level from the content browser. as in the previous example your going to want to set the collision and hidden in game. Then just set it up like in the picture. Be aware that in the picture i show a gate but i was just testing this as a simple method to accomplish revealing the mannequin on a second begin overlap as simple as possible.

works great just one more question how do you make it disappear at some point, like with a trigger or something

you could set a delay then destroy actor or you could re-set hidden in game theres a lot of ways to do it.

How do you reset hidden in game after you have moved location e.g you steped on the trigger and he appears in front and then when you go to the next room he disappears?

you could use a delay node or you could use the event on endoverlap or a combination of both. so you could on end overlap to a delay of like 5 sec then set hidden in game.

could i make 2 box collisions in the blueprint and then set one of them in a different place so that when you enter the first one he appears and then when he hits the next one he disappears?.

yup you could do that

dont i have to make a new variable everytime i make another trigger box blueprint because if i used the same one twice activating the variable would activate all of them around the game

no all the variables used have been within the triggerbp so they would only affect the instance of the blueprint they are in. you would however need to repeat the step in the level blueprint for each one because that one references the instance of the blueprint in the level.

aww ye so when i set the trigger active in the level blueprint i just set the target as the triggerboxBP im using?

yea pretty much