Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
thenext2

Problem with RPC [PhotonNetwork]

Question

Hello everyone who reads this.I got problem it gives me error but i dont know why cause i dont see problem there or i miss something.

 

Error: PhotonView with ID 1001 has no method "TakeDamage" that takes 1 argument(s): Int32

UnityEngine.Debug:LogError(Object)
Please login or register to see this code.

closePlayer is from another function which detects closest player.

 

TakeDamage is function from another script.

 

damage is float.

 

Thanks in advance.

Share this post


Link to post
Share on other sites

27 answers to this question

Recommended Posts


  • 0
Please login or register to see this quote.

Because the error says damage is Int32, does the method "TakeDamage" take Int32 arguments? I think not.

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

I havent heard anything about Int32.

TakeDamage function:

Please login or register to see this code.

Share this post


Link to post
Share on other sites
  • 0

Int32 is a native type iirc. And the problem is obvious now, even though I dont know Photon, you're probably calling some method and passing it a variable. But your method in question doesn't even take one.

Please login or register to see this code.

So maybe put this instead?

Please login or register to see this code.

holy cow! there aint even a declaration for "damage" and you're happily using it?

Edited by DaKocha
  • Like 1

Share this post


Link to post
Share on other sites
  • 0

It seems to me that Health or Damage values are integers - not floating numbers.

See if you have the same state for these values - or integer, or float. Maybe this is your problem...

You need to declare them ++

  • Like 1

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

i changed Health to int Damage is also int

Please login or register to see this code.

i got no error but damage is not taking of health

Share this post


Link to post
Share on other sites
  • 0

done with something like this:

Please login or register to see this code.

Everything is working now thank you guys for help.

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

Glad you solved your problem :) but the dude is essentially taking random damage points, which might be unwanted?

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

I actually wanted it to be like that but i think those numbers is way to crazy.

Edited by thenext2

Share this post


Link to post
Share on other sites
  • 0

Hrmm... do me a favor and tell more about this hScript from where you initially tried to take the damage value.

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

:)) Its my health script nothing special.

Share this post


Link to post
Share on other sites
  • 0

Wow.. I'm starting to think that you could get rid of that argument from the calling line and from the method too. Optimization? lol

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

I think game is not ready for optimization it still need to touch few things

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

And how are you doing it without RPC ? the one im aware it would make no sense to leave RPCs and do all in the other place

  • Like 1

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote. I would like to see your game (video, demo).

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

Every single thing is sent through

  void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)

Basically

Entering a car?

Local player: Press to enter.

Remote Player: streamed > Get Transforms inside stream > Sends message to place character in car > Start car

Killing players?

local player: Shoots player > Raycast gets Object > Object is set in Transforms Hits

Remote Player: Receives hit objects > Applies Damage to objects from weapon in use.

Opening doors?

local Player: Open door > Raycast Gets Object

Remote player: Receives Object > Sends Open door to Remote Object

[RPC] = Message sent over Server. 

stream = 1/16 Message sent over server.

For every 30 Streams = 1 msg.

500 Msgs = 15,000 streamed messages.

 

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

There are still some bugs im working on but this system has turned out to be very sound. Will post a video once all bugs are look at and fixed

Remaining issues

Constant Player Damage

Constant Vehicle Starting 

Share this post


Link to post
Share on other sites
  • 0

First its better o get things working and then worry about optimization fellow junky.
If you guys need any help or have questions feel free to ask.

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

This is true and is something we are looking to Fix. in a matter worth using of course.

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote. another key area that wastes performance in networking is the header of the packet. Photons headers are huge and filled with all this crap. Minimizing the headers and there you go... The fastest networking solution: Forge ;) You should check it out, if you do contact me because Im using it too and we can help each other out.

Share this post


Link to post
Share on other sites
  • 0

@MyIsaak i think you are mistaking something, packet header cant be change, its constant, it contains about packet data itself, host, count, target and some other data. Thats why it makes sense grouping data if it can be grouped. udp contains less data in the header and is not verified (send and forget) than tcp, thats why its faster if it receives target. Thats why networking standard UDP and TCP exists, if everyone would create their own headers that would be a mess

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...