Large useful blueprint function library (Morepork Games)

This is GOLD. Thanks for that!!!

For me it’s not just warnings, but actual blueprint compile errors:
http://imgur.com/a/pRxRF

Tried with UE 4.16 & 4.12, same result.

Yea, the warnings I was talking about are gone (Epic fixed in 4.15), but the errors you are encountering are the “can’t find macro reference” things mentioned earlier in the thread.

This is probably going to happen every time it’s dropped into a new project, so next time I do an update I will probably not use any of my own macros in the function library (i.e. I’ll just expand them out into nodes). I do plan on updating at some stage - I’ve added quite a few more and am working on 4.16, it’s just a matter of finding the time, as usual.

For now, for anyone who gets the errors, it’s very easy to fix yourself - simply place new versions of the macro node and re-hook it up, then delete the old node… until there are no compile errors left, then save the function package.

EDIT: Actually it’s not that easy because the name of the macro isn’t there. Fine, I will do an update :stuck_out_tongue:

Updated with 44 new nodes on 4.16!

BIG UPDATE!

44 new useful nodes (and a bunch of the originals have been updated, a handful removed, sorry for any inconvenience). No pretty pictures this time because it already took me all day to re-create some from other projects, clean it up and gather all the descriptions etc.

I’ve highlighted a few that I’ve used quite a lot recently.

Added:

  • Branch To Bool - Converts two execution branches to a bool
  • ClampColor - Clamps a color (per element)
  • ClampRotatorPerElement - Clamps each element of a Vector individually between a minimum and maximum.
  • Convert_RGB_to_HSL - Outputs HSL/HSV (Hue, Saturation, Luminance) values for the given color. Hue output is in degrees 0-360.
  • CycleInt - Increments an int if it is still below max, else it will reset it to min
  • Delay While - Delays as long as the condition is true. Useful where you’re not sure how long to delay because of random startup timing
  • DesaturateColor - Can be used to saturate or desaturate a color. Negative values saturate while positive values desaturate - An amount of 0 will leave the color unchanged.
  • FindTagInActors - Returns all actors in the given array that have the given actor tag.
  • ForEach Material - Does a loop for each material present on the given primitive. Useful for e.g. creating a dynamic instance of all materials on a mesh.
  • ForEachLoop Wait - Same as a regular ForEachLoop, except it will only execute each loop when triggered. Good for when you want to do latent actions in the loop body e.g. stream levels
  • ForLoopWait - Same as a regular ForLoop, except it will only execute each loop when triggered. Good for when you want to do latent actions in the loop body e.g. stream levels
  • Frame Delay - Delays for a certain number of frames.
  • Get Random Element (Copy) - Simple version of Get Random Element for arrays
  • Get Random Element (Ref) - Simple version of Get Random Element for arrays
  • Get_ALL_WidgetChildren - Gets all the child widgets of the given widget (recursively i.e. including children of children).
  • GetAllActorsRenderable - Slightly presumptuous function that gets all actors that have a mesh or particle system component in them. Could be added to.
  • GetDistFromScreenCenter - Returns a 0 to 1 value representing the player’s distance from the center of the screen (0 is exact center, 1 is edge of screen)
  • GetWidgetChildren - Gets all the DIRECT child widgets of the given widget.
  • IntToChar - Converts a 0-255 value to it’s ASCII character equivalent
  • Is Empty - Branches depending on whether the array is empty or not
  • LocalVariable_(String) - Just allows storing of a “local” variable in the event graph or in a macro, so you can compute something once and use it several times without fear of it changing.
  • LocalVariable_(Transform) - Just allows storing of a “local” variable in the event graph or in a macro, so you can compute something once and use it several times without fear of it changing.
  • LocationIsWithinVolume - Returns whether the given location is inside a volume of the given class. NOTE: Will not work if the volume isn’t of the “WorldDynamic” object type.
  • Max_(Vector) - Returns the maximum value of A and B (the return value is calculated per element, NOT on vector length i.e. Max(A.X,B.X), Max(A.Y,B.Y), Max(A.Z,B.Z) )
  • MaxOfByteArray_(Impure) - Returns the maximum value of a byte array, and the value’s index
  • MaxOrMinOfStringArray - Finds the or min of a string array (alphabetically) - this is fairly presumptuous and limited, but it’s enough to sort a list of strings (e.g. server or player names) in a rudimentary fashion that 99% of people would accept.
  • Min_(Vector) - Returns the minimum value of A and B (the return value is calculated per element, NOT on vector length i.e. Min(A.X,B.X), Min(A.Y,B.Y), Min(A.Z,B.Z) )
  • More Than X Players - Whether there are more than the given amount of players currently connected.
  • NameCompare - Compares two names
  • Random Int (No Repeat) - Gives a brand new value in the given range each time i.e. no repeats until all values are used or the macro is reset manually
  • RandomColorInRange - Returns a random color within the given range. It simply picks a value for each individual element.
  • RandomRotatorInRange - Generate a random rotation between min and max
  • RandomString - Generates a random string of ASCII characters, of the given length. If ValidChars is empty, then all chars are valid (from 32-127 only).
  • RandomVectorInRange - Generate a random vector between min and max (works per component, good for e.g. random scale)
  • RemoveAllPlayerWidgets - Removes ALL current user widgets
  • Set Level Visibility - Sets the visibility of a streaming level
  • SetMaterialQualityLevel - Sets r.MaterialQualityLevel at runtime. 0 = Low, 1 = High, 2 = Medium
  • SetScreenResolution - Sets the screen resolution (via console command). If Resolution is empty then it will just set the fullscreen mode.
  • SetVsyncEnabled - Sets vsync enabled or not, along with frames per second (via console command)
  • SnapRotatorToDegrees - Snaps a rotator to a certain amount of degrees, on all axis. Only supports whole numbers.
  • SortStringArray - Sorts a string array alphabetically or reverse-alphabetically. The “Order” output is an array of the original indices in the new order (you can use it to e.g. make another array match the new order of the one you just sorted)
  • Stream Level If Valid - Stream levels in and out with automatic validity checking
  • StripChars - Strips the given chars from the given string. If “Except” is ticked, then it strips everything BUT the given chars.
  • Wait Gate - Will fire the “Condition Met” output once the input has been fired the amount of times specified by “Condition”. If “Once Only” is checked, then successive fires are ignored. Unnamed output pin fires regardless.

