Download

(39) Rama's Extra Blueprint Nodes for You as a Plugin, No C++ Required!

Hey Rama,

thanks a lot for this great plugin!
Could the “Victory Save Pixels” node be extended in a way that it outputs a new Texture2d without saving the file to disk first?

edit: actually, get the pixels of a Texture2d, manipulate, and create a new Texture2d :slight_smile:

Load .Wav From File and play it!

Dear Sahkan,

I already have these nodes for loading audios from file!

Does this give you want?
**
PlaySoundAttachedFromFile
PlaySoundAtLocationFromFile
GetSoundWaveFromFile**



/** Contributed by UE4 forum member n00854180t! Plays a sound from file, attached to and following the specified component. This is a fire and forget sound. Replication is also not handled at this point.
* @param FilePath - Path to sound file to play
* @param AttachComponent - Component to attach to.
* @param AttachPointName - Optional named point within the AttachComponent to play the sound at
* @param Location - Depending on the value of Location Type this is either a relative offset from the attach component/point or an absolute world position that will be translated to a relative offset
* @param LocationType - Specifies whether Location is a relative offset or an absolute world position
* @param bStopWhenAttachedToDestroyed - Specifies whether the sound should stop playing when the owner of the attach to component is destroyed.
* @param VolumeMultiplier - Volume multiplier
* @param PitchMultiplier - PitchMultiplier
* @param AttenuationSettings - Override attenuation settings package to play sound with
*/ 
UFUNCTION(BlueprintCallable, Category = "VictoryBPLibrary", meta = (VolumeMultiplier = "1.0", PitchMultiplier = "1.0", AdvancedDisplay = "2", UnsafeDuringActorConstruction = "true"))
static class **UAudioComponent* PlaySoundAttachedFromFile**(const FString& FilePath, class USceneComponent* AttachToComponent, FName AttachPointName = NAME_None, FVector Location = FVector(ForceInit), EAttachLocation::Type LocationType = EAttachLocation::SnapToTarget, bool bStopWhenAttachedToDestroyed = false, float VolumeMultiplier = 1.f, float PitchMultiplier = 1.f, float StartTime = 0.f, class USoundAttenuation* AttenuationSettings = NULL);

/** Contributed by UE4 forum member n00854180t! Plays a sound at the given location. This is a fire and forget sound and does not travel with any actor. Replication is also not handled at this point.
* @param FilePath - Path to sound file to play
* @param Location - World position to play sound at
* @param World - The World in which the sound is to be played
* @param VolumeMultiplier - Volume multiplier
* @param PitchMultiplier - PitchMultiplier
* @param AttenuationSettings - Override attenuation settings package to play sound with
*/
UFUNCTION(BlueprintCallable, Category = "VictoryBPLibrary", meta = (HidePin = "WorldContextObject", DefaultToSelf = "WorldContextObject", VolumeMultiplier = "1.0", PitchMultiplier = "1.0", AdvancedDisplay = "3", UnsafeDuringActorConstruction = "true"))
static void **PlaySoundAtLocationFromFile**(UObject* WorldContextObject, const FString& FilePath, FVector Location, float VolumeMultiplier = 1.f, float PitchMultiplier = 1.f, float StartTime = 0.f, class USoundAttenuation* AttenuationSettings = NULL);

/** Contributed by UE4 forum member n00854180t! Creates a USoundWave* from file path.
* Read .ogg header file and refresh USoundWave metadata.
* @param FilePath		path to file to create sound wave from
*/
UFUNCTION(BlueprintCallable, Category = "VictoryBPLibrary")
static class **USoundWave* GetSoundWaveFromFile**(const FString& FilePath);


Enjoy!

Rama

Holy **** ! you are a god ! Thanks XD

Rama,Can you tell us how do you make the VictoryAI plugin template?

When I have some time I can work on this yes :slight_smile:

Rama

TMaps, Mapping Two Data Types Together In BP!

bb75874a149303af4651f3ddd1aa90d9ed5bbf1c.jpeg

Rama’s Blueprints TMap Solution!

I’ve now made a BP TMap solution!

TMap is a data structure that is not yet exposed to BP, but I’ve made a component-based solution for you so that you can use TMaps in BP!


**What's a TMap?**

Really it's name is "Map" and T is the class specifier in C++, but I tend to call them TMaps since Map is a rather generic word.

A TMap is a data structure based on Key,Value pairs, where for any Key there is only one Value.

