Download

Item only usable by server? - help needed.

So I’ve made an item that you place in a dino’s inventory and it changes the dino’s color at whatever region by running the “settargetdinocolor” command. It works, perfectly… in single player. However, the instant I upload it to my dedicated server, the items stop working. By, doesn’t work, I mean the “Remote Use Item” button stays greyed out like the server is saying “Nope, don’t even try.” I’ve narrowed it down to these situations:
When the player is the host of a non-dedicated server - works
When the player is a client on a non-dedicated server - doesn’t work
When the player is on a dedicated server - doesn’t work
In UE4 as player 1 (server) - works
In UE4 as player 2 (client) - doesn’t work.

I’m sure I’m probably doing this completely wrong so some help would be appreciated.

First off, why are you using a custom event COPY of blueprint used instead of the native event? Should be this - c8a041320e911715a8bf778e6c30b01535d36f4c.png
Second, I have not done anything them but I’m pretty sure the execute console command needs a player controller connected to the “Specific Player” pin

Actually I’ve been tweaking the blueprint for two days while I waited for my post to show. The BlueprintUsed_Copy is because I duplicated a Mindwipe Tonic to try to understand how a consumable gets the inventory of whoever ate it. My new graph is identical but uses the regular Event Blueprint Used. Also, With the tweaks I’ve made, This item works a lot better now. All I really did was duplicate a berry blueprint and re-add the code. Now the item works on dedicated servers but the item now only works if an admin uses it. I uploaded it to a private dedicated server that I use only for testing. In the game, if I logged in and used the item without giving myself admin privilidges via “EnableCheats” the item doesn’t work. The item gets used but it doesn’t work. If I do give myself admin then use the item, it works as intended. Is there no way to force the script to run as admin?

If you’d like to specify whether the client or server should be executing a command, you should look at the “Switch Has Authority” node.

You’ve fixed the consumable portion, so the item is still being used, however you are using a literal cheat, which only admins have access to. I’ve never looked into it, but you could try looking into casting to the dino (owner of the item, IF IT’S A DINO), and setting a color region, as opposed to cheating the region.

Yea, I spent almost a full day talking with a bunch of people on the Discord channel. I managed to get the dino region changed without the need of being admin but it wouldn’t stay because the variable that actually controls the dinos’ color regions are stored in a static array and therefore we can’t touch them. So I’d have to make the item do the color change and then I’d have to give that dino a buff that changes the color every time the dino comes out of statis. Then I’d have to make it so that every dye would then “cure” the other dye before applying its own buff to the dino. I was hoping it would be something a bit easier than a huge project just to be able to change your dinos color. My wife wanted the mod and I told her I wasn’t going to put that much work into it.

I did try to get that working as well but it seems that Switch Has Authority can only be run from an actor, or at least, it can’t be run from a consumable because it won’t allow me to place the node and a copy/paste of the node causes an error.