Forum rules - please read before posting.

Unable to add MonoBehaviours to "Use Parameter"s in ActionList

Hi there,

I wanted to combine the action to speak a line with a speakers camera-switch, because both speakers have one for themselfs and the actionlist grows fast...

So I made an actionlist for this both actions but than I see I have to insert the IDs of camera and speaker. And the other ugly Thing for me: the String was not multiline.

So I made some changes:

  • - Enums.cs
I add _Camera and Char:

public enum ParameterType { GameObject, InventoryItem, GlobalVariable, LocalVariable, String, Float, Integer, Boolean, _Camera, Char };
  • ActionRunActionList.cs
around line 518 I add some stuff:

else if (externalParameters[i].parameterType == ParameterType.Char) {
localParameters[i].behaviour = (Char) EditorGUILayout.ObjectField ("Param Char:", localParameters[i].behaviour, typeof (Char), true);
}
else if (externalParameters[i].parameterType == ParameterType._Camera) {
localParameters[i].behaviour = (_Camera) EditorGUILayout.ObjectField ("Param Camera:", localParameters[i].behaviour, typeof (_Camera), true);
}

Comments

    • ActionParameter
    There I add a new member and override the setMethod:

    public MonoBehaviour behaviour;

    public void SetValue (MonoBehaviour _behaviour)
    {
    Debug.Log("Set Parameter Monobehaviour");
    behaviour = _behaviour;
    gameObject = null;
    floatValue = 0f;
    stringValue = "";
    intValue = -1;
    }
    • ActionCamera.cs
    • ActionSpeach.cs
    There I needed to change from GameObject to the specific Behaviours:

    parameterID = Action.ChooseParameterGUI ("Speaker:", parameters, parameterID, ParameterType.Char);

    parameterID = Action.ChooseParameterGUI ("New camera:", parameters, parameterID, ParameterType._Camera); 

  • edited March 2015
    That seems to work, I used the ActionEditor and all was fine.

    But always I start the Game, the inserted Monobehaviours just disapeared and went NULL.
    I think I missed something - is there a solution?

    ->>> Or maybe an easy way to extends the action "ActionSpeech" with an optional SpeakerCam? (That's what I had in mind at first...)

    Best Regards
    Ley
  • I can't bugfix your code if you've gone and modified AC, but what exactly are you trying to do?  The workflow you described before the changes sounds correct - though you can just drag the objects into the parameter fields, no need to enter in ID numbers.
  • Yeah, modify the Code is no good idea.

    I create a "sub"-Actionlist with 3 Parameter:
    - Camera (gameObject)
    - Speaker (gameObject)
    - TextLine (String)

    When I use this "sub"-Actionlist in the "Main"-Actionlist I have to put Camera and NPC by the ID.

    But I think I will work with IDs for the prototype. 
    AC is the only addon I have so far, maybe my Cutscenes are to big with about 100 Steps (devided into 5 Actionlists)...
  • I started out new because something is messing my whole project a litte...

    So here - maybe this is an idea for an extention of the Cutscenes.
    It's just a start, but may be usefull...


    image
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.