Gp_talk_object problem

I have a problem that’s driving me crazy right now. I have a placeable that the PC is supposed to talk to. Normally, the gp_talk_object stock script works, but for some weird reason it doesn’t in this case.

What I have discovered so far is that if I place the PC really near to the placeable and then click on it, the conversation fires. However, if I click on it from a bit further away, the PC walks up to the object but stops just a tiny bit too far away for the conversation to start, and the star (or whatever it is) symbol on the action queue is showing, like the PC is trying to get close enough to the object but just can’t, until you as a player yourself clicks on a spot that is a centimeter closer, and then when you click the object again the conversation starts. How can one get around this problem. It’s driving me crazy at the moment.

@andgalf ,

Do you have another action fire prior the PC reaching the object with the conversation, which may be preventing the conversation from starting?

I had this happen a few times, and I was able to fix the issue either by moving the placeable just a tiny bit, or in the case of doors reorganize the walkmesh (moving some placeables slightly away, or rework walkmesh cutters then rebake).

@4760 - I tried with moving the placeable a tiny bit, but that did nothing. In this case the area is a bit cramped where the placeable is situated, and it’s on the invisible platform that I finally after so many hours trying, managed to get right with the walkmesh helper, so I don’t want to fiddle too much unless I break everything again.

@Lance_Botelle - No, I have no other action.

Guys, I think I actually managed to solve it now. Instead of using gp_talk_object, I removed that, and then I did my own script which I put on OnLeftClick and it actually seems to work:

// gp_talk_object - modified script
/*
	Script by andgalf. This script allows you to speak to an object that for some reason won't let you speak to it.
	Set a conversation, set Usable to True, and attach this script to the OnLeftClick event. Set a waypoint really close to the object. Do not use the stock gp_talk_object script on the OnUsed event in this case.
    The ClearPendingActions function by 4760.

*/

void StartTheConv()
{

	object oPC = GetFirstPC();
    ActionStartConversation(oPC);

}

void ClearPendingActions(object oPerson, object oWP)
{
	// just to make sure we're right on the spot
	if (GetCurrentAction(oPerson) == ACTION_MOVETOPOINT)
	{
		//SendMessageToPC(GetFirstPC(), "Timing issue!");
		AssignCommand(oPerson, ClearAllActions());
	}
	AssignCommand(oPerson, ActionJumpToLocation(GetLocation(oWP)));
}



void main()
{

 	object oPC = GetFirstPC();
	object oWP = GetObjectByTag("console_wp");
			
	AssignCommand(oPC, ClearAllActions());
	DelayCommand(0.1, AssignCommand(oPC, ActionMoveToObject(oWP,TRUE)));
    DelayCommand(1.6, AssignCommand(oPC, ClearPendingActions(oPC,(oWP))));	
	
	DelayCommand(1.7,StartTheConv());


}

I’ll see if I can modify this a little, by using your function @4760 for ClearPendingAction or what it was called. I just need to look at my previous modules and see if I can find that, so that the PC first tries to walk/run towards the placeable before jumping (if the walking fails).

Anyways, thanks for trying to help, both of you.

EDIT: Updated the script with @4760’s function. Works great now.

EDIT2: Updated the description of the script since it says to use it on the OnClick when it should be OnLeftClick.

@andgalf

So are you suspecting a pending action as the issue or not then?

If you are looking at “clearing pending actions”, then an action may be interfering. i.e. It sounds like you are adding another action, maybe in a heartbeat perhaps? E.g. You have something happening every six seconds and your pc clicks on the object to “talk”, but as it takes time to reach, the “other action” stops the talk instead, probably with a ClearAllActions. However, when clicked closer, your conversation manages to fire prior the ClearAllActions call, sort of thing.

This would fit in with the theory why your script works, because you intercept/override the other interfering action by forcing the conversation to start almost immediately.

For instance, this may also work …

void main()
{
	object oUser = GetLastUsedBy();
	AssignCommand(oUser, ClearAllActions(TRUE));
    AssignCommand(OBJECT_SELF, ActionStartConversation(oUser, "", TRUE, FALSE, TRUE));
}

EDIT: Looking at your solution, the problem is another action interfering. You have a couple of options …

  1. The script you currently list as a solution will assume 1.7 second “travel time” from location to object before starting the conversation. This may possibly add an unintentional delay if the player has already walked up next to it without yet clicking on it.

  2. The small script I post should start the conversation straight away from location of click. (Untested.)

I would be interested to know if the script I suggested works, as it will at least confirm your issue or not, irrespective of the one you use. :slight_smile:

NB: Script corrected.

@Lance_Botelle - Just for the sake of it, I also tried your script but that didn’t work in this case.

Nope. I have no such scripts here. This is just a normal player character with all the scripts that come with that.

Anyway, it doesn’t matter since I found a solution with my own script. The thing is the PC needs to be close enough for the conversation to fire. That’s the issue, I believe.

NB: I updated the script.

Alright. I can try that too, but I’m quite sure it won’t work here either.

EDIT: Exactly as I thought. Didn’t work either. It has to do with being close enough to the placeable and nothing else, I believe.

1 Like

@andgalf

How strange? I know you have your issue sorted, but unless you are trying to start from a very long way away (beyond the conversation limit I believe), then this should have worked.

