Download

Large useful blueprint function library (Morepork Games)

http://static1.squarespace.com/static/54eefdade4b036f64dcd67c1/t/577b0b81414fb50acf4c5769/1467681671523

(Updated 2017-06-09)

Hello,

Been far to uninvolved with the community so far, so wanted to share my fairly large and (imo) useful set of Blueprint functions and macros.

They come “as is, where is” - by that I mean: I just made functions when I needed them or found myself doing the same thing a lot. So some may be useful, some may be a bit useless, some are lacking fail-safes, and of course there could be bugs (but I’m using most of them in a game I intend to ship within 3 months, so hopefully not).

I’ve tried to give them all descriptions though, and also categorized them in the same categories they would be in if they were standard Epic functions (though they are all grouped under “MPG” to keep them clearly separate). I’ve also tried to make them as performant as possible.

My personal favourites / ones I use a lot: RandomIntegerByChance, SortFloatArray/SortIntArray, Get Random Element (Array), ForEachLoopReverse, Do N & Notify, Platform Switch, GetDistance, GetFurthestOrClosestLocation, IsObjectOnScreen, GetAllActorsWithTag, V2_Lerp, RoundToMultiple

I will endeavour to update this post if I have a significant update to the library, but don’t expect too much action.

Hope they are useful to some :slight_smile: Please don’t distribute modified versions.


Morepork Blueprint Functions

Author: Cory Spooner (Morepork Games)
Twitter: @TheRealSpoonDog](https://twitter.com/therealspoondog)
Website: www.moreporkgames.com
Last update: 2016-07-05 (UE4.12.4)

These blueprint functions are free to use in any commercial or non-commercial project, but I’d appreciate a mention if you do!

The pack contains 185 functions and macros, within 4 files - MoreporkFunctions, MoreporkMacros, MoreporkMacrosActor (some macros had to be in an actor class to use certain nodes), and MoreporkUMGFade (used by a fade macro).

EDIT: Get latest download 4.22 version here

Download old/original version here](https://www.mediafire.com/?4tfymqbd5wdqlan)

Update 2: (44 new nodes)

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.
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
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 max 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 max frames per second (via console command)
SnapRotatorToDegrees - Snaps a rotator to a certain amount of degrees, on all axis. Only supports whole numbers.
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)
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

Update 1: (18 new functions and 1 macro)

GetCurveFloatValue - Same as “Get Float Value”, except it allows you to specify the curve asset instead of having to assign it to a variable first.
GetCurveVectorValue - Same as “Get Vector Value”, except it allows you to specify the curve asset instead of having to assign it to a variable first.
GetCurveLinearColorValue - Same as “Get Linear Color Value”, except it allows you to specify the curve asset instead of having to assign it to a variable first.
GetCurveTimeRange - Same as “Get Time Range”, except it allows you to specify the curve asset instead of having to assign it to a variable first.
GetCurveValueRange - Same as “Get Value Range”, except it allows you to specify the curve asset instead of having to assign it to a variable first.

RoundFloatDecimals - Rounds a float to the specified number of decimal places e.g. 56.7857 rounded to 2 decimal places would becomes 56.79
Switch Is Server - The “Server” output is fired if the world that the calling object is from is on the host. Otherwise, the client output is fired.
ArrayToString_(String) - Converts an array of values to a string so you can easily print the array to the log.
GetAspectRatio - Gets the current screen aspect ratio (requires small delay after BeginPlay because viewport size has a delay before it is initialized)
GetScreenScale - Gets the scale of the current screen, relative to a base resolution. Useful for UI scaling (requires small delay after BeginPlay because viewport size has a delay before it is initialized)

HasScalarParameter - Returns true if the given Material Instance has a parameter with the specified name.
HasTextureParameter - Returns true if the given Material Instance has a parameter with the specified name.
HasVectorParameter - Returns true if the given Material Instance has a parameter with the specified name.

SelectName - If Pick A is True, A is returned, otherwise B is
SelectParticleSystem - If Pick A is True, A is returned, otherwise B is
SelectSound - If Pick A is True, A is returned, otherwise B is
SelectText - If Pick A is True, A is returned, otherwise B is
SelectVector2D - If Pick A is True, A is returned, otherwise B is

LocalVariable_(Vector2D) - 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.

Full Descriptions: (Split across two posts due to image count limit - lots of nodes are missing from this list because I couldn’t be bothered taking pics of them any more)
[TABLE=“class: grid, align: left, width: 100%”]

GetBoundsCornerLocations

https://moreporkgames.squarespace.com/s/GetBoundsCornerLocations.png

		Returns an array of locations representing the corners of a bounding box (use with Get Bounds).

TraceToGround

https://moreporkgames.squarespace.com/s/TraceToGround.png

		Convenience function to do a typical ground trace. Will start from Actor if one is supplied, else it will start from the given Location.

IsActorOverlapping

