Download

Enabling manually programmed features

I’m working on a project in UE4 where I want the player to be able to switch between different characters, but I want it that the player would have to complete something before being able to switch characters. My idea I have is that there will be different characters scattered throughout the level and I want the player to be able to switch between these characters only after they complete something. Is there any way for me to use a box trigger to make the player “unlock” a new character?

There are many ways to achieve this, depends on your setup.
If you have an object to track/manage objectives you could have those characters linked to an objective/s (or states). On trigger check that the objectives that the character is linked to are complete then allow the change. Or on an objective being achieved trigger an action to unlock the character.

Do you think you could try to help me with it. I’m trying to make a puzzle game where after you complete the puzzle you go into a room after the door opens and in the walkway to that room would be a box trigger which after you walk through the box trigger you would be able to use one of the number keys to switch to a new character.

This a Blueprint or C++ project? Instead of the number keys you could popup a widget with the characters available for selection once you enter the box trigger.
Otherwise you should set a flag on Enter and Exit of the collision, on keypress check the flag and the key pressed then run the relevant function to switch to the character.

Adding to this, if you create an actor that has the box trigger, you can add the character references in this actor, this will simplify looking up the relevant characters to be switched to, each character could have a property with their assigned key.

It’s a blueprint project. Do you think you can give me an example of what you mean?

You can call APlayerController::Possess() to switch between different characters.

To Waves point, here is a blueprint guide to possess with key presses https://docs.unrealengine.com/en-us/Gameplay/HowTo/PossessPawns/Blueprints

I already know how to make it so you can change characters. I’m wondering if you can show me how I can make it so the player can “unlock” new characters. What I mean is I want to have all the characters already programmed to be able to switch to them, but I want to have it so you have to complete something before being able to use the next character.

You can just add Gates before each character selection, and unlock those based on activities completed (BP Gates and BP Custom-Events for each achievement). What kinds of activities… You’ll have to tell us. Find examples from other games or go through the Community-Tools section to find sample projects (see @Stormrage256 examples) .

Basically if you want the Trigger-Box / Collision-Volume to only activate after past achievements, add closed Gate nodes after the Overlap-Event of each, and then unlock those via Custom-Events as the player progresses. Overall, its best if you go through sample projects first, as you’ll see its simpler and more obvious than just talking about it here…