Updated: (others were updated too for performance etc but these have added functionality)

  • SortFloatArray - Sorts an array by value. The “Order” output is an array of the original indices in the new order (you can use it to e.g. make another array match the new order of the one you just sorted)
  • SortIntArray - Sorts an array by value. The “Order” output is an array of the original indices in the new order (you can use it to e.g. make another array match the new order of the one you just sorted)

Removed:

  • AppendAndSetString - Annoyingly appears before the common “Append” node when typing
  • GetAllActorsWithTag - There is an official epic one now
  • GetLocalPlayerController_(Client) - Unnecessary (GetPlayerController(0) does the same thing
  • GetPlayerStateByPlayerIndex - Misleading
  • MaxOfFloatArray_(Impure) - Slower than the built-in node
  • MaxOfIntArray_(Impure) - Slower than the built-in node
  • MinOfFloatArray_(Impure) - Slower than the built-in node
  • MinOfIntArray_(Impure) - Slower than the built-in node
  • Set Array Element - The official epic one got fixed

DOWNLOAD

Woops forgot a couple of other new ones:

  • DesaturateColor - Can be used to saturate or desaturate a color. Negative values saturate while positive values desaturate - An amount of 0 will leave the color unchanged.
  • Convert_RGB_to_HSL - Outputs HSL/HSV (Hue, Saturation, Luminance) values for the given color. Hue output is in degrees 0-360. I haven’t actually tested this… just made it from internet math.

This is absolutely awesome.
Thank you for sharing this.

First off, Thank you!
In a 16.1 project, I’ve opened and saved MoreporkMacrosActor and MoreporkMacros, yet I still get a compile errors here:

Get All Actors Renderable
Location is within Volume


Thanks for the pics - I’ll replace those with collapsed nodes, but I won’t be at a PC for a while - in the mean time if you’d like to fix it yourself you can place new versions of those macros - the first one is the “Is Empty” macro and the second is the “Compare Class” Macro. Then recompile and should be all good

Thanks for the quick fix.

Fantastic work, really cuts down on the clutter.

So I’ve unzipped and copied the .uassets into my content folder, but they’re not showing up in the editor?

I’m using 4.15.3.

This helped me in 4.16

Thank you so much!!!

I just installed 16.2 because I couldn’t find the blueprint actors in the content browser as well, but the problem still remains. I’m not sure why it doesn’t see them. Any ideas?

I think your engine installation may be confused for some reason - try this:

  1. With the editor closed, remove my functions from your project, then delete your Intermediate & Saved folders
  2. Open the editor
  3. Add my functions to your project again - you should see the content browser update after you’ve pasted them in explorer

(you may have to do the macro fixes mentioned above too)

Seems there are more of those dead macros, e.g. in Frame Delay, Fade With Notification.
My understanding is that it is a reference issue between the 4 files?
Could you maybe upload a project where you have the library set up, then we could just migrate the files.

Thanks for the heads up - it’s just macros or functions that have another MPG macro in them… I’ll add those to the list to fix up for next release. Sorry for the delay I’m pretty booked up, and yea maybe uploading a project might be better next time.

If you want to fix them locally in the mean time - just re-place the “ForLoop Wait” macro in the Frame Delay, and re-place them “Fade” macro in the Fade With Nofitication:

Haven’t looked through all of it, I suspect there might be more broken macros. Project upload would be the best solution.

I concur, sample project would be probably most foolproof.
I tried to place it to 4.18 project and got few errors. Then I decidet to read the manual. Made new 4.16.3 project, opened and saved nodes in correct order. Still got errors. Here are the screenshots, hopefully it will help.
Oh, and thank you for this library. Haven’t tried it yet because of the errors but the list of nodes seems super useful. Thanks!

I was able to get it working in a 4.17.2 custom source build. Should pretty much apply to Epic Launcher install as well, for 4.16 and up. Just go back and read the thread, the fixes are there. It’s only 4 pages :wink:

Thanks by the way, always nice to expand the arsenal of tools! You rock @Spoondog !

You are almost correct and I was mostly wrong. I managed to fix 2 of three issues, thanks for pointing it that out. There is still one invalid macro instance shown in the last image I posted (MorePorkUMGfade). Could you please tell me the name of that macro? Thank you.