It is something I would like to have pursued, but as you say you have it sorted to your satisfaction, then I’ll leave it with you.

Thanks for testing anyway.

EDIT: I use this method to start conversations with my own placeables, and it has never failed, which is why I am interested under what circumstances you have managed to make it fail.

Ahh! My bad, I just realised the edit had not shown … It should be this …

void main()
{
	object oUser = GetLastUsedBy();
	AssignCommand(oUser, ClearAllActions(TRUE));
    AssignCommand(OBJECT_SELF, ActionStartConversation(oUser, "", TRUE, FALSE, TRUE));
}

@andgalf

My bad, I missed a parameter change, which will make all the difference for you … the one that tells the game to ignore distance. So sorry about that … If you wanted to try this one, it should work for you, but only if you get the time for testing sake. :+1:

void main()
{
	object oUser = GetLastUsedBy();
	AssignCommand(oUser, ClearAllActions(TRUE));
    AssignCommand(OBJECT_SELF, ActionStartConversation(oUser, "", TRUE, FALSE, TRUE));
}

As I say, I use this one all the time and it NEVER fails.

The advantage is that it does ignore distance and you can make the PC walk up to the object on the first line of the conversation anyway.

I have already tried the ignore distance thing. That was the first solution I thought of, but that did nothing for some reason in this case. Normally gp_talk_object never fails for me, but I have had these weird instances before, just like 4760 spoke of, but not that I couldn’t solve it by just fiddling around a bit. This time it was extreme case, really weird, but I’m glad I found a work around for this particular case.

1 Like

@andgalf

Actually, in this circumstance then, I have a theory that may explain your situation, as it has happened to me too …

At some point the placeable may have been turned into an “environmental object” and then converted back again. This, for some reason, stops the “placeable” from working as expected. I have had this exact problem you speak of (PCs fail to approach), and it turned out to be that the placeable I had been trying to work with, I had previously switched it to an environmental object and then back again (forgetting I had done so at first). After I replaced the tampered placeable with a new fresh placeable (that was never an environmental object) it worked fine.

Perhaps in your case too?

@4760,

Are you able to tell if there are any significant changes made if a builder turns a placeable object from a placeable to an environmental object and back again? i.e. Compare the changed one to an original? It’s something outside of my league; all I see is the results after a change.

@andgalf,

The same thing can also happen if the placeable is too close to another placeable object (inside its interaction zone). Another possibility. Although this tends to affect the movement to the object rather than the script firing in the first place. So it may be a combination of little things missed during some testing.

This could be it then. Yes, since this is a weird area (very hard to make it look “right”), the bridge of a space ship - I won’t get into the details - I had to switch back and forth a lot with environemental objects and placeables being the one or the other. I’m not sure if this was the case with this one though, but it could very well be so. I’ll try and switch to a fresh new one and see what happens.

OK :+1:

Another test (if you are like me and want to know how to avoid this completely in the future, which is always a good idea), is if this makes no difference, (re my second point) try moving the placeable well clear of any other placeable and see if it still works or not …

In both tests, be sure to use the bIgnoreStartDistance parameter TRUE with ActionStartConversation.

I didn’t notice any significant change, but I’ll run some tests and see if there’s something different before/after the conversion.

1 Like

I tried with a fresh placeable and there was no difference. I think I’ll leave this as it is now, as I have a good workaround. I don’t want to move the placeable more since the space is pretty cramped as it is, which I think may cause the problem in the first place. Now, I’d like to continue and see if I can somehow craft some sort of new story with the extremely thin premise I have for this, my fifth module in the series.

@andgalf,

OK, I have been doing a few tests to try to duplicate your issue so we can get to the bottom of it, because (as I say) I have seen something similar in the past myself.

Here is what I have found …

Using the basic script I posted above, the script DOES fire on all tested placeables that I tested with, and the conversations starts OK. I note that that still appears different from what you experienced, but maybe one of the other points will direct you to get to the stage I am testing at.

Secondly, even if the script does fire, and the conversation start, a PC can still be hampered on their movement to said placeable object if it is too close to another placeable object, even if we try to force them to move from the first node of the conversation that fires.

So, the system I currently have working that appears completely “safe” as it can be for the time speaking is as follows …

  1. Make sure a placeable is fresh. (Not changed to environmental and back.)
  2. Make sure placeable is not “inside” another by being too close to it.
  3. Use the script that ignore conversation distance.
  4. If 2 above is unavoidable, have PCs move to another placeable nearby to one with conversation by forcing movement to that instead in the force move node.

Understood. See point 4 above if you ever decide to look at this again.

I can appreciate the difficulty here. I am looking over my old PnP notes to convert some for my latest module.

Another thing to consider is when you change an object to environmental and then back to normal, its ‘current hit points’ property (among others) will be set to zero. The object must have at least 1 ‘current hit point’ to be interacted with.

Really good to know. Come to think of it, maybe that’s what caused this. I’ll take a look again in the toolset. Thanks, @travus.

@travus

Yes, I had this in my notes too, and was pretty much one of those elements I was alluding to. But thought there may be something else to it as well. :thinking:

i.e. When I said switch back to an original placeable, that should resolve it.