This may require scripting, but is it possible to have the sentence ignore certain types of objects? I imagine this would be accomplished using tags or checking if the object is an NPC, but I'm not quite sure if it's possible out-of-the-box or not. Here's an example: https://gfycat.com/SphericalUnhappyBullfrog - you can attempt to look at and pick up every hotspot, but are only able to attempt to talk-to the salesman or the clown.
This could be taken further for other uses, of course, but for my needs I'd like to keep the Talk To cursor from changing the sentence when hovering over non-NPC or tagged with a specific tag hotspots. Would this require hooking into the sentence building event?
PS: this is also used for the Give cursor: https://gfycat.com/DarlingComplexJunebug
This is interesting as Give-to is only permitted to the salesman, and not the clown. This would imply a need to check for either a pair of tags or specify the object in seperate ways (if the object can be talked to but not given to; good for joke talk-to objects you can like Chuck the Plant or Dead Cousin Ted or even Thimbleweed Park's water fountain, but not allowing Give-to as it would never be necessary to give a non-human object an item).
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
It would require scripting - essentially you'd have to disable a given Hotspot when an icon that it doesn't make use of is selected.
This can be done with the OnChangeCursorMode event, attached to a Hotspot, i.e.:
I do apologize, I'm getting an error:
http://pasteall.org/1460320
and without the first part: https://imgur.com/JCJe2Ui.png
I don't think it's possible, but can this script go on a scene object, or does it definitely need to go on each hotspot?
Try this:
As in, a single-scene Hotspot? You could adapt it for such, but unless you want it to work for all Hotspots (no need to check for a particular one), you'd have to define a List of Hotspots to check from. The above is just an example on one way to approach it.
Sorry, I meant can it go on a scene prefab rather than having to be fitted to every hotspot? There would always be a lot of hotspots that would have to be turned off, unless this script is actually working inverse to what I'm imagining it does, and it's actually turning off all the (human) hotspots except for the ones that should be shown when talk-to or give is selected?
Do I need to modify this to only ignore the hotspots when I have Give or Talk cursors specifically chosen? i've put this exact script on a hotspot and it's still showing a give sentence when I hover with a item selected.
And this definately needs to go on every hotspot that I want to ignore sentence building for? I'm not sure if you said it could just go once on single a scene object and I could ignore the hotspot if it had a talk-to interaction defined or a tag or some such?
This script only disables the Hotspot if the cursor is set to a mode that the Hotspot doesn't have a Use interaction for. To have it ignore inventory items as well, you'd want something like this:
See the third line - it gets the Hotspot component its attached to, so this script needs to go on the Hotspot itself.
You can, of course, adapt it to go on a single GameObject - this is just an example. Get it working for one first, though.
Okay, I understand now; I don't mind keeping the hotspot always on except if
So here's what I have so far:
`void OnChangeCursorMode(int selectedCursor)
{
Hotspot hotspot = GetComponent();
selectedCursor == 1
is Talk-to cursor,selectedCursor == 4
is Give-to. So, I need to add into the firstif
statement a check if the hotspot has a talk-to interaction defined (or a person tag, but since I only have one tag per hotspot, it might be more efficient to just check if the hotspot has a talk-to interaction defined) but I couldn't find a way to reference if a specific interaction is defined or not.Then for the second
if
statement, I just need to add the same check if there's a talk-to interaction defined or not.Finally, do all the of scene hotspots need parsing into a list or some such in order for this to go on a single gameobject rather than being added to each hotspot manually? I'm not sure entirely how to do this, unfortunately.
I already provided you with this - GetUseButton.
This is a general Unity scripting question. Start here.
Sorry, I didn't realise you could define a specific interaction to check, GetUseButton's descriptive implied it checked the first set interaction. Using selectedcursor would be the apropriate way to check that just Talk-To was defined or not?
Oh, I see, I was assuming it could be done in the similar way other AC-interacting scripts could be places on a single scene object, but I think the one's I've used so far didn't interact with multiple items in the scene, but rather inventory items and such. I'll have to ask on the discord for help with this I believe, but it would go in the hook rather than update, couldn't it (for performance reasons)?
First available interaction for a given cursor ID - see the scripting guide's entry.
If you pass the selectedCursor variable (which if zero or greater will be the current cursor ID), and it returns null, then the Hotspot has no interaction for that cursor.
If you want to check specifically for Talk-to, ignore selectedCursor and just send the ID for Talk-to as set in your Cursor Manager.
In Start:
I'm not sure, all of the scripts I've tried so far gives me
or
Sorry, my fault! Here's the final working version! I tried to get the script working as a scene script, but I couldn't get
Hotspot[] allMyHotspots;
in the right place?` void OnChangeCursorMode(int selectedCursor)
{
Hotspot hotspot = GetComponent();
As I showed in the sample code, you keep it out of your functions. I can't give any more advice without seeing what you actually wrote.
Okay, here's the version that works on each hotspot: http://pasteall.org/1478179
I know I need
void Start () { allMyHotspots = FindObjectsOfType (typeof (Hotspot)) as Hotspot[]; }
and
Hotspot[] allMyHotspots;
goes outside of theOnChangeCursorMode
hook I think inpublic class HideGiveTalk : MonoBehaviour
) but I' not sure how to get all of thehotspot
references to work with this, or how to changeHotspot hotspot = GetComponent<Hotspot>();
so it works for all components in the scene.Please use Markdown when posting code - separate code from prose with a line, and give all code a tabbed indent.
Thank you, this is PERFECT!