Forum rules - please read before posting.

AdvGame.RunActionListAsset(name of the ActionList) , with parameters?

I have a script which uses the above AC special function but I would like to pass a parameter with it such as:








AdvGame.RunActionListAsset(toDoOnEnter,myTransform);
 where myTransform is the Game object where my script is attached to but I have not found in AC ActionList any way to recover that parameter.
Is this possible?


Comments

  • Neither one shows me how to read the parameter passed in the ActionList  . The script is correctly working with
    AdvGame.RunActionListAsset(toDoOnEnter,myTransform);
    I pass an ActionList in the inspector called toDoOnEnter but how do I see the parameter myTransform in the ActionAsset? (I used the CustomTrigger sample shown in AC Wiky)
  • I've gone further. I have configured my script with an integer number (Code)
    AdvGame.RunActionListAsset(toDoOnEnter,int Code);
    then I configure my 'toDoOnEnter' actionAsset with 'has parameter'
    Now in toDoOnEnter I want to compare the parameter passed with a variable an did this:
    Variable:Check
    Variable : codeNumber
    Compare with
    Equal to : (0)Parameter 1
    etc

    But the compare fails even thou both the parameter I pass and the variable are indeed the same.
  • edited March 2017
    Going back to your original question, you can use the ActionList: Check parameter Action to check a parameter's value.

    Passing a GameObject alone affects the first parameter defined in the ActionList.  See the scripting guide description of:
    AC.AdvGame.RunActionListAsset (ActionListAsset actionListAsset, GameObject parameterValue);

    When passing an integer to this function, you're actually setting the parameter's ID.  The parameter's value is set after that.  Again, see the scripting guide:
    AC.AdvGame.RunActionListAsset (ActionListAsset actionListAsset, int parameterID = -1, int parameterValue = 0);

    To set the parameter value of your 1st parameter (presumable ID = 0), you want:
    AC.AdvGame.RunActionListAsset (myActionList, 0, myNewParameterValue);

    These descriptions also appear in MonoBehaviour when you write the function names.
  • Coincidentally this morning (05:30) I found the solution too but your explanation clarifies it. I am now passing a GamObject as a parameter and it works, this saves me a lot of ActionAssets, variables, etc. since I have 15 doors each  performing an open/close Action and the  GameObject of the door is passed as parameter in the ActionList                                             
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.