Networked Game crashes when Calling a Replicated Custom Event

Hi ! In my game you can equip items from a item struct. The Item struct of the equiped item is set to replicated. Each time i equip or unequip a item a custom event gets fired that is set to “Run on Server”. This is where the game crashes. If i run the game in singleplayer the crash will not happen. I can build the game with no error and the game does not crash when i equip a item. So it has to be a error in the editor.

Thats what is says in the Crash Reporter: http://pastebin.com/gQf0fqsy
Diagnostics.txt : http://pastebin.com/5DXM3Kun
GAMENAME.txt : http://pastebin.com/5zVT3g7i

EDIT: Here is my code

This is where it starts. The Player selects a item to equip and the slot has all the needed information for it:

72595-begin.png

Then the system equips the item

This is where i check if the item is already equiped or not. If it is equiped change it to nothing

And this is where the entire editor crashes.

72598-3.png

Show your code. And no, it doesn’t have to be an editor error. Not crashing in single player is a far cry from “it must work in multiplayer or its the editor’s fault.”

The Standalone build does not crash in multiplayer. I will update my post with my code

That does seem to suggest an editor problem. Maybe.

updated my post

If you disconnect the nodes in your network item equip event, it doesn’t crash?

no. If i untatch the itemstruct it dosent crash ether. I had this problem before but fixed it by removing the itemstruct entirely and readding it. After that i modifyed the level and the problem was back again. I dunno if unreal just cant replicate item structs or not.

nevermind it still crashes with or without the item struct. o.O It MUST be a problem with the networkevent

You should be able to. I do it all the time in c++. What I will suggest, which may fix your bug and improve the security of your game, is to change where and what you send to the server.

Currently, you’re doing all of your equip logic on the client and then just telling the server the result. I suggest you change your On Use function to a server event. Then you only need to replicate a slot id and you get the opportunity to tell the client what he’s doing isn’t allowed before he does it.

You’d need to then set your equipped item and hold type values to be replicated (not with an event, just regular replication.)

can i call a server event in a UMG widget ?

No. Only player controller, player state and pawn. Is all of your equip info in your hud?

Most of it. The inventory is client side. It dosent really matter to be honest because its a coop game. If they want to cheat they can. Things like Combat are managed by the server. I found out that my Itemstruct i causing the problem. I try to change it to only send the item ID

Fair enough. I have a similar view on co-op games. As long as there’s no central high score list or achievements or anything, what does it matter?

You could also not use a struct, but add all the fields of the struct to your event. It seems silly, but if it stops it crashing…

I fixed it now ! I only send the item ID now. It looks like that ue4 dont like replicated structs. I basicly send the ID to the animBP and the animBP gets the item struct using the id. I will mark the post as solved. Thanks for the help pal !