https://moreporkgames.squarespace.com/s/IsActorOverlapping.png

		Returns true if the given actor is overlapping any other actors (which you can optionally filter with "Class Filter"), along with the actors it overlapped, if any.

GetLargestPrimitive

https://moreporkgames.squarespace.com/s/GetLargestPrimitive.png

		Returns the largest component from the given actor. If CollidingOnly is True then it will only compare colliding components. Bounds are used to determine the largest.

ComponentHasCollisionType

https://moreporkgames.squarespace.com/s/ComponentHasCollisionType.png

		Returns true if the given primitive component has the given collision type.

GetArrayOf_ObjectTypes

https://moreporkgames.squarespace.com/s/GetArrayOf_ObjectTypes.png

		Returns an array with all of the possible EObjectTypeQuery. Useful if you want to do a trace against all types of things.

SetCollisionEnabledAll

https://moreporkgames.squarespace.com/s/SetCollisionEnabledAll.png

		Sets collision enabled type for all primitive components on the given actor.

IsWithinBounds

https://moreporkgames.squarespace.com/s/IsWithinBounds.png

		Returns true if the object or location is within the given bounds. Unticking "completely" means it only has to be partially within the bounds. If Actor is passed in, it will use that, else it will use the component if one is given, else it will check if the given Location is in the bounds. "Actor Use Colliding Only" means it will only use colliding components on the given actor when checking.

[TABLE=“class: grid, align: left, width: 100%”]

DestroyAllChildComponents

https://moreporkgames.squarespace.com/s/DestroyAllChildComponents.png

		Destroys all child components of the given component.

Component Has Tag

https://moreporkgames.squarespace.com/s/Component-Has-Tag.png

		Fires output depending on if the given component has the given tag or not.

[TABLE=“class: grid, align: left, width: 100%”]

GetFloatParameterValue

