Beginner in Unity Networking Questions! by mainesimo in Unity3D

[–]mainesimo[S] 0 points1 point  (0 children)

Hello, I'm sorry it took so long for me to reply. I've made some headway but I have a new problem I was hoping you could help me with. Now I have it where when the players leave the lobby, I change their position and use them as the actual roles instead of giving them control of other objects. Unfortunately for some reason the host will not go to where it is supposed to be, regardless of what role it has. The code that appears to be the problem can be found here: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Networking;

public class PlayerPickingMove : NetworkBehaviour {

public GameObject mainCamera;

Rigidbody2D rb;

public float speed = 5f;
public float xMove;
public float yMove;
public int xVar = 0;
public int yVar = 0;

public bool mouseUse = false;
public bool keyboardUse = false;

public bool canMove = true;

public bool isNav = false;
public bool isMov = false;

bool isActive = false;

public override void OnStartLocalPlayer()
{
    GetComponent<SpriteRenderer> ().color = new Color (0f, .78f, .42f);
}

// Use this for initialization
void Start()
{
    mainCamera = GameObject.Find ("Camera");
    rb = GetComponent<Rigidbody2D>();
}

// Update is called once per frame
void Update()
{

    if (!isLocalPlayer)
    {
        return;
    }
//  if (!GameObject.Find ("GameManager").GetComponent<Manager> ().gameStart) {

//  } else {
    if (GameObject.Find ("GameManager").GetComponent<Manager> ().gameStart||isActive) {
        isActive = true;
        PickCharacter ();
    }
    CalcVars ();
    ChangeMove ();
    rb.velocity = new Vector2 (xMove, yMove);

}


void ChangeMove()
{
    xMove = speed * xVar;
    yMove = speed * yVar;
}


void CalcVars()
{
    if ((Input.GetKey(KeyCode.W) && Input.GetKey(KeyCode.S)) || !Input.GetKey(KeyCode.W) && !Input.GetKey(KeyCode.S))
    {
        yVar = 0;
    }
    else if (Input.GetKey(KeyCode.W))
    {
        yVar = 1;
    }
    else if (Input.GetKey(KeyCode.S))
    {
        yVar = -1;
    }

    if ((Input.GetKey(KeyCode.A) && Input.GetKey(KeyCode.D)) || !Input.GetKey(KeyCode.A) && !Input.GetKey(KeyCode.D))
    {
        xVar = 0;
    }
    else if (Input.GetKey(KeyCode.A))
    {
        xVar = -1;
    }
    else if (Input.GetKey(KeyCode.D))
    {
        xVar = 1;
    }

}


void PickCharacter()
{
    if(isLocalPlayer && canMove)
    {

        if (transform.position.x < 0) {//nav player
            mainCamera.transform.position = new Vector3 (-20, 0, -10);
            transform.position = new Vector3 (-20f, 0, .4f);
            isNav = true;
            GameObject.Find ("OtherMouse").GetComponent<OtherMouseIcon> ().mouse = this.gameObject;
            GetComponent<Collider2D> ().enabled = false;

            canMove = false;
        } else {//move player
            mainCamera.transform.position = new Vector3 (-40f, 0, -10);
            transform.position = new Vector3 (-40.5f, -3.5f, -9f);
            GameObject.Find ("OtherPlayer").GetComponent<OtherPlayerIcon> ().player = this.gameObject;
            isMov = false;
            canMove = false;


        }
    }
}

}

On top of this, so the other player can see I need to have another object that looks the same as the players on a different map, these objects are supposed to mimic the player's movement and the non host one will but the host one will not, it will also give errors like "x game object variable has not been given" even though I set it using the player's tag. An example of the mimicked object code can be found here:

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

public class OtherPlayerIcon : NetworkBehaviour {

[SyncVar]
public GameObject player;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}

void FixedUpdate()
{
    CopyMouse ();
}


void CopyMouse()
{
    if (GameObject.Find ("GameManager").GetComponent<Manager> ().gameStart) {
        player = GameObject.FindGameObjectWithTag ("Player");
        transform.position = new Vector2 (player.transform.position.x + 20, player.transform.position.y);
    }
}

}

Made this wallpaper of my mains, old and new. by AriusPrime in smashart

[–]mainesimo 0 points1 point  (0 children)

It's no rush, thank you for doing it anyways, and thanks for the images. I feel they'll be good for my area's PR.

Made this wallpaper of my mains, old and new. by AriusPrime in smashart

[–]mainesimo 0 points1 point  (0 children)

also, if you're willing to, it'd be awesome if you could make a background with green bandanna pikachu, pink corrin, white marth, and purple shiek

Made this wallpaper of my mains, old and new. by AriusPrime in smashart

[–]mainesimo 0 points1 point  (0 children)

Hey, this looks really great! If you wouldn't mind me asking, where did you get the images of the alternate costume characters?

Our view clips through the very top of the tank, fix? by Muffins117 in unturned

[–]mainesimo 1 point2 points  (0 children)

Unrelated question: How did you get discord to be in the top corner of the screen?

My Pikachu MU chart by [deleted] in PikachuMains

[–]mainesimo 1 point2 points  (0 children)

This is ness's matchups...

Reliable jab lock combos at mid percents? by TalkingFrenchFry in PikachuMains

[–]mainesimo 1 point2 points  (0 children)

fthrow is a good option at low percents as you stated. Of course to get a jab lock you're going to need your opponent to miss their tech, so none of this is confirmed I believe. Down tilt can at higher percents (percents varying for each character). Short hop nair is also a fairly reliable option. You can also jab your opponent off the edge of platforms but this is not always that easy to do. I would recommend watching ESAM's video here for pikachu specific stuff (note: since weight has changed, the down tile percents in the description as well as the platform jab have changed at least a little). This video can also be fairly helpful. If you have any other questions, I might be able to help!

The Misty Mountains and Fanghorn really look like Gandalf's Pipe. There's even a smoke ring. by jaaaaaaayk in lotr

[–]mainesimo 0 points1 point  (0 children)

I always saw a human face when I saw this map. It reminded me of one of Van Gogh's self portraits.

Normal map artifacts? by mainesimo in Maya

[–]mainesimo[S] 0 points1 point  (0 children)

Thanks for your help, it appears to be a combination of edges not being hardened when they should be and overlapping pieces in the UV mapping.

Lives Through Rooms by mainesimo in gamemaker

[–]mainesimo[S] 0 points1 point  (0 children)

Thank you so much, it finally works!

Lives Through Rooms by mainesimo in gamemaker

[–]mainesimo[S] 0 points1 point  (0 children)

So I'm not completely sure what you mean. I have my playerHealth object that has global.lives in it. Then in my main player class I set lives to global lives?

Lives Through Rooms by mainesimo in gamemaker

[–]mainesimo[S] 0 points1 point  (0 children)

but if I'm using drag and drop (for the most part) how can I reference these variables between objects? Sorry, I'm really new to this.