Yes Willing to test !
A big shout out to @dromo for the C++ code (Character Selection - Lyra Starter Game - #16 by dromo).
After editing that code in VS, here is the Blueprint part coping with Replication:
Keep in mind there are two variables type linear color, one is not replicated and the other if repnotify. I need volunteers to test it out in a packaged game. Another big thanks to @AL626 for the help.
Results:
Excellent work! will try this out later on tonight with characters! props to @dromo .
Have a great weekend, guys. Cheers.
in the blueprints I only see the rep notify variable other than the one you have in inputs for the custom events?
Yes, there is only one variable using Repnotify. Is that what you mean? The linear color at the bottom right corner.
Ok Verifying that it worked on packaged game! one thing though it worked for me only by removing the check if is locally controlled other wise same issue not sure why but it worked after removing the check, also testing in editor if you respawn clients load host settings ! but good job it worked!
Thanks for testing it out. I’ll test your notes out and update the blueprint here. Overall, I am glad it worked out in the end. Thank you for the help and good luck in your projects.
I noticed this approach creates a problem with Feminine animation BP, which is associated with Pick Random Character (Quinn). I can’t find a way to change the walking style after event possess. Setting the Static Gameplay Tag is not runtime-accessible, is editor only.
Therefore, the only way to assign feminine tag is via Pick Random Character, which should pick the selected character option from there. Unless I find something easier to execute after begin play.
This code is working! I’ve implemented this logic following your video with the metahumans character selection and it works in a packaged build. I’ll provide the code here tomorrow. the rep notify variable in multicast really comes in handy i used the the PawnCosmeticComponet within the repnotified variable and used addCharacterparts from there. it is tricky because i did have some crashes that way in the editor, in B_PickRandomCharacter i assigned the Tinplate without sphere and removed the manequine assigned to the skeletal mesh and assigned the actor class from the local settings. i’ll give snippets and try to make a video to demonstrate.
Glad it worked. Thank you for this update. Looking forward to seeing your code. Now I noticed the difference. There are two functions ‘Add Character Parts’, one to be called by the controller and other one by the pawn owner using the Pawn Cosmetics Component. Not surprised by how Lyra is modular and flexible. It’s built with the best coding practices from two great games. Thanks.
Many thanks, that clarifies the Pick Random Character issue. I have a few notes to share:
-
Character Screen: it seems that it will always read standalone, not sure if that branch is either necessary or checking the correct condition.
-
Pick random character. The branch for players can be disregarded, because adding an empty Tinplate will have no effect after all. Also, the select node seems to be redundant, considering you are using random array element.
-
Hero shooter: I found good results using Pawn Cosmetic component + Add character parts after Possess Event, and I am glad to see it is working on your end in a packaged project. What I noticed is the issue of having a character with Feminine Movement. I did a quick test, and the correct way to fix it is to move the node ‘Link Anim Class Layers’ from Construction script and assign it with a select node for the ‘in class’ input, being either ABP_UnarmedAnimLayers_feminine or ABP_UnarmedAnimLayers, depending on the selected character. After that make sure to move ‘Add Initial Inventory’ right after it. I am not totally sure, but it might be necessary to repeat this logic for the repnotify function. For multiple character options, it is better to use either a map variable or a data table that will link character classes and initial anim BP.
-
From this single character variable, you can build up your character classes with appearance, initial weapons and abilities.
We did a very good progress. Thank you again for the help.
Hey good point on the feminine anim layer approach , I want to share here what worked for me as to how to check those conditions. what I did was go to every metahuman BP_Class and reparented it to “Lyra Tagged actor” because it has a “Static Gamplay Tags” assigned to it, and if my character is female , I assigned the appropriate tag like “Cosmetic.AnimationStyle.Femenine” and “Cosmeic.BodyStyle.Medium” Then on Hero shooter i applied the following conditions -From mesh component i check “Has Matching Gameplay Tag”
Yes, that is the correct approach. Well done. To simplify your code, you don’t need the branch. Get the first ‘has matching tag’ bool output, connect it to a select node. The output is then connected to the ‘in Class’ input. That will create two options, add the unarmed feminine layer (true) and unarmed layer (false).
This is all so handy to see, great work guys. Anyone have any ideas how I can access which team the player controller is on? I’m trying create a new component in my Experience Definition that sets the character based on team. I’ve got it set up to change based on a random integer just fine, however I can’t get the Team ID from the Lyra Team Subsystem - only an array of the Team IDs available. Also when I try to use the Find Team from Actor node, it always returns a TeamID of -1 for both teams. Any help would be appreciated
Hi there, yes, we’ve made a great progress on this topic. Glad it helps you as well. Here is the logic flow: The team ID is generated after a function called “Listen for Team”, that runs after “begin play” inside B_Hero Shooter Mannequin. This function calls an async action node “Observer Team Colors”. Keep in mind, the team ID can change during a match due to the respawning logic, so you may need to refer to On Character Parts Changed, which is called from Pawn Cosmetic Component.
Hope that helps.
Awesome, thanks mate, that worked like a charm. I ended up using some of the above code, being driven by a TeamID (int) that I assign immediately after the character is possessed (B_Hero_ShooterMannequin).
As my gameplay won’t involve respawning at this stage, it seems to be working fine.
Lyra seems great, but I just wish there was more documentation or information around on how to practically get in and change gameplay features.
I’m currently trying to assign different ability sets to each team. From what I can see, you are supposed to assign ability sets to the Default Pawn Data - however in this (and I assume most) cases, both teams derive from the same Base Pawn Class, using different character parts added to the cosmetics. Does anyone have any idea how to go about this?
Hi there, it seems correct, make sure to always quick test your replication code in a packaged project. For adding abilities, I’d use the function Give ability. I haven’t implemented in my project yet, but it should get it done. This same logic also works for initial weapons.
Legend, that looks like the one I need. I did a janky work around by checking TeamID at the start of each ability, and using a branch to choose different code based on team, but I knew I’d be running into issues later down the line. Thankyou very much for all your help mate