edited July 2017 in ORK Support
Hi there,

I'm new to ORK Framework and have been playing around with it the past couple of weeks. I'm currently working on building a basic 2D top down scene with the player and an NPC who, when talked to, becomes irrationally angry and starts a battle with the player. Everything works fine, except for the fact that two instances of the NPC are spawned when the battle starts. It's notable that they're not exactly the same: one is the NPC prefab, whereas the other is a game object based off of the NPC prefab (which is what the player is talking to in the first place).

For reference, the non-prefab NPC has an event interaction component (for the dialogue event) as well as a battle component (to start the battle when a specific dialogue is chosen by the player).

I'd be happy to provide any additional information that may help solve this problem.

Thank you in advance.
Post edited by thall on
  • The battle is spawning the enemy it needs, since the NPC is not a combatant/enemy. There are multiple ways to solve that, e.g.:
    - make the NPC a combatant (e.g. in the event by using an Add Combatant node) and start the battle with the NPC instead of a battle component
    - hide the NPC game object before starting the battle

    The 'natural' way would probably be to make the NPC a combatant in battle, so you could also seamlessly have it run to its battle spot, etc.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited June 2017
    Hi GIL, thanks for your help so far.

    Like you suggested, I've made the NPC a combatant by using the Add Combatant node, and once the battle scene is loaded there is now only one enemy, solving my previous problem.

    However, I've of course run into a few more problems. Firstly, after the battle scene is loaded, both the NPC-turned-enemy and the player rotate once placed at their battle spots, thus making them invisible (since it's a 2D game). I'm assuming this is caused by a Look at Enemies setting, but I'm pretty sure I've disabled all of the ones I've run across. Could it be something else? Or is there a hidden setting I'm unaware of?

    Furthermore, I want to place my player and enemy on the ground once the battle scene has been loaded. It works perfectly for the player, but doesn't work for the enemy because it's Rigidbody2D component is in a kinematic state (necessary as I don't want the enemy moving when the player runs into it during the previous "dialogue scene"). I thought I'd be able to simply change the "body type" field of the component using the Change Fields node. However, I get the following error: Property change failed: bodyType failed to convert parameters. What am I doing wrong? Is there another way of accomplishing this? Or should I just write some code to do it?

    For reference, here's how my Change Fields node is set up.

    Sorry for the long winded post. Been trying to figure this out for hours with very little success.
    Post edited by thall on
  • I think this is coming from the automatically created battle component (from starting the battle with the combatant instead of a battle component). Newly created battle components have Look At Enemies enabled, I'll change that in the next update :)

    As for the Rigidbody2D issue - bodyType isn't a string, it's a RigidbodyType2D enum value. I'm not sure if it'll work, but you could try setting it as an Int, dynamic is probably 0 as an int.
    Otherwise you'll either have to write a small component with a function to change that (which you can call with the Call Function node) or use Makinom, which has more advanced reflection functionality.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks for adding that in the next update! I'll try to figure out a workaround until it comes out.

    Also, setting bodyType as an integer equal to 0 (for dynamic) totally worked!

    Thanks for all your help, I really appreciate it!
Sign In or Register to comment.