x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Replication issue

Hey guys hope you're all well. Basically been working on a multiplayer game and have got everything work how i want so far bar one thing and its driving me slightly nuts. So basically im running a client and server testing the replications and i have a reload and magazine where you can see the bullets getting visibility toggled when fired giving the illusion there being shot out. when reload is hit the all get toggles back. Now my issue is the client can see the servers visibility toggles but not the other way around. the Server can not see the clients. I have ticked the replicated in the BP and set some custom events up. Any help would be most appreciated. alt text

Product Version: UE 4.12
Tags:
untitled.png (357.8 kB)
untitled1.png (332.6 kB)
more ▼

asked Jul 26 '16 at 11:42 AM in Blueprint Scripting

avatar image

Pantlessnoodle
21 15 16 20

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

cosmetic effects should not be replicated, they should be performed locally on all machines. so if CurrentAmmo is the variable that controls the state of bullet mesh visibility, CurrentAmmo should be a RepNotify variable, then you can use its onRep function to update the visibility of the meshes whenever the ammo count updates.

more ▼

answered Jul 26 '16 at 12:43 PM

avatar image

ScottSpadea
9.6k 320 205 449

avatar image Pantlessnoodle Jul 26 '16 at 02:11 PM

Thanks for the reply dude! So something like this?I made a integer and used that to add and subtract the ammo count and used it for the multigate index. Am i along the right track?

untitled.png (447.1 kB)
avatar image ScottSpadea Jul 26 '16 at 02:25 PM

as long as DeleteBall is called from the OnRep function of the CurrentAmmo variable, something like that should work, although i wouldn't use toggle visibility. instead i would use set visibility, just in case the visibility effect goes out of sync with the ammo state. also, i wouldn't use a multi gate for this, i would put the static meshes into an array, and use foreach loop to set the visibility. maybe DeleteBall should be renamed to HideBall, so its more descriptive of what its actually doing.

im not sure what the BulletRemoval variable is for, but it seems like a redundant copy of the CurrentAmmo.

avatar image Pantlessnoodle Jul 26 '16 at 03:00 PM

Great advice thanks very much, yeah the bullet removal was not necessary, im now using the CurrentAmmo float to drive the visibility, how would i go about setting up the array?

avatar image Pantlessnoodle Jul 26 '16 at 03:11 PM

Like this?

[1]:/storage/temp/100159-untitled.png

untitled.png (319.7 kB)
avatar image ScottSpadea Jul 26 '16 at 05:20 PM

now you can compare the array index of the foreachloop to the current ammo, so you can decide whether to set each bullet as visible or invisible. any of the static meshes in the array with an index greater than the current ammo, should be hidden.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question