Jump to content

Recommended Posts

Posted (edited)

I have made some mods for rdr2, so I am familiar with the basics.However,  I really want to know how to make a prompt "bound" to a certain object group. Like it was done in the Hunting Wagon mod (link below), by making the "Hunting Wagon" prompt appear when you approached a campfire. I know how to create prompts and how to place them on certain coordinates, but I have no idea how to make them appear when you get near a player created campfire.

 

Edited by bolmin
Posted

You can attach a prompt to an object so that it shows when you interact with it. To get an entity's group, use _PROMPT_GET_GROUP_ID_FOR_TARGET_ENTITY. Then use  _PROMPT_SET_GROUP to give the prompt the group.

Posted

I tried many things but I can't make it work. I attached the code that I have written below. The prompt doesn't show up, I used the UIPROMPT_SET_ENABLE and SET_VISIBLE but still nothing. The hash I placed there was the player campfire according to the object scanner in the rampage trainer. What am I doing wrong?Screenshot_17.thumb.png.9e1933788d9ddfc03db01a3bc8221eb3.png

Posted

You need to pass the entity handle to _PROMPT_GET_GROUP_ID_FOR_TARGET_ENTITY, I am not sure if that's what you are doing. Try spawning a ped for debugging purposes and attach the prompt to it instead.

Posted

Could you use the clear method names instead of the hashed names? Otherwise its difficult to read your code.

Posted (edited)

The first thing I notice is that you disable your prompt at the end.

I guess it should look like this: UI::_UIPROMPT_SET_ENABLED(Prompt_Camp, 1);

 

Havent checked the rest yet, but those enabling methods are usually for toggling (0 is off and 1 is on).

Or did I misunderstand it?

Edited by HughJanus
Posted

 I didn't show it but later in the code both SET_ENABLED and SET_VISIBLE are set to 1. I don't know why in this example I disabled it at the end

Posted

Have you gotten any prompt to work this way?

I took a look at the uiprompt methods available and the first one is this (maybe you need to create one before registering?):

_UIPROMPT_CREATE

Posted

I created prompts with this method before and they worked fine, but I never used GET_GROUP_ID and SET_GROUP to get a prompt to show when you approach an object

Posted (edited)

Can you post a code snippet with which you already got prompts to work?

Edited by HughJanus
Posted

the code that works is exactly the same but without GET_GROUP_ID and SET_GROUP. also sorry for late response. 

Posted

Have you tried using the group ID with something other than the campfire? With horses or peds, for example. Are you getting valid IDs with the current method?

Posted

I noticed that when I put the group id for something that already has prompts attached to it (for example an interactable object in the shop, a tent or a horse hitching post) there is a scripthook errror and when I put it on something else it doesn't work

Posted

But doesnt the player campfire also have prompts assigned already?

Are you sure the campfire hash you are using is the correct one? Do you get a proper value back from the GET_GROUP_ID function for this hash?

Posted

Exactly, that is why I wonder how the creator of hunting wagon did it. I don't know if it is the correct one but I was looking through the objects list on this website and I tested it with all the campfire related stuff and it didn't work, then I used the object scanner from a trainer and used the hash from it instead . 

Posted

In the mod thread of hunting wagon I just asked if the source code is available - maybe the creator shares his/her code, then we will see.

How does the hunting wagon mod work? Do the prompts only appear when you approach the wagon from a certain direction? Maybe theres some trick to it.

Posted

Thanks for reaching out to him. In the mod when you approach a campfire a prompt shows up to call the wagon

Posted

Hi, some of the hunting wagon code isn't mine to share (menu base) and its a very bad learning resource tbh so I do plan on rewriting it some day and releasing it. But I'm more than happy to share any of the specifics of the hunting wagon part.

 

Looks like you had the wrong group hash, it should be 1754796591 (0x6898122F).

 

Exact code I use:

	wagon_menu_prompt = UI::_UIPROMPT_REGISTER_BEGIN();
	UI::_UIPROMPT_SET_CONTROL_ACTION(wagon_menu_prompt, GAMEPLAY::GET_HASH_KEY("INPUT_FRONTEND_LS"));
	UI::_UIPROMPT_SET_TEXT(wagon_menu_prompt, _CREATE_VAR_STRING(10, "LITERAL_STRING", "Hunting Wagon"));

	UI::_UIPROMPT_SET_PRIORITY(wagon_menu_prompt, 1);
	UI::_UIPROMPT_SET_TRANSPORT_MODE(wagon_menu_prompt, 0);
	UI::_UIPROMPT_SET_ATTRIBUTE(wagon_menu_prompt, 18, 1);
	UI::_UIPROMPT_SET_STANDARDIZED_HOLD_MODE(wagon_menu_prompt, 1704213876);
	UI::_UIPROMPT_REGISTER_END(wagon_menu_prompt);

	UI::_UIPROMPT_SET_ENABLED(wagon_menu_prompt, true);
	UI::_UIPROMPT_SET_VISIBLE(wagon_menu_prompt, true);

	UI::_UIPROMPT_SET_GROUP(wagon_menu_prompt, 1754796591, 0);

 

  • Like 2
Posted (edited)

Thank you for sharing the source it really helped me! Also thank you HughJanus for your help with the issue, much appreciated!

 

edit:  I am wondering, how did you get the correct hash for the campfire? I tried multiple tools and websites, but with the no effect as you can see.

Edited by bolmin
Posted
  On 6/9/2020 at 3:58 PM, bolmin said:

Thank you for sharing the source it really helped me! Also thank you HughJanus for your help with the issue, much appreciated!

 

edit:  I am wondering, how did you get the correct hash for the campfire? I tried multiple tools and websites, but with the no effect as you can see.

Expand  

 

Decompiled script https://github.com/stianhje/rdr3-decompiled-scripts.1232/blob/master/script_rel/interactive_campfire.c#L2654

 

https://github.com/gottfriedleibniz/GTA-V-Script-Decompiler

  • 3 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...