Can't figure out how to transfer C2 Functions to C3 Functions...Help.

0 favourites
  • 8 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I purchased a Construct 2 template which has a function as an object.

    This doesn't transfer to Construct 3. I've been trying different ways, along with following Constructs blog on this, but nothing works.

    Here are some images. You can see C2 version had the function (P_Function (name)) as an object and could call upon different functions within ("Enemy_Got_Hit") and set the parameters. I tried creating both, but can't call upon them when picking a unique ID in the events. Anyone know what I am missing or what steps I'm missing to since functions are no longer an object in C3? Thanks

    Tagged:

  • Can you try it in C3 and then show us where it's going wrong? This is ancient now. If you are trying to apply things to an enemy on hit, now you call the function as an action and the enemy you hit remains picked inside the function.

  • The first two pictures are me trying to implement the functions in my first response.

    Here you can see I'm trying to call on the P_FUNCTION, but since functions can no longer be objects, I can't figure out how to manipulate them like in C2. You can see in the other images from the C2 version, the P_FUNCTION is there and in the actions I can manipulate what I need. I can add parameters, but when I try to do some of the add action functions, they aren't there. You can see in the images what I'm trying to accomplish, but am failing at. Thanks for looking into this.

  • Here is another example of me trying to pull off the functions from C2 to C3. I can't type in the P_FUNCTION (even though I created it) in the fields. It will automatically change it to P_KEYBOARD (which I named the keyboard).

  • I mean in general what are you trying to do with that function? It runs when the character is hit I guess? So you have an event 'bullet on collision with player' (or equivalent), then the function is called on the right as an action. In C3 you can right click on the function itself and you can add the parameters there. Then when you call the function in an action you will see the parameters where you can send player.health through or whatever you need.

  • I think I recall now you created the parameters on the function CALL in C2, but in C3 you do it on the actual function. That should help with at least one of the issues you're having. To choose the parameter in the action rather than use the old way function.param(0), the parameter name simply appears in the list and looks like a variable.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Okay. I'm getting closer. I had to break it down creating functions and then creating parameters by right clicking into the functions and naming them along with setting up the proper "type."

    I have the hero now taking damage and the life meter working. I just need to find the bug somewhere in the code as the enemy won't take damage...yet. Thank you for your help.

  • Looks like you used the wrong value in pick instance condition, should be the parameter instead of enemy_2d_scrolling.UID. I can't see the function call but I assume so from the logic. BTW you don't need that old condition anymore as they made an update so it keeps the picked instance through the function so it will be the same enemy that was picked on function call, just make sure 'copy picked' is ticked.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)