Topic: Character follows another

I’m trying to make a character who has a dog follow them around in the background when they move. The dog doesn’t do anything except move when the character moves. Any advice on how to make the dog?

Share

Thumbs up Thumbs down

Re: Character follows another

Im actually trying to do this as well.
Currently no way to do it without coding changes.

Its possible to have the dog just appear as an assist to do his attacks. But having him always on the field isnt currently possible

Eternal Rift Studios
    Current Projects:
         Destined Soels
Always happy to help when possible. If its something pretty minor ill just help you out. But i do commissions as well. Hit me up if you need a commission.

Share

Thumbs up Thumbs down

Re: Character follows another

Should should I ask about this on the Source Coding page?

Share

Thumbs up Thumbs down

Re: Character follows another

Would probably get more traction there.

Id probably figure it out if id source and was working on that particular character but im not even close

Eternal Rift Studios
    Current Projects:
         Destined Soels
Always happy to help when possible. If its something pretty minor ill just help you out. But i do commissions as well. Hit me up if you need a commission.

Share

Thumbs up Thumbs down

5 (edited by shubi 2019-04-22 05:26:16)

Re: Character follows another

Hello.

If you have the Source-Version, it's very easy to add. You can simply read-out the player-variables and the positions of the players (see Documentation).

However, there is another way to add character-specific things, if you don't have access to U.F.E.-variables (I don't know how the basic-version works, so this solution is independent from all U.F.E.-variables). This solution might be "quick & dirty" but it works wink :

Let's say we want to add a dog following "Ethan" from the demo.


1. At first create or import your dog model. Create a Prefab from it.

2. Go to ressources/characters folder, select Ethan and open the Prefab. Add a new script and call it "Ethan":

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Ethan : MonoBehaviour
{

    public static Vector3 Ethan_Position; 
    public GameObject dogPrefab;

    // Start is called before the first frame update
    void Start()
    {
        Instantiate(dogPrefab, new Vector3(0.0f, 2.55f, 13.24f), transform.rotation);
    }
    // Update is called once per frame
    void Update()
    {
        Ethan_Position = transform.position;
    }
}

This script instantiates a clone of the dog-Prefab whenever an instance of Ethan is created. It also stores Ethan's current position in a global variable.

Now assign your dog-Prefab to the script (inspector window):
http://www.digitv4.de/s20games/screenshots_rw/dog1.jpg


Finally open the dog-Prefab and add a new script called "dog":

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Dog : MonoBehaviour
  
{
    Vector3 tempPos;

    // Start is called before the first frame update
    void Start()
    {
        tempPos = transform.position;
    }

    // Update is called once per frame
    void Update()
    {
        if (transform.position.x > Ethan.Ethan_Position.x) { tempPos.x -= 0.04f; }
        if (transform.position.x < Ethan.Ethan_Position.x) { tempPos.x += 0.04f; }

        transform.position = tempPos;
    }
}

This script updates the position of the dog according to Ethan's position.


That's how it looks like:
https://www.youtube.com/watch?v=7mDZHOP … e=youtu.be


My dog is a simple cube and a sphere. smile


This is only a quick start how you might include such things. You can put all the required things (animation controller, movement scripting etc...) into the dog-Prefab and code.
Of course you have to make sure, to destroy the clone after the fight and find a solution for dealing with player one and player two playing as Ethan.

shubi

shubi's Website

Share

Thumbs up +3 Thumbs down

Re: Character follows another

Thank you so much for the help!

Share

Thumbs up Thumbs down

Re: Character follows another

Awesome script! How can I get the dog assist to attack the opponent after I press an input button?

Share

Thumbs up Thumbs down

Re: Character follows another

Hey.

I think there is (or will be) some kind of built-in assist functionality in UFE. We don't use it, so I can't say how it works.

But you can do a lot of such things with simply reading out UFE global variables or create some work-arounds with particle-spawns etc. There are so may ways to implement interaction with background objects.

For example we modified our follow-me script to create a guy walking and filming with his phone:

https://youtu.be/bYxiemnIam8

Re: Character follows another

Assists are built in now under the section Character Assist and there is and example in the Source version... maybe Pro as well???

Share

Thumbs up Thumbs down

Re: Character follows another

Any suggestion on how to select your own assist character?

Share

Thumbs up Thumbs down

Re: Character follows another

What do you mean? You can select the character in the assist move section

Share

Thumbs up Thumbs down

Re: Character follows another

He means like select assist as a player.

Meaning every character can use said assist
Not just the ones who have it in move list

Eternal Rift Studios
    Current Projects:
         Destined Soels
Always happy to help when possible. If its something pretty minor ill just help you out. But i do commissions as well. Hit me up if you need a commission.

Share

Thumbs up Thumbs down

Re: Character follows another

Yes, it would be nice to figure out how it can be done.

Share

Thumbs up Thumbs down

14 (edited by MrPonton 2020-01-22 12:03:45)

Re: Character follows another

apollo wrote:

Any suggestion on how to select your own assist character?

It requires coding, and as such there's probably multiple ways you could probably do it.

One way off the top of my head is have an array of MoveInfo[] assigned to each assist selection on the character select, and then add that array to the playable selected character's MoveSet before the MoveSet is prepared on load once the battle starts.

Another way is to just have every possible assist added to each character, storing the selected assist character as a string on the character select, and adding logic to the Move Recognition method that determines which assist is allowed to be played in the match.

In another way, you honestly might even be able to use one of the event handlers in a script such as OnMove() which could allow you to implement the logic above about how to ignore any assist moves called that aren't of the assist selected on the character select.

Regardless, I think you should move your question to a new topic as it's different from the original post, and your reply may not be noticed by those who are willing to help further.

Share

Thumbs up +1 Thumbs down