https://moreporkgames.squarespace.com/s/GetFloatParameterValue.png

		Gets a parameter value from a particle system. ONLY WORKS IF the parameter was initially added as an INSTANCE PARAMETER (can't just get any parameter from a particle system apparently).

GetVectorParameterValue

https://moreporkgames.squarespace.com/s/GetVectorParameterValue.png

		Gets a parameter value from a particle system. ONLY WORKS IF the parameter was initially added as an INSTANCE PARAMETER (can't just get any parameter from a particle system apparently).

[TABLE=“class: grid, align: left, width: 100%”]

SpawnActorsFromClass_(Multiple)

https://moreporkgames.squarespace.com/s/SpawnActorsFromClass_Multiple.png

		Same as SpawnActor, except you can specify how many you want to spawn at once.

GetCameraTransform

https://moreporkgames.squarespace.com/s/GetCameraTransform.png

		Gets the transform of the player camera. If PlayerIndex is > -1, it will attempt to get camera for the specified Player Index, else it will get the camera for the local player

[TABLE=“class: grid, align: left, width: 100%”]

GetPlayerControllerFromPlayerState

https://moreporkgames.squarespace.com/s/GetPlayerControllerFromPlayerState.png

		Gets the player controller associated with the given player state.

GetPlayerStateByPlayerIndex

https://moreporkgames.squarespace.com/s/GetPlayerStateByPlayerIndex.png

		Gets the player state for a particular player index

GetLocalPlayerController_(Client)

https://moreporkgames.squarespace.com/s/GetLocalPlayerController_Client.png

		Gets the player controller for the local machine.

ForEach PlayerState

https://moreporkgames.squarespace.com/s/ForEach-PlayerState.png

		Executes the loop for each player state in the game.

ForEach PlayerController

https://moreporkgames.squarespace.com/s/ForEach-PlayerController.png

		Executes the loop for each player controller in the game (on the local machine).

[TABLE=“class: grid, align: left, width: 100%”]

GetCurveFloatValue

https://moreporkgames.squarespace.com/s/GetCurveFloatValue.png

		Same as "Get Float Value", except it allows you to specify the curve asset instead of having to assign it to a variable first.

GetCurveVectorValue

https://moreporkgames.squarespace.com/s/GetCurveVectorValue.png

		Same as "Get Vector Value", except it allows you to specify the curve asset instead of having to assign it to a variable first.

GetCurveLinearColorValue

https://moreporkgames.squarespace.com/s/GetCurveLinearColorValue.png

		Same as "Get Linear Color Value", except it allows you to specify the curve asset instead of having to assign it to a variable first.

GetCurveTimeRange

https://moreporkgames.squarespace.com/s/GetCurveTimeRange.png

		Same as "Get Time Range", except it allows you to specify the curve asset instead of having to assign it to a variable first.

GetCurveValueRange

https://moreporkgames.squarespace.com/s/GetCurveValueRange.png

		Same as "Get Value Range", except it allows you to specify the curve asset instead of having to assign it to a variable first.

[TABLE=“class: grid, align: left, width: 100%”]

Byte Compare

https://moreporkgames.squarespace.com/s/Byte-Compare.png

		Compares two bytes (or enums).

[TABLE=“class: grid, align: left, width: 100%”]

AddAndSetFloat

https://moreporkgames.squarespace.com/s/Add-and-Set-Float.png

		Convenience function that adds a value to a variable and SETS the variable to the resulting value.

RoundToMultiple

https://moreporkgames.squarespace.com/s/RoundToMultiple.png

		Rounds a float to nearest multiple of int

FInterp Pulse

https://moreporkgames.squarespace.com/s/FInterp-Pulse.png

		Interpolate between A and B, applying a sine function (so interpolating between 0 and 1, an Alpha of 0.0 will give 0.0, an Alpha of 0.5 will give 1.0, and an Alpha of 1.0 will give 0.0). Effectively a pulse.

FInterpStepped

https://moreporkgames.squarespace.com/s/FInterpStepped.png

		Interpolate between A and B in a "stepped" fashion.

TruncateToMultiple

https://moreporkgames.squarespace.com/s/TruncateToMultiple.png

		Truncates a float to nearest multiple of int

MaxOfFloatArray_(Impure)

https://moreporkgames.squarespace.com/s/MaxOfFloatArray_Impure.png

		"Impure" version of MaxOfFloatArray, so if you use the value twice in a function it doesn't calculate it every time.

MinOfFloatArray_(Impure)

https://moreporkgames.squarespace.com/s/MinOfFloatArray_Impure.png

		"Impure" version of MinOfFloatArray, so if you use the value twice in a function it doesn't calculate it every time.

GetFloatRange

https://moreporkgames.squarespace.com/s/GetFloatRange.png

		Given an array of ranges and a value, returns the range that the value is in e.g. if range<0> is 7 and the value is < 7, it will be in that range.

TotalOfFloatArray

https://moreporkgames.squarespace.com/s/TotalOfFloatArray.png

		Gives the total value of an array of floats.

Float Compare

https://moreporkgames.squarespace.com/s/Float-Compare.png

		Compares two floats (just a cleaner version of "Compare Float").

RoundFloatDecimals

https://moreporkgames.squarespace.com/s/RoundFloatDecimals.png

		Rounds a float to the specified number of decimal places e.g. 56.7857 rounded to 2 decimal places would becomes 56.79

[TABLE=“class: grid, align: left, width: 100%”]

ExtendLine

https://moreporkgames.squarespace.com/s/ExtendLine.png

		Extends a given line and returns the new line endpoint. Line extends by the distance given (in world units), or if LineMultiply is > 0, it will *instead* multiply the current line length.

[TABLE=“class: grid, align: left, width: 100%”]

AddAndSetInt

https://moreporkgames.squarespace.com/s/Add-and-Set-Int.png

		Convenience function that adds a value to a variable and SETS the variable to the resulting value.

TotalOfIntArray

https://moreporkgames.squarespace.com/s/TotalOfIntArray.png

		Gives the total value of an array of integers.

MaxOfIntArray_(Impure)

https://moreporkgames.squarespace.com/s/MaxOfIntArray_Impure.png

		"Impure" version of MaxOfIntArray, so if you use the value twice in a function it doesn't calculate it every time.

MinOfIntArray_(Impure)

https://moreporkgames.squarespace.com/s/MinOfIntArray_Impure.png

		"Impure" version of MinOfIntArray, so if you use the value twice in a function it doesn't calculate it every time.

GetIntRange

https://moreporkgames.squarespace.com/s/GetIntRange.png

		Given an array of ranges and a value, returns the range that the value is in e.g. if range<0> is 7 and the value is < 7, it will be in that range.

Int_/Int(ReturnFloat)

https://moreporkgames.squarespace.com/s/Int_div_Int_ReturnFloat.png

		Returns a float value of A divided by B.

MapRange_(Int)

https://moreporkgames.squarespace.com/s/MapRange_Int.png

		Returns Value mapped from one range into another. (e.g. 20 normalized from the range 10->50 to 20->40 would result in 25). If "Clamp" is checked, Value is clamped to the input range. If "Truncate" is checked, value is truncated instead of rounding (cheaper).

Int Compare

https://moreporkgames.squarespace.com/s/Int-Compare.png

		Compares two integers (just a cleaner version of "Compare Int").

[TABLE=“class: grid, align: left, width: 100%”]

V2_InterpTo

https://moreporkgames.squarespace.com/s/V2_InterpTo.png

		Same as VInterp To except for Vector2

V2_InterpToConstant

https://moreporkgames.squarespace.com/s/V2_InterpToConstant.png

		Same as VInterp To Constant except for Vector2

BlendVector

https://moreporkgames.squarespace.com/s/BlendVector.png

		Same as the standard Ease function, except it exposes the Exponent and Steps in case the ease type is not constant.

BlendFloat

https://moreporkgames.squarespace.com/s/BlendFloat.png

		Same as the standard Ease function, except it exposes the Exponent and Steps in case the ease type is not constant.

BlendColor

https://moreporkgames.squarespace.com/s/BlendColor.png

		Same as the standard Ease function, except it exposes the Exponent and Steps in case the ease type is not constant.

BlendVector2D

https://moreporkgames.squarespace.com/s/BlendVector2D.png

		Same as the standard Ease function, except it exposes the Exponent and Steps in case the ease type is not constant.

[TABLE=“class: grid, align: left, width: 100%”]

RandomIntegerByChance

https://moreporkgames.squarespace.com/s/RandomIntegerByChance.png

		Generates a random integer, biased by the input Chances array e.g. if Chances<1> is 1 and Chances<2> is 10, then the output is 10x more likely to be 2. If seed is left at -1, it uses a random seed each time. Returns -1 if invalid chances passed in.

RandomFloatInRange_(Impure)

https://moreporkgames.squarespace.com/s/RandomFloatInRange_Impure.png

		"Impure" version of RandomFloatInRange, so if you use the value twice in a function it doesn't calculate it every time.

RandomBoolByChance

https://moreporkgames.squarespace.com/s/RandomBoolByChance.png

		Gives a random bool based on the chance specified e.g. if True_Chances is 1 and False_Chances is 10, the result is 10x more likely to be false.

[TABLE=“class: grid, align: left, width: 100%”]

FindLookAtRotation_(YawOnly)

https://moreporkgames.squarespace.com/s/FindLookAtRotation_YawOnly.png

		Same as "Find Look at Rotation" except ignores the Z position of the start/target. Essentially this is a "Find 2D Look at Rotation" (top-down).

[TABLE=“class: grid, align: left, width: 100%”]

VectorIsNull

https://moreporkgames.squarespace.com/s/VectorIsNull.png

		Returns true if the vector is exactly 0,0,0. Like "Equal (Vector)" except without a tolerance, must be exactly 0.0.

VectorIsNegative

https://moreporkgames.squarespace.com/s/VectorIsNegative.png

		Returns true if the TOTAL OF THE COMPONENTS of a vector is less than zero (not the length of the vector)

Absolute_(Vector)

https://moreporkgames.squarespace.com/s/Absolute_Vector.png

		Returns the absolute (positive) value of A

AddAndSetVector

https://moreporkgames.squarespace.com/s/AddAndSetVector.png

		Convenience function that adds a value to a variable and SETS the variable to the resulting value.

GetMaxElementIndex

https://moreporkgames.squarespace.com/s/GetMaxElementIndex.png

		Returns the index of the AXIS with the highest value

ClampVectorPerElement

https://moreporkgames.squarespace.com/s/ClampVectorPerElement.png

		Clamps each element of a Vector individually between a minimum and maximum.

Vector Compare

https://moreporkgames.squarespace.com/s/Vector-Compare.png

		Compares the length/magnitude of two vectors.

Direction Compare

https://moreporkgames.squarespace.com/s/Direction-Compare.png

		Compares two directions, with a tolerance value (1.0 is exactly the same direction, -1.0 is exactly the opposite direction, 0.0 is perpedicular). Also outputs what the result was.

[TABLE=“class: grid, align: left, width: 100%”]

Equal_(Vector2D)

https://moreporkgames.squarespace.com/s/Equal_Vector2.png

		Returns true if A is equal to B

vector2d_*_vector2d

https://moreporkgames.squarespace.com/s/vector2d_x_vector2d.png

		Returns A multiplied by B

vector2d_/_vector2d

https://moreporkgames.squarespace.com/s/vector2d_div_vector2d.png

		Returns A divided by B

V2_Lerp

https://moreporkgames.squarespace.com/s/V2_Lerp.png

		Same as Lerp (Vector) except for Vector 2D.

Absolute_(Vector2D)

https://moreporkgames.squarespace.com/s/Absolute_Vector2D.png

		Returns the absolute (positive) value of A

ClampVector2D_Size

https://moreporkgames.squarespace.com/s/ClampVector2D_Size.png

		Clamps a Vector 2D between a minimum and maximum LENGTH.

ClampVector2D_PerElement

https://moreporkgames.squarespace.com/s/ClampVector2D_PerElement.png

		Clamps each element of a Vector 2D individually between a minimum and maximum.

Vector2D Compare

https://moreporkgames.squarespace.com/s/Vector2D-Compare.png

		Compares the length/magnitude of two vector 2Ds.

SelectVector2D

https://moreporkgames.squarespace.com/s/SelectVector2D.png

		If Pick A is True, A is returned, otherwise B is

[TABLE=“class: grid, align: left, width: 100%”]

Switch Is Server

https://moreporkgames.squarespace.com/s/Switch-Is-Server.png

		The "Server" output is fired if the world that the calling object is from is on the host. Otherwise, the client output is fired.

[TABLE=“class: grid, align: left, width: 100%”]

SetSimulatePhysicsAll

https://moreporkgames.squarespace.com/s/SetSimulatePhysicsAll.png

		Sets "simulate physics" for all primitive components on the given actor.

SetActorPhysicsEnabled

https://moreporkgames.squarespace.com/s/SetActorPhysicsEnabled.png

		Sets all "physics" (collision AND physics simulation) on or off for all primitives on the given actor (and sets collision on the actor itself, too). If input is false, CollisionTypeIfEnabling is ignored and collision is turned off. If you ONLY want to set physics simulation and leave collision as it is (or vice versa), use SetCollisionEnabledAll or SetSimulatePhysicsAll.

GetPhysicsTotalMovementAmount

https://moreporkgames.squarespace.com/s/GetPhysicsTotalMovementAmount.png

		Gets the magnitude of the component's linear AND angular velocity. Useful in situations when you're checking for any movement before doing something.

[TABLE=“class: grid, align: left, width: 100%”]

GetDynamicMaterial

https://moreporkgames.squarespace.com/s/GetDynamicMaterial.png

		Gets the MaterialInstanceDynamic assigned to the given component, if it has one

HasScalarParameter

https://moreporkgames.squarespace.com/s/HasScalarParameter.png

		Returns true if the given Material Instance has a parameter with the specified name.

HasTextureParameter

https://moreporkgames.squarespace.com/s/HasTextureParameter.png

		Returns true if the given Material Instance has a parameter with the specified name.

HasVectorParameter

https://moreporkgames.squarespace.com/s/HasVectorParameter.png

		Returns true if the given Material Instance has a parameter with the specified name.

[TABLE=“class: grid, align: left, width: 100%”]

CreateAndAddWidget

https://moreporkgames.squarespace.com/s/CreateAndAddWidget.png

		Creates a widget of the specified class and adds it to the viewport.

Toggle Widget

https://moreporkgames.squarespace.com/s/Toggle-Widget.png

		Toggles a widget's enabled status AND it's visibility

Continued from first post:

[table=“width: 100%, class: grid, align: left”][th]Utilities[/th][th][/th][th][/th]
GetFurthestOrClosestLocation

https://moreporkgames.squarespace.com/s/GetFurthestOrClosestLocation.png

Returns the furthest or closest location from a given array of locations. Will return the furthest unless “UseClosest” is true.
GetDistance

https://moreporkgames.squarespace.com/s/GetDistance.png

Gets the distance between two world locations. Check “Squared” for cheaper version that returns the distance squared (skips doing the square root).
GetFurthestOrClosestActor

https://moreporkgames.squarespace.com/s/GetFurthestOrClosestActor.png

Returns the furthest or closest actor from a given array of locations or actors. Will return the furthest unless “UseClosest” is true.
NormalizedScreenToWorldLocation_(Typical)

https://moreporkgames.squarespace.com/s/NormalizedScreenToWorldLocation_Typical.png

Converts normalized (0 to 1) screen coordinates to a 3D world location, tracing against static world geometry. WARNING, requires a small delay at level start, because the viewport size doesn’t get initialized straight away.
WorldToNormalizedScreenLocation

https://moreporkgames.squarespace.com/s/WorldToNormalizedScreenLocation.png

Converts a world location to a normalized (0-1) screen location.
IsObjectOnScreen

https://moreporkgames.squarespace.com/s/IsObjectOnScreen.png

Returns whether the actor or component is currently on screen (uses actor if one is passed in, otherwise uses component). By default it only returns true if the objects bounds are completely on screen, uncheck “Completely” to change this.
GetFurthestOrClosestLocationToScreenCenter

https://moreporkgames.squarespace.com/s/GetFurthestOrClosestLocationToScreenCenter.png

From a set of locations, gets the one that is furthest (or closest, if ticked) to the centre of the screen.
FindClosestLocationBetween

https://moreporkgames.squarespace.com/s/FindClosestLocationBetween.png

Get the closest point between the given points A and B, to the given location. Outputs the closest location found and a 0-1 value that represents where between the two points it was found (0 is closer to A, 1 is closer to B). Higher Accuracy values produce better results but can be a lot more expensive.
GetAllActorsOfSeveralClasses

https://moreporkgames.squarespace.com/s/GetAllActorsOfSeveralClasses.png

Like “Get All Actors Of Class” except will take multiple classes.
GetAllActorsWithTag

https://moreporkgames.squarespace.com/s/GetAllActorsWithTag.png

Gets all actors with the specified Actor Tag (not component tag). Can be optionally filtered to make it cheaper.
GetAllActorsWithCollisionType

https://moreporkgames.squarespace.com/s/GetAllActorsWithCollisionType.png

Gets all actors with the specified Collision Type. Can be optionally filtered to make it cheaper.
Alpha Over Time

https://moreporkgames.squarespace.com/s/Alpha-Over-Time.png

Interpolates from 0 to 1, over the time given. Useful for interpolating a value, especially where timelines aren’t possible. Requires Tick to be hooked up to the tick function in the class you are using it.
Alpha Pulse Over Time

https://moreporkgames.squarespace.com/s/Alpha-Pulse-Over-Time.png

Interpolates from 0 to 1 and back to 0 again, over the time given. Useful for pulsing a value, especially where timelines aren’t possible. Requires Tick to be hooked up to the tick function in the class you are using it.
Fade

https://moreporkgames.squarespace.com/s/Fade.png

Fades the screen to or from a color over the time specified, with several options.
Loop Counter

https://moreporkgames.squarespace.com/s/Loop-Counter.png

Useful for counting iterations in a loop. Trigger to increment the count.
Alpha Over Time Auto Tick

https://moreporkgames.squarespace.com/s/Alpha-Over-Time-Auto-Tick.png

Interpolates from 0 to 1, over the time given. Useful for interpolating a value, especially where timelines aren’t possible.
Alpha Pulse Over Time Auto Tick

https://moreporkgames.squarespace.com/s/Alpha-Pulse-Over-Time-Auto-Tick.png

Interpolates from 0 to 1 and back to 0 again, over the time given. Useful for pulsing a value, especially where timelines aren’t possible.
Fade With Notification

https://moreporkgames.squarespace.com/s/Fade-With-Notification.png

Same as “Fade” in MoreporkMacros, except gives notification when the fade is started / stopped / paused / finished.
SelectParticleSystem

https://moreporkgames.squarespace.com/s/SelectParticleSystem.png

If Pick A is True, A is returned, otherwise B is
SelectSound

https://moreporkgames.squarespace.com/s/SelectSound.png

If Pick A is True, A is returned, otherwise B is

[table=“width: 100%, class: grid, align: left”][th]Utilities > Array[/th][th][/th][th][/th]
SortFloatArray

https://moreporkgames.squarespace.com/s/SortFloatArray.png

Sorts an array by value
SortIntArray

https://moreporkgames.squarespace.com/s/SortIntArray.png

Sorts an array by value
Array Length Compare

https://moreporkgames.squarespace.com/s/Array-Length-Compare.png

Compares the length of two arrays.
Get Latest Item

https://moreporkgames.squarespace.com/s/Get-Latest-Item.png

Gets the last entry in an array.
Item Is Latest

https://moreporkgames.squarespace.com/s/Item-Is-Latest.png

Returns whether the array item is the latest in the array. If Index is -1, it will use the supplied item, else it will return whether the index is the latest.
Array Replace

https://moreporkgames.squarespace.com/s/Array-Replace.png

Similar to “Set Array Elem” (actually I can’t remember what the difference is, but it made sense at the time).
Array Length Int Compare

https://moreporkgames.squarespace.com/s/Array-Length-Int-Compare.png

Compares the length of an array with the specified value.
Conditional Get

https://moreporkgames.squarespace.com/s/Conditional-Get.png

Gets an array value at the given index, but only attempts to if the index is within the bounds of the array (else returns 0 and fires the Failed output).
Array Item Exists

https://moreporkgames.squarespace.com/s/Array-Item-Exists.png

Fires the “True” output if the item exists in the array.
Set Array Element

https://moreporkgames.squarespace.com/s/Set-Array-Element.png

Same as “Set Array Elem” except it will not trigger an array out of bounds warning (warning shouldn’t fire because array is expanded to fit)
Get Random Element

https://moreporkgames.squarespace.com/s/Get-Random-Element.png

Gets a random element from the array. If “Unique” is checked, then it will not pick the same element twice (unless the “Reset” input is triggered).
Get Random Elements (Multiple)

https://moreporkgames.squarespace.com/s/Get-Random-Elements-Multiple.png

Gets the specified number of elements randomly from the array (will not pick the same element twice in the same execution).
Remove Items (Multiple)

https://moreporkgames.squarespace.com/s/Remove-Items-Multiple.png

Removes multiple items from an array at once.
Add (Multiple)

https://moreporkgames.squarespace.com/s/Add-Multiple.png

Adds multiple items to an array at once.
Add Unique (Multiple)

https://moreporkgames.squarespace.com/s/Add-Unique-Multiple.png

Adds multiple items to an array at once - only adds an item if it is unique.
Set Array Length

https://moreporkgames.squarespace.com/s/Set-Array-Length.png

Expands or shrinks an array to the specified length

[table=“width: 100%, class: grid, align: left”][th]Utilities > Bool[/th][th][/th][th][/th]
Bool Compare

https://moreporkgames.squarespace.com/s/Bool-Compare.png

Compares two bools.
Select Bool

https://moreporkgames.squarespace.com/s/Select-Bool.png

Selects A or B depending on the value of “Select A” (same as Select Float, Select Int, etc).

[table=“width: 100%, class: grid, align: left”][th]Utilities > Class[/th][th][/th][th][/th]
ClassCompare

https://moreporkgames.squarespace.com/s/Class-Compare.png

Compares two classes.

[table=“width: 100%, class: grid, align: left”][th]Utilities > Flow Control[/th][th][/th][th][/th]
ForEachLoopReverse

https://moreporkgames.squarespace.com/s/ForEachLoopReverse.png

Same as ForEach except in reverse. Essential if you are going through an array and deleting things (with a normal ForEach loop, deleting array entries duing the loop would cause entries to be missed).
Do N & Notify

https://moreporkgames.squarespace.com/s/Do-N-and-Notify.png.png

Same as “Do N” except it will fire the “N Hit” pin if it hits N
Platform Switch

https://moreporkgames.squarespace.com/s/Platform-Switch.png

Fires output pin depending on what platform the game is currently running on.
Branch By Chance

https://moreporkgames.squarespace.com/s/Branch-By-Chance.png

Branches based on the chance specified e.g. if A is 1 and B Chance is 10, the result is 10x more likely to be B.

[table=“width: 100%, class: grid, align: left”][th]Utilities > Name[/th][th][/th][th][/th]
AppendToName

https://moreporkgames.squarespace.com/s/AppendToName.png

Adds a suffix and/or prefix to a Name.
SelectName

https://moreporkgames.squarespace.com/s/SelectName.png

If Pick A is True, A is returned, otherwise B is

[table=“width: 100%, class: grid, align: left”][th]Utilities > Object[/th][th][/th][th][/th]
Object Compare

https://moreporkgames.squarespace.com/s/Object-Compare.png

Compares two objects

[table=“width: 100%, class: grid, align: left”][th]Utilities > String[/th][th][/th][th][/th]
IntToStringWithSign

https://moreporkgames.squarespace.com/s/IntToStringWithSign.png

Converts an integer to string, with + prepended if the int is positive.
AppendAndSetString

https://moreporkgames.squarespace.com/s/AppendAndSetString.png

Adds a prefix and/or suffix to a string AND SETS the String variable.
IntToStringMinDigits

https://moreporkgames.squarespace.com/s/IntToStringMinDigits.png

Converts an integer to a string with a minimum number of digits (e.g. 1 with min digits 3 would give a string “001”.
ArrayToString_(Integer)

https://moreporkgames.squarespace.com/s/ArrayToString_Integer.png

Converts an array of values to a string so you can easily print the array to the log.
ArrayToString_(Float)

https://moreporkgames.squarespace.com/s/ArrayToString_Float.png

Converts an array of values to a string so you can easily print the array to the log.
String Compare

https://moreporkgames.squarespace.com/s/String-Compare.png

Compares two strings, outputs == if it matches exactly (including case), outputs ~= if it matched with different case, or != if it didn’t match at all.
String Compare

https://moreporkgames.squarespace.com/s/ArrayToString_String.png

Converts an array of values to a string so you can easily print the array to the log.

[table=“width: 100%, class: grid, align: left”][th]Utilities > Text[/th][th][/th][th][/th]
SelectText

https://moreporkgames.squarespace.com/s/SelectText.png

If Pick A is True, A is returned, otherwise B is

[table=“width: 100%, class: grid, align: left”][th]Utilities > Transformation[/th][th][/th][th][/th]
GetWorldTransformWithoutScale

https://moreporkgames.squarespace.com/s/GetWorldTransformWithoutScale.png

Gets a scene component world transform without the scale (i.e. leaves scale at 1.0, 1.0, 1.0)
GetActorVelocity_(Local)

https://moreporkgames.squarespace.com/s/GetActorVelocity_Local.png

Gets the velocity of an actor, transformed to local space, optionally normalized.
GetComponentVelocity_(Local)

https://moreporkgames.squarespace.com/s/GetComponentVelocity_Local.png

Gets the velocity of a component, transformed to local space, optionally normalized.
Compare Actor Distance

https://moreporkgames.squarespace.com/s/Compare-Actor-Distance.png

Compares the distance between two actors, against the given distance.

[table=“width: 100%, class: grid, align: left”][th]Utilities > Variables[/th][th][/th][th][/th]
LocalVariable_(Vector)

https://moreporkgames.squarespace.com/s/LocalVariable_Vector.png

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_(Rotator)

https://moreporkgames.squarespace.com/s/LocalVariable_Rotator.png

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_(Integer)

https://moreporkgames.squarespace.com/s/LocalVariable_Integer.png

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_(Actor)

https://moreporkgames.squarespace.com/s/LocalVariable_Actor.png

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_(Component)

https://moreporkgames.squarespace.com/s/LocalVariable_Component.png

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_(Float)

https://moreporkgames.squarespace.com/s/LocalVariable_Float.png

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_(Bool)

https://moreporkgames.squarespace.com/s/LocalVariable_Bool.png

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_(Vector2D)

https://moreporkgames.squarespace.com/s/LocalVariable_Vector2D.png

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.

[table=“width: 100%, class: grid, align: left”][th]Viewport[/th][th][/th][th][/th]
GetAspectRatio

https://moreporkgames.squarespace.com/s/GetAspectRatio.png

Gets the current screen aspect ratio (requires small delay after BeginPlay because viewport size has a delay before it is initialized)
GetScreenScale

https://moreporkgames.squarespace.com/s/GetScreenScale.png

Gets the scale of the current screen, relative to a base resolution. Useful for UI scaling (requires small delay after BeginPlay because viewport size has a delay before it is initialized)

P.S. anyone know if there is a way to insert anchors in a post (so I can have a simple TOC / quick jump list at the top)?

wow thank you very much! lots of these seem very useful. thanks for the good documentation as well.

These look very useful, I think I am going to use at least the random one :slight_smile:

You may be able to insert HTML code into the post, But IDK.

Could you post a guideline on how a person is supposed to accredit you?

Awesome!
That should prove to be a massive time saver :slight_smile:

Thank you very much. Have to look into fade and random :slight_smile:

Thanks, very helpful!
Noob question: How do I install/add these?

Awesome! I’ve created few macros as well (Check my profile), they are mostly in your library too.

Thanks so much this is amazing stuff!

Thank you very much…! It is cool.

Woops, that might’ve been a good thing to stick in the ReadMe, I suppose… Just unzip to your project directory, in the “Content” folder (where your maps and other assets are, there is probably already a Blueprints folder there). Load the editor and they should all magically appear :slight_smile:

Any kind of mention is fine in your game credits - “thanks to Cory Spooner for Morepork Functions”, or just a name under a general thank you’s.

Just went through all your list.

Thank you very much! :slight_smile:

I’m not sure if I will use them but it certainly gave me the will to create my own base of macro libraries that I’m going to use in every of my projects.

Wow, that’s an incredible library! Really great!

Update 1 Added

New update! 18 new functions and 1 new macro. Mostly not too exciting but a couple of useful ones in there, and it’s compiled in 4.12.4. Here are the descriptions, and I’ve updated the full descriptions in first post with pics etc:

**GetCurveFloatValue **- Same as “Get Float Value”, except it allows you to specify the curve asset instead of having to assign it to a variable first.
**GetCurveVectorValue **- Same as “Get Vector Value”, except it allows you to specify the curve asset instead of having to assign it to a variable first.
**GetCurveLinearColorValue **- Same as “Get Linear Color Value”, except it allows you to specify the curve asset instead of having to assign it to a variable first.
**GetCurveTimeRange **- Same as “Get Time Range”, except it allows you to specify the curve asset instead of having to assign it to a variable first.
**GetCurveValueRange **- Same as “Get Value Range”, except it allows you to specify the curve asset instead of having to assign it to a variable first.

**RoundFloatDecimals **- Rounds a float to the specified number of decimal places e.g. 56.7857 rounded to 2 decimal places would becomes 56.79
**Switch Is Server **- The “Server” output is fired if the world that the calling object is from is on the host. Otherwise, the client output is fired.
ArrayToString_(String) - Converts an array of values to a string so you can easily print the array to the log.
**GetAspectRatio **- Gets the current screen aspect ratio (requires small delay after BeginPlay because viewport size has a delay before it is initialized)
**GetScreenScale **- Gets the scale of the current screen, relative to a base resolution. Useful for UI scaling (requires small delay after BeginPlay because viewport size has a delay before it is initialized)

**HasScalarParameter **- Returns true if the given Material Instance has a parameter with the specified name.
**HasTextureParameter **- Returns true if the given Material Instance has a parameter with the specified name.
**HasVectorParameter **- Returns true if the given Material Instance has a parameter with the specified name.

**SelectName **- If Pick A is True, A is returned, otherwise B is
**SelectParticleSystem **- If Pick A is True, A is returned, otherwise B is
**SelectSound **- If Pick A is True, A is returned, otherwise B is
**SelectText **- If Pick A is True, A is returned, otherwise B is
SelectVector2D - If Pick A is True, A is returned, otherwise B is

LocalVariable_(Vector2D) - 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.

Also just a quick blatant p1mp, I have a dev blog if anyone wishes to follow it - besides the Garden Wars stuff, I’ve already posted a couple of articles/tutorials (links below) explaining how I achieved certain things, and more to come shortly!

Using canvas to highlight objects on screen (UE4 Blueprint)
Dynamic weather/season cycle (UE4)
Reducing Loading Screen Size (UE4 iOS)

Thank you very much!!!

It’s amazing works!
Thank you very much!

Great work!
Some of those sure will come in handy.
Also great as a learning resource.

PS: Not sure if it’s mentioned here, but the MPG folder can be put into the Engine/Content directory to have it available across all projects (though it might get overwritten with an update, but it’s still a timesaver).

Those are some super-handy functions! Thanks a bunch :slight_smile: