I have has an issue with markers and I cannot figure out what is wrong with them. I may be missing something simple i am using this marker code (https://pastebin.com/nWdQCeMp) however, I can not see them in-game but I cannot recognise the issue. I have had them working on other places but sometimes they work and sometimes not. I got them working in my uploaded mission but any help as to why this isn't working would be great.
Any help would be great.
Be aware, markers need to be drawn every frame. If your code isnt running every frame the marker will only be drawn for a single frame.
I would need to see more of the code to understand the problem.
Also, SHVDN has its own implementation of drawmarker, it makes your code much more readable.
if (DrawMarkers) World.DrawMarker(MarkerType.UpsideDownCone, new Vector3(stashPos.X, stashPos.Y, stashPos.Z - 0.5f), Vector3.Zero, Vector3.Zero, new Vector3(1f, 1f, 0.5f), Color.Green);
@mcal9909 OK, thanks. Here is the rest of the code as you said it would help. Mission tab (https://pastebin.com/tXXD9gr6) Processing tab (https://pastebin.com/EZCP01uh). Also, thanks for letting me know how to make it neater. Just so you know, the code is not finished so there may be gaps in places.
Thanks for the help.
@Kieran_S Seems to be like the same condition needed to triger a marker being drawn is the same condition needed to move onto the next stage of the mission.
Marker is drawn if you are within 3.5m of the markers position.
Then further down you
task = Missiontask.pickupGuard;
So it looks like you are entering Missiontask.enterVehicle; and aslong as you are in the vehicle, you are leaving on the same frame. So the marker never gets a chance to be drawn.
I would sugest outputting the current state of
tasksomewhere so you can see what your code is doing.
@mcal9909 OK, thanks. I will give that a go as that makes much sense to me. Thank you for your help.
UIText debugText = new UIText("current task: " + task, new Point(10, 10), 0.4f, Color.WhiteSmoke, 0, false); debugText.Draw();
GTA.UI.TextElement debugText = new GTA.UI.TextElement("current task: " + task, new Point(10, 10), 0.4f); debugText.Draw();
make sure it runs every frame, outside of any of your tasks.
@mcal9909 OK. I only want the marker appear in the task it is in so it appears after I have spoken to Lester and then it disappears when the guard is in my pedgroup. Will that code still be good?
I updated the current marker code to this:
if (!missionVehicle.IsInRangeOf(guardMarkerPos, 3.5f)) World.DrawMarker(MarkerType.VerticalCylinder, new Vector3(guardMarkerPos.X, guardMarkerPos.Y, guardMarkerPos.Z - 0.5f), Vector3.Zero, Vector3.Zero, new Vector3(1.8f, 1.8f, 0.9f), Color.FromArgb(0, 153, 255));
So, if the mission car is more than 3.5f away from the marker pos then it should be there.
@Kieran_S Dont set
task = Missiontask.pickupGuard;until the player is in the marker and guard.PedGroup == player.PedGroup;
@mcal9909 OK, got it. Ill give that a go now. Thanks for the help.