How can I send back data from one actor to another? - unreal-engine4

So i have a project on ue4 and i cant find a way to send data from one actor to another.I have a piston that snaps into an engine block,the piston then spawns 2 screws that need to be screwed in.The problem is that i cant tell my piston actor that both screws are bloted in and are ready.
I tried to make an actor array and get the boolean IsScrewed? but i had no favour.
Here are some pictures for better understanding.

Related

Refresh rate of pose of Base Station in OpenVR

I am able to get the position of the base stations but this only updates once, while controllers and HDM are constantly updated. Is there a way to force the refresh so that I can get the position of the base stations (trackingreference) in real-time? thanks!
Technically there is, I'm talking driver side right now, but it kinda does nothing, tracking references are normal tracked objects after all so drivers can update their poses like normal with a vr::VRServerDriverHost()->TrackedDevicePoseUpdated() call and on init through the pose returned by GetPose()
Now, that should work, but it doesnt, even more most of the time custom tracking refences don't show up in SteamVR. what it does under the hood? no idea
Also commercial headsets might update their tracking reference's position only once on startup which seems to be the case

How to apply animation to a large number of static mesh actors in a single blueprint? UE4

I'm working on a project in Unreal Engine 4 where I receive all the static meshes and objects from the designer classified and named correctly, for example she sends me a TV Unit and I want to find all the cabinets in this TV unit and apply the open and close animation to them.
What I tried to do so far is that I was able to detect all the cabinet doors in the TV unit in the level blueprint, based on the names of objects I received, which I already know is a bad idea but bear with me just for the sake of debugging, and I tried to apply the animation when that specific object is overlapped.
The problem is I can't seem to find a way to make the overlap event to work on all of these objects in the foreachloop, how can I attach the event to all of these object? and what is the best practice for something like this?
My level bluprint
Your question is not clear but here it goes:
Remember! A for loop will always bind the event to all elements in the array but if you take the element from the loop and use it in your event only the last one will be used.
Also I did not understand how can you play an animation on a static mesh , you will need skeletal meshes.
Please follow up to my answer , lets fix this . thanks.

Why doesn't "spawn actor from class" execute more than once, while using a "for loop" and "select node"

I am using Unreal Engine 4's visual blueprint scripting language to make a shotgun in my game. When I call the function fire, it simply spawns an actor at a given location (this actor moves like a bullet, and has a collision mesh). The only problem is when I want to add another "spawn actor from class" node to the event graph, both of the nodes stop working, and nothing happens. I tested to see if my for loop, select node combination was messing up, but it worked and printed out everything fine, but for some reason when the "spawn actor from class" node is put in more than once, it stops functioning.
Here are pictures provided, if you needed them, and feel free to ask any additional questions.
Here is the Imgur link: https://imgur.com/a/2ggqoAW
Can anyone please help me with this problem
Thank You.
As was stated in a comment, you should never use a for-loop in this way. Just use sequence node if you want to execute stuff in order. In your case, looping over the different transformations would be even better.
Also, don't use actors for projectiles. Actors are pretty heavy objects which require a lot of resources to create and maintain by the engine. A few hundred actors each ticking every frame can easily tank your framerate. Create a custom component and maybe have a look at UProjectileMovementComponent or EPIC's shooter tutorial project.
As for your current problem, check the collision handling, they might not spawn because they overlap when spawned.

Save/Load scene state for NPC actors

All of the examples that I've seen of saving/loading a scene in Unity are either only saving/loading simple data (like the player's current health and position), or they're using a purchasable asset from the Unity store. The logic I need is a little more complex than having just a few predefined character parameters to save, and I'd rather learn the proper way to do this instead of buying a Unity store asset, so I'm asking here.
My scenes have some actors (NPCs and enemies) that are defined in the scene in the Unity editor, and some actors that are dynamically added via script during run-time. When the player saves, I want to record the current position/state/etc. of each actor, and then restore those actors to their last states when the player loads the game.
For the actors that defined in the Unity scene in the editor, I'll have to be able to look up the corresponding actor's data within my persisted data, and reapply that state to the actor. One of my main struggles here is being able to identify which set of data goes to which actor, since the actors in the Unity scene often just have generic names (like goblin) so there's no way to tell instance A from instance B. I thought about doing something like creating a PersistentData object that I can assign to each actor, and have the PersistentData object generate unique GUIDs for each actor. But for something as common as saving/loading scene state, I don't want to write a bunch of custom logic if there's already something built in that'll do what I want.
The second problem I'm having is that for actors that were dynamically added to the scene, I'll have to write some code to recreate them after loading the scene. Again, if there's already a built-in or accepted way of doing this, I don't want to write a bunch of code and reinvent a bad facsimile of an existing wheel.
My actors are all derived from MonoBehaviour, so I can't serialize them directly.
Is there an existing way within Unity to do this, or is there a commonly accepted way of handing this scenario?

Anti-Cheat / Glitch in game

Currently I am working with a team on a Unity-based game. The game is still in development and alpha version.
Recently, we saw that the game was vulnerable to Cheat Engine, speedhack etc. Updates after updates, cheats are now stable. We also introduced the ACT or anti Cheat Toolkit of Unity. As the game is Unity-based, it is easy to implement ideas in the game.
Though "hacks" are stablized, "glitches" are not.
This is an open world Survival game and it consists of picking/dropping items. The glitch is that when two players pick the item together, (currently you have to press E while the crosshead is over the item to pick it up) the item gets duplicated. We have been working DAYS to fix it, but no fortune.
We introduced that a player cannot pick up an item when there is another player nearby. It looks odd and we want the game smooth. We also tried auto pick up item. That's our plan, but are there any more ideas what we can do?
If your concerns are players cheating by modifying memory values, as well as maintaining a synchronized game state to avoid problems like item duplication, you should look into setting up an authoritative server that will contain and update the "official" values and state of the game.
Basically, rather than storing values and performing actions directly on the player's computer, the game will send a request to the server of what it wants to do, and the server will perform the actions, update the official game state, and send the new state back to the player so their game is updated.
This will prevent memory editing because even if a player modifies a value on their screen (such as currency or health) the server contains the true value.
It will also prevent exploits like speedhacks, because rather than having the local game directly move the player when a key is pressed, the keypress will just send a movement request to the server, which will update the player's position, and send back the new position.
Finally, this will prevent item duplication, because when both players attempt to pick up the item, they will both send an item pickup request to the server. Whichever player's request arrives first will receive the item, then the server will update the game state so that the item is no longer on the ground, and the second player's request will be ignored, because the item they're trying to pick up no longer exists.
Simply put, the best way to prevent cheating is: Don't store important values or perform important actions on the player's computer.