Spaghetti
- Exposure: public
- UE Version: 4.21
ctrl + v
1 comment
-
Hi again, I made a comment on your previous spaghetti code :D https://blueprintue.com/blueprint/74bd1diw/#comment-354
You can take the nodes that check if the weapon has certain attachments and make a function out of it. Also like in the previous spaghetti code, you can make a function out of getting a name from the class defaults.
But if you are up to sorting out your code so that it does checks for attachment and then sets the string, then continuing to the next attachment. You can make a function called "Find Attachment Name" that accepts: -class, -bool reference (has attachment bool) -string reference And returns an execution node (the white arrow)
there is a tick box for accepting a reference in the function variable settings; when using references, functions don't make a copy of the input variables
Inside the function you: -check if class is valid and set the bool reference to it -do a branch based on the bool reference -if the branch is FALSE just return out of the function -if the branch is TRUE -set the string reference to the name from the default class (the same way you do it currently)
After doing this, your "Set details 2" function will look cleaner and you can easily find how you are setting the variables for your weapon attachments by looking at the "Find Attachment Name" function.
Hope this is useful :)
Fipa
August 11, 2019, 12:43 pm