RPG kit stop NPC from walking to talk
-
- Posts: 97
- Joined: Wed Sep 10, 2014 5:29 pm
RPG kit stop NPC from walking to talk
This is like the ARPG stork walks around, player clicks on him, he stops walking and you talk to him. I made a Store conversation on
a patrolling NPC, is anything different in RPG kit lite?
a patrolling NPC, is anything different in RPG kit lite?
- Attachments
-
- set_component_enabled_on_dialog_event.jpg (63.91 KiB) Viewed 2470 times
-
- set_animation_on_dialog_event.jpg (91.36 KiB) Viewed 2470 times
-
- Posts: 97
- Joined: Wed Sep 10, 2014 5:29 pm
Re: RPG kit stop NPC from walking to talk
This is the NPC, he's got humanoid avatar
maze element demon andres olivella
https://www.assetstore.unity3d.com/en/#!/content/2971
maze element demon andres olivella
https://www.assetstore.unity3d.com/en/#!/content/2971
Re: RPG kit stop NPC from walking to talk
Hi Terry,
I'll have to dig into RPG Kit's patrolling script, but as a guess (without having had a chance to dig into it yet) I'd think that the process you described would work. (Set Component Enabled On Dialogue Event and Set Animation On Dialogue Event / Set Animator State On Dialogue Event)
I'll have to dig into RPG Kit's patrolling script, but as a guess (without having had a chance to dig into it yet) I'd think that the process you described would work. (Set Component Enabled On Dialogue Event and Set Animation On Dialogue Event / Set Animator State On Dialogue Event)
-
- Posts: 97
- Joined: Wed Sep 10, 2014 5:29 pm
Re: RPG kit stop NPC from walking to talk
The scene in the examples is called "Patrol (root motion)"
http://unitycoding.com/icode/examples/
http://unitycoding.com/Unity/ICode/Exam ... itypackage
I also need a generic avatar to patrol, I can get them to move but they don't animate.
CC0 generic avatar model
https://dl.dropboxusercontent.com/u/102 ... itypackage
http://unitycoding.com/icode/examples/
http://unitycoding.com/Unity/ICode/Exam ... itypackage
I also need a generic avatar to patrol, I can get them to move but they don't animate.
CC0 generic avatar model
https://dl.dropboxusercontent.com/u/102 ... itypackage
Re: RPG kit stop NPC from walking to talk
Hi Terry,
The NPC has an Animator parameter named "Forward" that controls the forward speed. To make the NPC stop, you need to set Forward to zero. This script will do it:
StopOnConversation.cs
The animator controller in the patrol example uses Humanoid animation clips. To make it work for the deer (Generic rig), make a copy of the animator controller and assign the copy to the deer. Then replace the animations with Generic ones that match the skeleton of the deer. The animations have to match the deer because Generic doesn't retarget animations like Humanoid does.
The NPC has an Animator parameter named "Forward" that controls the forward speed. To make the NPC stop, you need to set Forward to zero. This script will do it:
StopOnConversation.cs
Code: Select all
using UnityEngine;
public class StopOnConversation : MonoBehaviour {
void OnConversationStart() {
var animator = GetComponent<Animator>();
if (animator == null) return;
animator.SetFloat("Forward", 0);
}
}
-
- Posts: 97
- Joined: Wed Sep 10, 2014 5:29 pm
Re: RPG kit stop NPC from walking to talk
Thanks, I was about to make an RPG kit conversation, only because I had a video and and an example. RPG kit is very powerful, but only
about 4 people 'get it', I'm not in there :--[
about 4 people 'get it', I'm not in there :--[
-
- Posts: 97
- Joined: Wed Sep 10, 2014 5:29 pm
Re: RPG kit stop NPC from walking to talk
This animator controller is pretty complicated, I put deer1_idle in the idle slot, but it doesn't work.
- Attachments
-
- robot_blend_tree.png (99.41 KiB) Viewed 2441 times
-
- deer1_idle_anim_in_animator_copy.jpg (78.25 KiB) Viewed 2441 times
Re: RPG kit stop NPC from walking to talk
Hi Terry,
Let's make sure the animation clip is working first:
1. In the Hierarchy, select your deer GameObject (the one with the Animator component). Make sure you can see it in the Scene view.
2. Press Ctrl+6 to open the Animation window.
3. From the dropdown menu, select deer1_idle and press play.
Does the idle play properly on the deer?
If yes, then let's move on to the animator controller:
1. Open your animator controller in the Animator window.
2. Double-click the Grounded blend tree state to drill down into it.
3. Select the starting node of the blend tree. Press the play button in the lower right. Use the sliders on the starting node to adjust the parameters so deer1_idle has all the weight.
Does the preview animation play properly in the lower right?
Let's make sure the animation clip is working first:
1. In the Hierarchy, select your deer GameObject (the one with the Animator component). Make sure you can see it in the Scene view.
2. Press Ctrl+6 to open the Animation window.
3. From the dropdown menu, select deer1_idle and press play.
Does the idle play properly on the deer?
If yes, then let's move on to the animator controller:
1. Open your animator controller in the Animator window.
2. Double-click the Grounded blend tree state to drill down into it.
3. Select the starting node of the blend tree. Press the play button in the lower right. Use the sliders on the starting node to adjust the parameters so deer1_idle has all the weight.
Does the preview animation play properly in the lower right?
-
- Posts: 97
- Joined: Wed Sep 10, 2014 5:29 pm
Re: RPG kit stop NPC from walking to talk
He idles, but I'm getting 'parameter turn and forward does not exist warnings. Rename the zip to unitypackage, you'll need the Icode default
unitypackage and the deer model posted above. It's the deer prefab, the scene, and his animator controller, just a copy of the robot's. Original scene is Patrolling (root motion).
On the patrolling demon- stopping when i click on him, he's not doing it, where does StopOnConversation.cs go in his hierarchy?
I notice moving scripts up or down breaks the prefab.
I got rid of the 'Get An Axe' (this must be what you consider tracking?) message on the screen by going to ? icon and click 'track', I guess
this disables the message? And 'tracking' would be 'You got an axe' when I get one. I tried to buy an axe from his store but Enemies killed me, have to try that again. ;--}
unitypackage and the deer model posted above. It's the deer prefab, the scene, and his animator controller, just a copy of the robot's. Original scene is Patrolling (root motion).
On the patrolling demon- stopping when i click on him, he's not doing it, where does StopOnConversation.cs go in his hierarchy?
I notice moving scripts up or down breaks the prefab.
I got rid of the 'Get An Axe' (this must be what you consider tracking?) message on the screen by going to ? icon and click 'track', I guess
this disables the message? And 'tracking' would be 'You got an axe' when I get one. I tried to buy an axe from his store but Enemies killed me, have to try that again. ;--}
- Attachments
-
- deer1_patrol.zip
- (18.21 KiB) Downloaded 195 times
-
- Posts: 97
- Joined: Wed Sep 10, 2014 5:29 pm
Re: RPG kit stop NPC from walking to talk
here's one with an attempted bird waypoint, doesn't work in air (navmesh in the air maybe?
https://dl.dropboxusercontent.com/u/102 ... itypackage
the deer only
https://dl.dropboxusercontent.com/u/102 ... itypackage
https://dl.dropboxusercontent.com/u/102 ... itypackage
the deer only
https://dl.dropboxusercontent.com/u/102 ... itypackage