Hi, I've been working on a mod and I'm almost there, but I've gotten stuck on prompts and got no clue how to fix it up. I am using the ScriptHookRDRNetAPI. I'd really appreciate if someone could look over and point out where the issue lies.
Some notes to narrow down the issue:
Function.Call<string>(Hash._CREATE_VAR_STRING is where I think the issue lies but that's just assumption. _CREATE_VAR_STRING in NativeDB is shown as a const char*, but:
const char* gives an error: char* cannot be declared as a const (commented out)
Function.Call<char*> gives an error: char* cannot be used as an argument (commented out)
changing string to any other kind of variable, like a long immediately crashes the game upon reloading script.
targetEntity is 100% working, I have used it to check if I'm targeting specific models.
Function.Call<Hash>(Hash.GET_HASH_KEY seems to be working exactly the same as Game.GenerateHash( tested by comparing models, so I doubt that's causing any issues.
Both ShowSubtitle commands fire off with the current code, but prompt does not appear.
RDR2.UI.Screen.ShowSubtitle("Initialising");
Entity targetEntity = outputTarget.GetResult<Entity>();
int groupID = Function.Call<int>(Hash._UIPROMPT_GET_GROUP_ID_FOR_TARGET_ENTITY, targetEntity);
int basicPrompt = Function.Call<int>(Hash._UIPROMPT_REGISTER_BEGIN);
//const char* promptString = Function.Call<char*>(Hash._CREATE_VAR_STRING, 10, "LITERAL_STRING", "Prompt");
Function.Call(Hash._UIPROMPT_SET_CONTROL_ACTION, basicPrompt, Game.GenerateHash("INPUT_FRONTEND_LS"));
Function.Call(Hash._UIPROMPT_SET_TEXT, basicPrompt,
Function.Call<string>(Hash._CREATE_VAR_STRING, 10, "LITERAL_STRING", "Prompt"));
Function.Call(Hash._UIPROMPT_SET_PRIORITY, basicPrompt, 5);
Function.Call(Hash._UIPROMPT_SET_ATTRIBUTE, basicPrompt, 18, 1);
Function.Call(Hash._UIPROMPT_SET_STANDARDIZED_HOLD_MODE, basicPrompt, 1);
Function.Call(Hash._UIPROMPT_SET_GROUP, basicPrompt,groupID, 0);
Function.Call(Hash._UIPROMPT_SET_ENABLED, basicPrompt, true);
Function.Call(Hash._UIPROMPT_SET_VISIBLE, basicPrompt, true);
Function.Call(Hash._UIPROMPT_REGISTER_END, basicPrompt);
RDR2.UI.Screen.ShowSubtitle("Initialising finished");