Jump to content

Showing a prompt while near a campfire


bolmin
 Share

Recommended Posts

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 . 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

1 hour ago, 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.

 

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

Link to comment
Share on other sites

  • 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.

 Share

×
×
  • Create New...