Interaction on doors

I'm creating new doors with new animations How do I interact like with vanilla doors? I activated M Is Usable checkbox, but I don't know how to change the wording. ?
No description
No description
96 Replies
Rex
Rex2mo ago
Why can't you use the base class of vanilla doors?
Jean Michel
Jean MichelOP2mo ago
Because my animations are different
Robb
Robb2mo ago
I don't remember offhand, but check this mod's source, it does it https://github.com/budak7273/GameShow/
GitHub
GitHub - budak7273/GameShow: Satisfactory mod for Satisfactory Even...
Satisfactory mod for Satisfactory Events group. Contribute to budak7273/GameShow development by creating an account on GitHub.
Robb
Robb2mo ago
although idk what the syntax is to get the formatted keybind thingy
Jean Michel
Jean MichelOP2mo ago
Thanks, but when I load it into the project, I only have C++, nothing in blueprint
D4rk
D4rk2mo ago
I think all you have to do is override GetLookAtDescription and return your text based on the mode enum of the door.
No description
Robb
Robb2mo ago
that sounds right mod content folders are named after their friendly name and that mod's friendly name is not GameShow
"FriendlyName": "Event Utilities",
"FriendlyName": "Event Utilities",
otherwise make sure you followed these steps https://docs.ficsit.app/satisfactory-modding/latest/Development/BeginnersGuide/ImportingAnotherMod.html
Rex
Rex2mo ago
Ah yes, that function name has a typo: "Get Look at Decription"
Jean Michel
Jean MichelOP2mo ago
Thanks! It works All that's left is to manage the change
No description
No description
D4rk
D4rk2mo ago
Cool, you can do something like this to get the bound interact key, and switch the text on the door mode.
No description
Robb
Robb2mo ago
oh sweet so that's what it is
D4rk
D4rk2mo ago
You will need to format all that text together of course
Robb
Robb2mo ago
do you know the rich text format code to get the orange box?
D4rk
D4rk2mo ago
nope
Rex
Rex2mo ago
Isn't there a function to do enum to string, and another function to get the next value of an enum in a sequence (looping back to 1st)?
Robb
Robb2mo ago
you could use a Select node and then pick your strings carefully to the same effect and the right thing would be enum to text (localizable), idk if enums have anything Text by default
D4rk
D4rk2mo ago
There is definitely a ToString function for every enum. I don't know about auto increment though, I don't thinkt here is anything like that for BP. I always do manually.
Jean Michel
Jean MichelOP2mo ago
Cool, that's a good start.
Jean Michel
Jean MichelOP2mo ago
What's the point? It works without
No description
Robb
Robb2mo ago
the point of which part?
Jean Michel
Jean MichelOP2mo ago
Get ctrl + Get key
Robb
Robb2mo ago
people can rebind interact to not 'E'
D4rk
D4rk2mo ago
If you wanted it to say "Press E to switch door mode", you can hard code the E or use those functions to get the key name bound to the input action, which is better
Jean Michel
Jean MichelOP2mo ago
By default, the 'E' key is the activator, right?
D4rk
D4rk2mo ago
yes, but it might not be for everyone
Robb
Robb2mo ago
and it isn't the default for controllers
Jean Michel
Jean MichelOP2mo ago
Oh... And then ? How to ?
Rex
Rex2mo ago
Actually, the function to get the next enum value is probably also needed to update the door state
Robb
Robb2mo ago
How to ? what? put them together? Format Text
D4rk
D4rk2mo ago
But that is done OnUse, not OnLookAt.
Robb
Robb2mo ago
not "needed", a switch or select can be used, but convenient
Rex
Rex2mo ago
I know
Jean Michel
Jean MichelOP2mo ago
No how to assigne a key or ???
Rex
Rex2mo ago
Point is, same logic can be used for both functions
Robb
Robb2mo ago
in the base game's key binding menus
Rex
Rex2mo ago
I found something like this, but it's probably overkill for 3 states (you do not need the "PreviousOption" event)
No description
Jean Michel
Jean MichelOP2mo ago
Ah yes, so you have to retrieve the assigned letter, or the button.
Rex
Rex2mo ago
Also says to clear the array before initialising it, otherwise you get repeated elements
Jean Michel
Jean MichelOP2mo ago
Isn't it simpler to update the 'Door State' variable?
Rex
Rex2mo ago
How do you currently update it?
Jean Michel
Jean MichelOP2mo ago
After that
No description
D4rk
D4rk2mo ago
Multigate also works
No description
Rex
Rex2mo ago
One sec
Rex
Rex2mo ago
This kind of thing should work (function can probably be pure as well)
No description
Rex
Rex2mo ago
Idea being you can use this function in the Get Look at Decription function as well as the On Use event
Jean Michel
Jean MichelOP2mo ago
👍🏽
Rex
Rex2mo ago
That's what I found in the string tables so far
No description
Rex
Rex2mo ago
But I'm not sure how it actually works
Robb
Robb2mo ago
the element displaying the rich text defines the styling
Rex
Rex2mo ago
Sounds plausible I would suggest using the string tables if possible because this way you don't need to do translations for that
Jean Michel
Jean MichelOP2mo ago
IA_Use doesn't seem to be the right key
No description
No description
No description
Jean Michel
Jean MichelOP2mo ago
But that's the correct syntax.
No description
No description
D4rk
D4rk2mo ago
Oops, you're right. It should be the action name defined in the mapping context, not input name. In this case it should be PlayerActions_Use
D4rk
D4rk2mo ago
No description
Jean Michel
Jean MichelOP2mo ago
Thanks, that's good, but not the format.
D4rk
D4rk2mo ago
what format?
Jean Michel
Jean MichelOP2mo ago
No description
Jean Michel
Jean MichelOP2mo ago
OOPs wait...
Jean Michel
Jean MichelOP2mo ago
My mistake, sorry
No description
D4rk
D4rk2mo ago
looks good, ship it
Jean Michel
Jean MichelOP2mo ago
Wait, I still have a lot to do before I publish it.
Robb
Robb2mo ago
looks good?
No description
D4rk
D4rk2mo ago
looks good, ship it
Jean Michel
Jean MichelOP2mo ago
Where does this information come from? (and mapping)
Robb
Robb2mo ago
Enhanced Input System :: Satisfactory Modding Documentation
This page is a work in progress. Unreal Engine 5 introduces the Enhanced Input System which assits games in handling user input. Satis...
D4rk
D4rk2mo ago
The screenshot i posted is from the MC_PlayerActions asset in the project.
Jean Michel
Jean MichelOP2mo ago
It works, if you have a simpler solution, I'm interested. Thank you all for your advice.
No description
No description
No description
Rex
Rex2mo ago
Get Player Character will only work with the first player Try doing a Get Owner on the component and then try casting to FGCharacterPlayer Oh wait, you don't need Get Owner because you have the Other Actor pin What do the Open Door and Close Door functions do? I'm working on some suggestions, but I need to have lunch now
Jean Michel
Jean MichelOP2mo ago
Animations and sounds And then? What I suppose to do, to change?
Rex
Rex2mo ago
Can I see the graphs please?
Try doing a Get Owner on the component and then try casting to FGCharacterPlayer Oh wait, you don't need Get Owner because you have the Other Actor pin
You can simply cast to FGPlayerCharacter to check if the overlap was due to a player
Jean Michel
Jean MichelOP2mo ago
For simple doors, I simply use Timelines. Later, when I'm older, I'll use animations sequence, for complex doors.
No description
No description
No description
Rex
Rex2mo ago
Okay, thank you. Then I should probably be careful not to call "Open Door" or "Close Door" twice in a row because that could mess up the anims (it's easy to do, especially given how I've chosen to do it)
Jean Michel
Jean MichelOP2mo ago
Like this?
No description
Rex
Rex2mo ago
No Hold on, I have finished doing the graphs
Rex
Rex2mo ago
@Jean Michel This is how I would do it. I made the "On Component Begin/End Overlap" logic (4th picture) detect players by trying to cast the actor to FGCharacterPlayer (if the cast succeeds, we have a player). Also, since multiple people can be using the doors at the same time in MP, I decided to make the door close (in auto mode) only if there are no players in the zone. This way, if 2 players go through a door one after the other in quick succession, the door shouldn't close on the 2nd player's face. Also, I made this UpdateDoorState function (2nd picture) which checks if the door should be open (based on the current door mode, saved into the WantedOpen local variable), and compares it to the actual door-open state. If these two values do not match, then it opens/closes the door as needed. It greatly simplifies updating the door: simply update variables as needed and then call the function. I also introduced a GetNextMode function (1st picture) which simply returns the next mode (used by both the GetLookAtDecription function and the OnUse event). The node I used is a Select node, you can get it by dragging from the enum variable get node. To be able to set the values inside the select node, connect the output to the return node (otherwise you get a gray wildcard pin). Also, this function needs to be Pure and Const (see arrowhands, in red). And finally, I decided to update GetLookAtDecription (3rd picture) to do something closer to what base game doors do. The advantage of this is that I am reusing the texts from the Buildables_UI string table (5th picture) in the Select node (temporarily connect the output to a Text input to set the values for each case) and the Format Text node ([{PlayerActions_Use}] is hardcoded), which means the messages for your doors will be translated (as long as base game has translations). I think I didn't forget anything. Please let me know if you get stuck or would like some clarification.
No description
No description
No description
No description
No description
Rex
Rex2mo ago
cc @D4rk looks like base game uses this Format String with Input Action Names node in FGPlayerController to format keys into strings And I think I forgot to disable localisation on that one (it doesn't need to be localised)
Jean Michel
Jean MichelOP2mo ago
Waou, thanks, I'll try it
D4rk
D4rk2mo ago
Cool, I didn't know that existed. I have been ignoring the localization stuff for years. 😅 What you posted looks good, but probably wont work in MP. The mode enum should replicate and the OnUse exec chain should probably be going through an RCO before calling any functions or setting vars.
Rex
Rex2mo ago
Good catch! Though the original implementation also had the same problem I think the RCO is simple, only the door mode needs to go through it That being said, does OnUse get called on client, server or both?
D4rk
D4rk2mo ago
Only using client I think
Rex
Rex2mo ago
Okay, then it is a problem indeed
D4rk
D4rk2mo ago
On my doors, the OnUse opens an interact UI that calls RCO events, but in this case I think the OnUse should call the RCO events directly.
Rex
Rex2mo ago
Yeah ExampleMod has RCO examples
Jean Michel
Jean MichelOP2mo ago
So what do I do?
Rex
Rex2mo ago
You need to make OnUse call a RCO And you have to move the current code for OnUse into a different function, which gets called by the RCO BTW, as to why using player controller index 0 was a problem: https://docs.ficsit.app/satisfactory-modding/latest/Development/Satisfactory/Multiplayer.html#_avoid_using_player_controller_index_0 If you read the next section too, you'll see something about RCO And https://docs.ficsit.app/satisfactory-modding/latest/Development/Satisfactory/Multiplayer.html#RCOs explains how to use a RCO
Jean Michel
Jean MichelOP2mo ago
Well well well...
Robb
Robb2mo ago
so a third horse enters the race... do you know what the difference is between these 3? from what we have written down they seem to offer similar things - Get Input Action Name as Text - Get Key Name For Action Simple - Format String with Input Action Names https://docs-dev.ficsit.app/satisfactory-modding/latest/Development/Satisfactory/EnhancedInputSystem.html#_displaying_information_about_input_actions this is more of a syle thing than a code thing, but I am not sure your door will open fast enough if the player is moving quickly (ex. sprinting with blade runners), how does it compare to the vanilla doors in total time to open?
Jean Michel
Jean MichelOP2mo ago
It takes 1.6 sec because first there is the rotation of the lock
Jean Michel
Jean MichelOP2mo ago
This one opens in 1 second
No description
Jean Michel
Jean MichelOP2mo ago
But I have another one that will take at least 5 seconds because it is wider (8m)
Rex
Rex2mo ago
I don't know about them, I just disassembled the blueprint of the vanilla doors and used that. My goal was to reuse the localised strings. Well, I can tell you the 3rd one does some formatting, whereas the 1st one does not. I can't find Get Key Name For Action Simple, but I see this is deprecated
/** Returns readable name for an action */
UFUNCTION( BlueprintPure, Category = "FactoryGame|Input", meta = ( DeprecatedFunction, DeprecationMessage = "Use FGInpuLibrary::FormatStringWithInputActionNames or FGInpuLibrary::GetInputActionNameAsText" ) )
FText GetKeyNameForAction( FName inAction, bool getGamepadKey );
/** Returns readable name for an action */
UFUNCTION( BlueprintPure, Category = "FactoryGame|Input", meta = ( DeprecatedFunction, DeprecationMessage = "Use FGInpuLibrary::FormatStringWithInputActionNames or FGInpuLibrary::GetInputActionNameAsText" ) )
FText GetKeyNameForAction( FName inAction, bool getGamepadKey );
Edit: looking at FGInpuLibrary::GetInputActionNameAsText and FGInpuLibrary::FormatStringWithInputActionNames in the decompiler, they seem to be quite similar in their workings (they both call UFGPlayerInput::GetCurrentMappingForAction and either FKey::GetDisplayName or UFGInputLibrary::GetAbbreviatedKeyName afterwards) Workaround: make the door have no collision unless it is set to Always Closed :wonke:
Jean Michel
Jean MichelOP2mo ago
Why not, good idea
Rex
Rex2mo ago
The door might be slow to open, sure. But that doesn't get in the way of Efficiency™ :ficsitlogo:
Jean Michel
Jean MichelOP2mo ago
Well, see you tomorrow Have a good night
Rex
Rex2mo ago
TL;DR one also does FText formatting for you (which can be useful) I don't know why both exist though Arch might know, perhaps?

Did you find this page helpful?