[ QUESTION ] SetNetworkIdCanMigrate

void SET_NETWORK_ID_CAN_MIGRATE(int netId, BOOL toggle);

this native, what does it actually do when it said

Whether or not another player is allowed to take control of the entity

But i want to ask that, if first, the netid was 15 , and after that when it migrates will the netid change to another number? or it would be the same number when I NetworkGetNetworkIdFromEntity

Thank you

somebody can answer me out about this?

Seems like you’re asking two questions here.

SetNetworkIdCanMigrate(15,false) will stop the entity with network ID 15 from migrating when done on the client that currently has control/ownership.
It basically stops the entity from having their owner changed. Note that this means the entity might disappear when it’s owner disconnects.

An entity has it’s network ID assigned when it is registered as a networked entity. To get a different network ID it will have to be destroyed (either completely or network-wise) and have a new network ID assigned. Unless you are doing that on purpose it is very unlikely to happen.

Network IDs are reused, however, so there is no guarantee that whatever was network ID 15 half an hour ago is still around and has the same ID.
For example, lots and lots of vehicles are created and destroyed every minute as the players move around the map. They all have a netID. If that netID was to be completely unique it would likely overflow the 16 bits (?) of storage for the netID very quickly, as 65535 isn’t really that high of a number.

1 Like

Thank you, you’ve answered me well, but one more thing

what if first, I’ve set the entity to mission entity? , will the netID be the same if the time passed away just like an hour or more

If it’s the same entity, then it’s the same entity, and will have the same NetID, unless otherwise instructed.

1 Like