BL Coding Help with Custom NameMarkers

Users who are viewing this thread

Tharos_PT

Recruit
Hi there,
I was trying to make my own Name markers, similar to what you can see below but with my own text.


I was trying to follow the code on MissionGauntletNameMarker (SandBox.GauntletUI.MissionGauntletNameMarker), where it looks that is initialized.
It creates a new MissionNameMarkerVM where it initializes the "Targets" (SandBox.ViewModelCollection.MissionNameMarker)
this.Targets = new MBBindingList<MissionNameMarkerTargetVM>();
On the first Tick, it will add each agent and relevant points to that array. And it will Update the Screen when the player click "LeftAlt"
foreach (MissionNameMarkerTargetVM missionNameMarkerTargetVM in this.Targets)
{
float a = -100f;
float b = -100f;
float num = 0f;
MBWindowManager.WorldToScreen(this._missionCamera, missionNameMarkerTargetVM.WorldPosition + this._heightOffset, ref a, ref b, ref num);
if (num > 0f)
{
missionNameMarkerTargetVM.ScreenPosition = new Vec2(a, b);
missionNameMarkerTargetVM.Distance = (int)(missionNameMarkerTargetVM.WorldPosition - this._missionCamera.Position).Length;
}
else
{
missionNameMarkerTargetVM.Distance = -1;
missionNameMarkerTargetVM.ScreenPosition = new Vec2(-100f, -100f);
}
}
My questions are:
1. I cannot use a Camera reference and it gets me always null. Maybe it is the base class?
2. That "WorldToScreen" really prints the text on that position? Or doesn't it used for that?
3. Some other way to do it? Because I just really wanted to print a message on one specific location and InformationManager doesn't do that for what I know.

Thank you for your attention

[UPDATE]
I got the Camera reference now. But still without print anything on the screen...
Still trying here

[UPDATE]
I tried the old "copy & paste" from the game's code but updating always the screen without the need to click "Left Alt"
Expectation: It appears automatically on the screen
Reality: I still need to press "Left Alt" and it will only show the corners...
 
Last edited:
Top Bottom