ziggi / FCNPC

FCNPC - Fully Controllable NPC
Apache License 2.0
138 stars 31 forks source link

Fix a bug with surfing npc on objects #205

Closed 0x416c69 closed 4 years ago

0x416c69 commented 4 years ago

Why the fuck you would want to ever do that? It took me one hour to find that after seeing my objects are invalidated and getting overwritten

Also please remove FCNPC_SetSurfingDynamicObject and FCNPC_GetSurfingDynamicObject That's not how you implement a system

ziggi commented 4 years ago

Shut the fuck up and told me what is the fucking problem you have with this? Any fucking screenshots, fucking videos and fucking code samples are ultimately fucking welcome!

0x416c69 commented 4 years ago

Chill man, check your discord, the bug is obvious

ziggi commented 4 years ago

I have no idea why I made this. Thanks.

WoutProvost commented 4 years ago

So are you not going to share the explanation for other people?

Edit: So are you not going to share the fucking explanation for other people?

0x416c69 commented 4 years ago

That code simply fucks with Kalcor's shit code trying to find the next free index to place the newly created object at which results in overwriting the existing object and fucking with everything.

By the way that bug fix resulted me to do this https://youtu.be/S2FFK1M9Bbw I don't think anyone else have ever done that

WoutProvost commented 4 years ago

Oh now, I understand.

Are you using CreateObject or Player/Dynamic objects for the NPCs to surf on? I'm asking because I use Dynamic objects for an elevator on which an NPC stands when the object is moving up or down. Maybe I'm doing it wrong ...

0x416c69 commented 4 years ago

CreateObject for sure!

Yes, you're doing it wrong. Dynamic objects are as you just mentioned players object with different IDs for each player, function FCNPC_SetSurfingPlayerObject lacks forplayerid parameter.

In order to be able to sync surfing on player-wise objects, you need to send the sync packet for every player using their own object id.

The reason you are able to see it correctly is because your NPC's playerObject id is as same as your playerObject id and that'll not happen always, imagine a server with thousands of objects surrounding the NPC's area, not everyone's object ids will be the same then.

WoutProvost commented 4 years ago

Great explanation, I understand now, thnx.