This allows internal data structure look up times that are much faster than a regular dynamic array.

This also allows for the association of dissimilar data types in a way that you organize.

For example, you can map a set of integers to a set of Vectors, so that each integer is related to exactly one vector.

Or, as I provide you with in my plugin, you can **relate a String to an Actor**!

This means you can look up an Actor reference via a simple string input!

Or you can look up Vector data based on String data!

**The primary use of TMaps is for efficient lookup of data**, which dynamic arrays simply cannot do because there is no guarantee or assumption with dynamic arrays of anything like a key,value where each key has only 1 value.

**The rules of TMaps allow for efficient look up to speed up your game flow!**

Actor Component

My solution is component-based, which means you can have per-instance TMap data for your game’s actors!

You simply add my Victory TMap Component to any actor you want!

I used the My Character blueprint in my own tests!!!

You can use literally any actor you want, or make a new actor BP whose only role is to house the TMap Component


**Supported Types**

![aa1ade53f3ff0021436f1a76aac85d11992bbd7c.jpeg|1265x798](upload://ogOJATwlYRl6WYup8uRYQZ9AtGc.jpeg)

**Supported TMap Functions**

![06a72fc14f4c795fe5f7fced0d14ac3be930f540.jpeg|1245x741](upload://WR3JWI54dZ76RYdi8fm8862ATe.jpeg)

![IsValidCheckOnGet.jpg|956x762](upload://tSF9sIfNyhHV3ROMcL8PJxPHwBX.jpeg)

Additional TMap Combinations

If you find that you cannot use my existing set of TMap Combinations to fulfill your game’s needs, let me know by posting in this thread and I can add additional TMaps to the component.


**Per Instance**

Remember that what I providing you with is a component-based solution, so you can add this TMap data to as many actors in your game as you want, and have per-instance variations in the data contained therein!

Most Recent Plugin Download From UE4 Wiki

:slight_smile:

Rama

I tried the “get sound wav from file” and it didn’t work for me.
While “get texture from file” worked great, trying to get the wav files the exact same way and it gives me nulls.
Did someone try that node already?

Edit: Oh i see now. they files supposed to be in .ogg format, it wasn’t that obvious though :\

Thank you Rama, and everybody who ever contributed for this great Plugin, it’s really awesome.

I have a question and a request:

In January you wrote on answerhub that it will be possible “very soon” to package BP only projects - is there any new information?

I really would love to see Apply Multiple Damage & Event Multiple Damage nodes. Similar to the current ones, but instead of a float as base damage it would carry a float array, so it may affect various attributes at once with different intensity - e.g. Life, Mana, Stamina. In addition it may also have a bool array and another float array for “is DoT (damage over time)” and “DoT (damage over time) duration”. The Bool array is not really necessary, but it may be a bit more comfortable to work with.

I didnt write that node, I"ll have to review it and see what’s going on :slight_smile:

Very nice to hear from you aWinter!

Is there a reason you cant make these nodes yourself as functions in your character class?

What is the reason it needs to be done with C++ code?

Happy to assist but need to know the reason for involving C++ code :slight_smile:

Have fun today!

Rama

[COLOR="#0000FF"]Draw Thick Circle With Axis Control[/COLOR]

Fun node for you!

With this node you can draw circles!

And you can control their thickness, as well as how many points make up the circle!

You can also have axis control!

So you can draw circles horizontally, vertically, at angles, any way you like, with convenient BP node inputs!

See pics!

af68277ba636b7e04fc6af9b982616b2340402e4.jpeg


**Most Recent Plugin Download From UE4 Wiki**
**Download Size: 648 KB** (about half of a MB)

https://wiki.unrealengine.com/File:VictoryPlugin.zip


:)

Rama

Ok Rama i just had to use *.ogg files and it works great, it should be mentioned in the function’s description though.

Hey Rama, I tried to use your victory plugin in 4.8.0 Preview 2, and UE rejected saying that this version is incompatible and that you’d need to recompile it for this version. Can you help?

here is the image
60d6b8c90688df66dac74114e64903606beaaac2.jpeg

Have you tried to recompile your project it in visual studio ?

I could of course implement my own functions to transfer the damage from the damage causer to the receiver. Just as I might use twenty “append string” nodes in a row instead of one “append multiple” from the victory plugin. However, there are many situations when the damage nodes are just ideal and casting or bp interfaces would be really cumbersome to use. The only issue of the damage nodes is that you may only pass one float at a time (and afaik you can’t change or workaround this at the moment without c++). Since really many games use some kind of damage I think many people would benefit from a default damage node which may pass various floats. Hence even racing or sport games may use it to pass some data from one actor to another. Two wildcard/ a struct array(s) would of course be even more useful than two float arrays, but I don’t know if this is a good idea for something crucial as damage processing or if it’s possible at all.

That’s great to know, thanks! I have updated the in-editor Node descriptions!


**Victory BP Library ~ Primary Releases Only Unless Have Community Help**


[QUOTE=malospam;290755]
Hey Rama, I tried to use your victory plugin in 4.8.0 Preview 2, and UE rejected saying that this version is incompatible and that you'd need to recompile it for this version. Can you help?
[/QUOTE]



[QUOTE=KitatusStudios;290876]
There's a lot of outdated code that won't work according to my 4.8
[/QUOTE]


Dear Community,

It is to be expected that my plugin wont automatically work with new preview builds because a very large quantity of C++ code (**over 4,000 lines!**) is involved.

Because C++ code changes are so plentiful in Preview builds, I cannot afford to support them myself.

**Please recall that I am not getting paid by Epic or anyone else to support my Victory BP Library plugin and I do all that I can, just for you!**

I simply dont have the time to support preview builds!

Keep in mind that Epic states clearly that preview builds are just for testing and you should not be running your main project on a preview build as many things can change during the preview process!

Do PM Me if You Do A Preview Build Upgrade

If anyone upgrades my plugin to 4.8 for their own use they can pm me and I can add the preview build to this thread.

:slight_smile:

Rama

Just casting to your custom character class which has extended versions of the Damage nodes, where you pass in the float array and take each entry out and apply damage nodes to each float is quite simple, I am not sure wherein lies the complication other than casting from base character class to your character class.

Let’s wait and see what casting is like in 4.8!

There’s a bug that makes it hard to make BP Libary Assets (Blueprint Only) to expedite casting to custom classes via pure nodes, I am hoping this is fixed in 4.8

:slight_smile:

Rama

3ad170c1fdb5928f5f54c13a7fa4405b1e2a8d55.jpeg

Dear Community,

New node for you!

This node will move / rename the most recently taken screenshot!

So the intended work flow is

  1. Exec Console Command -> “HighResShot 2” or “shot showui”

  2. Possibly put in a short Delay node

  3. Use my new node! ScreenShots Move Rename Most Recent!


**More Power for You in BP**

Now you can specify an absolute path directory and also file name for the most recent screen shot, and it will be relocated for you!

So please note you can only do this **after** you create the image using UE4's console commands.

Bonus For You

You can specify a destination folder that does not exist yet and my node will create it for you!

This is great for if you delete your custom screen shots folder and expect my node to work anyway!

My node will!

:slight_smile:


**High Res vs Regular Screen Shots**

You can filter for High Resolution and regular screen shots independently using my node!

So if you have High Res selected, ONLY High Resolution screenshots are considered when sorting by file time.

Otherwise, if this is unchecked, I will ONLY look for regular screenshots taken with  "shot showui"

:)

Keep in Same Directory?

To keep the file in the same directory, use my new Paths node that retrieves your project’s ScreenShot directory!


**Pro Tip**

If you have a bunch of shots, you can:

1. use my node in a for loop with a break and a max count of 1000,  (or while loop if you are feeling confident)

2. Ensure that you are moving the files OUT of their current directory (otherwise for loop will run to its limit) 

3. The break condition is when my new node returns false, so just plug the false end of the branch right back into the break condition!

This will work because my node is only checking the dates of the files that are within the screenshots directory, so as you keep moving the files out, my node will keep finding the new most recent picture!

My C++ Code For You

I had to write a lot of custom File Operations code to fulfill this request, so a lot of the functions you see in this node are not stock UE4 code. :slight_smile:



bool UVictoryBPFunctionLibrary::ScreenShots_Rename_Move_Most_Recent(
	FString& OriginalFileName,
	FString NewName, 
	FString NewAbsoluteFolderPath, 
	bool HighResolution
){ 
	OriginalFileName = "None";

	**//File Name given?**
	if(NewName.Len() <= 0) return false;
	
	**//Normalize**
	FPaths::NormalizeDirectoryName(NewAbsoluteFolderPath);
	
	**//Ensure target directory exists, 
	//		_or can be created!_ <3 Rama**
	if(!VCreateDirectory(NewAbsoluteFolderPath)) return false;
	
	FString ScreenShotsDir = VictoryPaths__ScreenShotsDir();
	
	**//Find all screenshots**
	TArray<FString> Files;	  //false = not recursive, not expecting subdirectories
	bool Success = GetFiles(ScreenShotsDir, Files, false);
	
	if(!Success)
	{
		return false;
	}
	
	**//Filter**
	TArray<FString> ToRemove; //16 bytes each, more stable than ptrs though since RemoveSwap is involved
	for(FString& Each : Files)
	{
		if(HighResolution)
		{
			//remove those that dont have it
			if(Each.Left(4) != "High")
			{
				ToRemove.Add(Each);
			}
		}
		else
		{ 
			//Remove those that have it!
			if(Each.Left(4) == "High")
			{
				ToRemove.Add(Each);
			}
		}
	}
	
	**//Remove!**
	for(FString& Each : ToRemove)
	{
		Files.RemoveSwap(Each); //Fast remove! Does not preserve order
	}
	
	**//No files?**
	if(Files.Num() < 1)
	{ 
		return false;
	}
	
	**//~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Rama's Sort Files by Time Stamp Feature
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	//Sort the file names by time stamp
	//  This is my custom c++ struct to do this,
	//  	combined with my operator< and UE4's
	//			TArray::Sort() function!**
	TArray<FFileStampSort> FileSort;
	for(FString& Each : Files)
	{
		FileSort.Add(FFileStampSort(&Each,GetFileTimeStamp(Each)));
		
	}

	//Sort all the file names by their Time Stamp!
	FileSort.Sort();
	
	//Biggest value = last entry
	OriginalFileName = *FileSort.Last().FileName;
	**//~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

	    
	**//Generate new Full File Path!**
	FString NewFullFilePath = NewAbsoluteFolderPath + "/" + NewName + ".bmp";
	
	**//Move File!**
	return RenameFile(NewFullFilePath, ScreenShotsDir + "/" + OriginalFileName);
}



**How It Works**

The core feature of my logic and this node is that I used a custom C++ struct in order to sort all of the files by date!

**I do this in a super-efficient way, using UE4's TArray::Sort function which leverages all of Epic's hard work to create a fast sorting function!**

I defined the C++ **operator&lt;** for my custom struct so that UE4 could do the sorting for me!

**In addition I have developed my own File I/O library since my time in the UE4 Beta program.**

So I had all the supporting functions I needed!

C++ Code Speed

Please note that in my internal file sorting system I do not duplicate the FString data! I refer to it via pointer, and use the FDateTime as the only data I access.

So essentially my custom C++ struct is a FDateTime wrapper for a FString ptr so that UE4 can sort the files for me like Lightning!


**Download and plug in!**

**Latest plugin download is here:**
https://wiki.unrealengine.com/File:VictoryPlugin.zip

Enjoy!

Rama

Is there a way i can use those functions in C++ as well? i’m trying to include the header file it says it doesn’t found.

Right now we have Current Floor Hit Result which gets updated every tick while walking but there is no easy way to store it for comparisons.

What about a node that stores the previous ticks floor hit result, call it “Last Floor Hit Result” or “Old Floor Hit Result”? I know in 4.8 OnWalkOffLedge does this but only when you walk off a ledge and not the whole hit result. If we change movement modes it would store the last ground contact, possibly even a timestamp until we switch back to walking

How to Include Plugin Functions and Classes in Project-Level Code

I did actually expose my Victory Core BP Library yes, so you can include it in your build cs!



UCLASS()
class VICTORYBPLIBRARY_API UVictoryBPFunctionLibrary : public UBlueprintFunctionLibrary
{


The fact that I include VICTORYBPLIBRARY_API means that the symbols get exported so that you include my plugin functions and classes and compile code at the project level.

You need to include my plugin module in your build cs as a dependency in order to use #include “VictoryBPLibrary.h”



PublicDependencyModuleNames.AddRange(new string] { 
	"Core", "CoreUObject", "Engine", "InputCore",
			
	"VictoryPlugin"
});


Once you do this, you can then call my Victory BP Library functions wherever you #include “VictoryBPLibrary.h”


**Fancy Extra Feature**

Another neat feature is that you can even have classes in your project code that extend C++ classes that I've included in the plugin such as JoyISM (instanced static mesh)!

Enjoy!

Rama