Help with exception when cycling Player Character Equipment

Hey all! I was getting help in a thread that I wrongly create in the bp channel. I will repost here as I think is better for visibility. I was getting some help from @D4rk already (thank you very much by the way). So here is what I'm trying to do: When I press F1, I want the game to change the player hand equipment. I want to do bindings for all the available hand slots (but for now, just F1). Here is my repository if you want to download and take a look in the whole project (4 BPs): https://github.com/pvm/EquipmentKeyBindings In the image is the the code that gets executed when I press F1 and also I will add the exception log as well. I'm really new to modding, I'm not sure what is wrong with the logic. @D4rk if you can take a look please, I would be very grateful!
Solution:
I managed to change the active equipment with the key binding shortcut key
Jump to solution
28 Replies
D4rk
D4rk•3mo ago
Where are you running this code? Also, the "Triggered" exec on the input action fires per tick as long as the key is pressed, you should be using "Started" or Completed"
Vanzin
VanzinOP•3mo ago
It's in the Sub System Nice catch, I wanted to put in the Started but I missed that, thanks!
D4rk
D4rk•3mo ago
How or when are you adding your InputMappingContext? This crash is from the EnhancedInput system, is not happy about something
Vanzin
VanzinOP•3mo ago
I enabled it here in the Sub System And then I just set it like this. Just did exactly like it's in the Example Mod (Unless I missed something)
No description
No description
D4rk
D4rk•3mo ago
Discoconnect all the logic from the input action and log the fire event. make sure you can trigger it without crashing before you try to do anything with the equipment
Vanzin
VanzinOP•3mo ago
I did that already and it works fine
Vanzin
VanzinOP•3mo ago
No description
D4rk
D4rk•3mo ago
What is that MultiCycleEquipment node? Where is that from? The target says Equipment, but you're feeding it a FGInventoryComponentEquipment object. That might be whats causing the crash
Vanzin
VanzinOP•3mo ago
I think I understand my mistake, give me a moment, let me try something
Vanzin
VanzinOP•3mo ago
No description
Vanzin
VanzinOP•3mo ago
So I used a function from another mod 😦
D4rk
D4rk•3mo ago
I'm not great at cpp, but it looks like it can possibly call Equipment->CycleEquipment( -1 ), which i don't think is valid Maybe dont use that function lol
Rex
Rex•3mo ago
Very useful comment
/** Loop de loop */
void CycleEquipment( int32 dir );
/** Loop de loop */
void CycleEquipment( int32 dir );
dir is added to mActiveEquipmentIndex so it can be negative. Code handles negative numbers by using the last element of the array
Vanzin
VanzinOP•3mo ago
I didn't realised that was from another mod until you mentioned about it and I double checked. So I stopped using, but I could not find a way to call Equipment CycleEquipment trough the BPs
Rex
Rex•3mo ago
You need a Blueprint Function Library
Vanzin
VanzinOP•3mo ago
Well, at least I know how to build a C++ mod now
Rex
Rex•3mo ago
Yeah, it's not that hard
Vanzin
VanzinOP•3mo ago
But I will try this out as well
Rex
Rex•3mo ago
This other mod seems to be using a blueprint function library
Vanzin
VanzinOP•3mo ago
I didn't understand properly, now that I have the C++ class in my project, do I need to build it other than run the Alpakit to make the node available in Unreal?
AngryBeaver
AngryBeaver•3mo ago
because you added the C++ through Unreal it should of done everything needed. you'll only need to compile it when you change the C++
Vanzin
VanzinOP•3mo ago
The whole engine? because I changed the C++ code
AngryBeaver
AngryBeaver•3mo ago
hit "Build" not "Rebuild" and never hit "clean" then the compiler should specifically only recompile the things that need it due to the changes and to be clear hitting the others wont cause errors. just waste a lot of your time
Vanzin
VanzinOP•3mo ago
Yeah, that was pretty fast, thanks: Build completed at 3:46 AM and took 34.323 seconds It worked!
Solution
Vanzin
Vanzin•3mo ago
I managed to change the active equipment with the key binding shortcut key
Vanzin
VanzinOP•3mo ago
Thank you very much @AngryBeaver (FE, CC+) @Rex @D4rk! Soon I will post the mod in the website
Rex
Rex•3mo ago
Looks like we're in the same timezone 😄
Vanzin
VanzinOP•3mo ago
Here you go if you want to take a look/try it out: https://ficsit.app/mod/EquipmentKeyBindings Thank you very much again @Rex [they/them] @AngryBeaver (FE, CC+) @D4rk!
Equipment Key Bindings - SMR
Allows you to bind hand equipments to specific keys in your keyboard!
Want results from more Discord servers?
Add your server