Saltyq / ScriptHookRDR2DotNet

*this project is ABANDONED* An ASI plugin for Red Dead Redemption 2, which allows anyone to create scripts using any .NET language.
zlib License
92 stars 39 forks source link

TextElement only drawn after opening NativeTrainer #3

Closed Bob74 closed 4 years ago

Bob74 commented 4 years ago

When trying to show a text in game, it doesn't appear until I open NativeTrainer's menu. I guess some pre-requisites natives to show text might not be called by ScriptHookRDR2DotNet but having NativeTrainer to call them on opening the menu does the trick.

    public class Main : Script
    {
        TextElement _debug_text = new TextElement("Dummy", new PointF(500f, 100f), 0.5f, Color.Cyan, Alignment.Center, true, true);

        public Main()
        {
            Tick += OnTick;
            Interval = 1;
        }

        private void OnTick(object sender, EventArgs e)
        {
            _debug_text.Draw();
        }
    }
Saltyq commented 4 years ago

Working to fix this, noticed this issue last night

Thanks for the info!

Saltyq commented 4 years ago

This is an internal issue No script side workaround, it seems like DRAW_TEXT wont call from the .net hook until its called from a C++ script first (odd, probably something on AB's hook end)

Implemented a temporary fix in the next update, all I did was have the ScriptHookRDRDotNet.asi script draw an empty string at startup.

Fixed in next update.