I am using MapMarkerGenericRadius to create a marker on the map, it is not rendered when the server is started, it will be rendered if I manually reload the plugin after the start. Any idea on what could be wrong ?
The code:
MapMarkerGenericRadius m =GameManager.server.CreateEntity("assets/prefabs/tools/map/genericradiusmarker.prefab", newVector3(0,0 ,0)) asMapMarkerGenericRadius;
m.alpha=0.8f;
m.color1=Color.green;
m.color2=Color.green;
m.radius=3;
m.Spawn();
m.SendUpdate();
Map marker not rendering with MapMarkerGenericRadius
Discussion in 'Rust Development' started by Lamego, Dec 11, 2017.
-
Look at my Map Block plugin.
-
@Kappasaurus So to get markers to spawn after a restart would that require _markers to be stored in a data file? I'm still learning but would that mean saving "player.transform.position" (as i'm printing markers via a /print chat command)
What would be the best way to save coordinates and then get _marker to spawn it from data? -
That is one method of doing to but you can probably save it with the map too.
_marker is just a private field. I'm respawning it every time a player joins. There's probably a better way to do that, you can look in the client Assembly-CSharp and see what actions are performed and probably just send an update. -
Kappasaurus, I did look into your plugin in the first place, but I was missing UpdateMarker called in the OnPlayerIinit. I have added it and now works as expected. Why do we need to Kill/Spawn/SendUpdate the entitiy on each player init ?
-
I am still having issues with the marker movement. Could someone provide a sample with:
a) A marker being created in the center of the map, on the server start
b) That same marker beeing moved to the a different position during game play
Thanks -
It seems it's only rendered if it's created while the player is connected. All you have to do is kill the marker and respawn it at a different location. If you do it rapidly enough you don't even need to redraw it when players connect.