Forum rules - please read before posting.

New update causes error in manual script

Hi everyone, it's been...half a year,
Finally got around to updating AC and I'm getting an error "error CS0117: AC.KickStarter' does not contain a definition forResetPlayer'"

Basically I integrated photon (sort of) into AC way back years ago, there's 2 characters and it'll spawn either one in depending on whether a game variable is set to use photon or not. Here's the script:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using AC;

public class Loadstore : Photon.MonoBehaviour
{
[SerializeField] private GameObject player;
[SerializeField] private GameObject player2;
[SerializeField] private Player SinglePlayer1;
[SerializeField] private Player SinglePlayer2;
[SerializeField] private Transform spawnPoint;

// Use this for initialization
void Start () {
if (AC.GlobalVariables.GetBooleanValue(252,true)) //is multiplayer on
{ //if it is turn off ac and connect
AC.KickStarter.TurnOffAC ();
PhotonNetwork.ConnectUsingSettings ("v1");
}
else //if it isnt spawn as usual
{
if (AC.GlobalVariables.GetBooleanValue(156,true))
{
AC.KickStarter.ResetPlayer(SinglePlayer2, 133312, true, spawnPoint.rotation, true, true, true);
}
else
{
AC.KickStarter.ResetPlayer(SinglePlayer1, 133312, true, spawnPoint.rotation, true, true, true);
}
}
}
public virtual void OnConnectedToMaster() //and then continue to spawn player
{
PhotonNetwork.JoinOrCreateRoom ("store", null, null);
}
public virtual void OnJoinedRoom()
{
PhotonNetwork.automaticallySyncScene = true;
KickStarter.saveSystem.SaveCurrentPlayerData ();
AC.Player.Destroy (AC.KickStarter.player.gameObject);
//put check player thing here
if (AC.GlobalVariables.GetBooleanValue(156,true))
{
PhotonNetwork.Instantiate (player2.name, spawnPoint.position, spawnPoint.rotation, 0);
}
else PhotonNetwork.Instantiate (player.name, spawnPoint.position, spawnPoint.rotation, 0);
AC.LocalVariables.SetBooleanValue (0, true);
AC.KickStarter.TurnOnAC ();

}

}

So as you can see the ResetPlayer thing is crutial to the game but I'm not sure what to replace it with

Thanks!

Comments

  • edited June 2020

    The API notes for version 1.71 say that:

    Changed: KickStarter's ResetPlayer function has been removed - set the value of KickStarter.player instead to manually change Player

    Hope that helps?

  • AC.KickStarter.player(SinglePlayer2, 133312, true, spawnPoint.rotation, true, true, true);

    I get "error CS1955: The member `AC.KickStarter.player' cannot be used as method or delegate"

  • Try:

    AC.KickStarter.player = SinglePlayer2;
    
  • Still getting the same error aha

  • The exact same?

    The player-assign system has changed a lot with v1.71, to allow for more robust handling of multiple player characters (player-switching, not multiplayer). It may be that your script needs further changes to accommodate, but the error message shouldn't be the same.

  • Well, i've managed to get rid of that error but its completely screwed up the game. When I load its now loading the wrong player in all my scenes (and when i look in the hierarchy its not there so i cant play its only the camera), another wrong player also spawns but falls through the ground, it gets stuck on the onstart cutscene and I can't view any actionlists in run time the UI is just blank (and I cant figure out which action its stuck on because of it)...hahaha i'm going to assume I've been out of the AC world for way too long and my project has just become incompatible as time went on...i'm just gonna restore my backup and stay with that version :D Thanks for helping though!

  • The key change with the new system is that starting data is now set for all players listed in the Settings Manager. If other players are spawning it's likely that they're using the default position at scene 0. If you do attempt switching to the new system again, see this video that explains the new workflow and changes.

  • I think a big issue is, with the previous method I would need to have a dummy character in scene for it load correctly/run my manual script and then it would get swapped out manually with the 'real' player with ResetPlayer script (which also overrided the default player set in AC settings as it would vary depending on whether it's running multiplayer AND the current character).

    I have: Single Player Character 1 (girl)
    Single Player Character 2 (boy)
    Multi Character 1 (girl)
    Multi Character 2 (boy)
    So 2 characters but there's a prefab version for single and multiplayer.

    But with this new change the dummy isn't getting replaced anymore and the game is claiming it's controlling the one I replaced it with in my code, but the default AC player has also spawned in too whereas beforehand it wouldn't (or it got replaced with my script before it could).

    So basically I'm running single player: my dummy player is still in scene, the default one in settings (Multi Character 1) has spawned and the one that I set it to in my code (Single Player Character 1) isn't in scene but AC claims that's what it's controlling. It's a bit of a mess. :D

  • Sorry do you have any ideas about this? Is there any information I can give you?

  • I'm not knowledgable enough on mutiplayer to offer much, I'm afraid. You're also dealing with a lot of manual/custom scripts that I'm not aware of.

    What's the core reason you need to have a "dummy" character in the scene to swap with the real player?

    It sounds like it may be best to stick with the older release/workflow, but I'd imagine that you'd need to stick more closely to the new workflow if you wanted to make use of it.

    The latest release allows inactive Players to be present on the screen and essentially acts like NPCs. See the video I linked to - inactive Players can still be have their position/scene changed using Actions or script.

    If - rather than having dummy players in the scene - you instead assigned each of those four charcters in the Settings Manager, I wonder if you could instead just set the current Player from there, and use custom scripting to position the other multiplayer as an inactive player.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.