Forum rules - please read before posting.

Cutscene + Send Message + Player

Is there an easy way to send a message to the Player in the scene?  The problem is that the Player is instantiated when the scene starts, so putting the Player in as the Object beforehand casts a null exception.

Is there another obvious way I could be doing this (in the cutscene)?

Comments

  • Okay, I came up with a half-baked solution.  Unfortunately I do not know enough about C# to actually build code, but I can copy paste like no tomorrow.  I'm more surprised it actually worked.

    I modified the ActionSendMessage.cs script as such:

    1.  Add "is player" conditional from dialogue actions, modify linkedObject to search for Player gameobject instead.  Not sure how else to do this better or how much it costs me, but it's only run in a cutscene.

    override public void AssignValues (List<ActionParameter> parameters) 
    if (isPlayer) 
    linkedObject = AssignFile (parameters, parameterID, constantID, GameObject.FindWithTag (Tags.player)); 
     }

    2. Added the same GUI conditional to hide the linked gameobject if "is player" is checked.

    if(isPlayer)
    {
    do this
    }

    else
    {
    rest of standard code
    }
  • Know that you can also have the Player prefab present in your scene before your game begins.  This will allow you to use him in the unmodified Action.
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.