Returning to ORK Framework, but this time, in glorious 2D!

Trying to figure out some oddities that I'm certain are gaps in my understanding.

I'm using Unity Tilemaps, so I have a Grid object and then 2 tilemaps within, One is called Ground and the other called Obstructions. My custom Player Controller checks for Obstructions and doesn't let you move through them.

I'm trying to set it up so I have a field map where enemies spawn and move towards the player, and then there's towns you can walk into.

1) How do I spawn enemies on the map that will trigger a battle on a different map when you collide with them? I tried a Combatant Spawner, but this only sometimes spawns an enemy prefab, and the battle triggers well outside the 1 tile range of the enemy.

2) How do I setup my battles to that you can move and then attack on touch? For example, you have 4 action points, each move costs 1 AP, but attacking costs all of your AP?

3) How can I make it so you can walk into an NPC and trigger dialogue without having to press an interaction button?

I can share my project if needed, it only consists of what I've described here. I tried to follow the 3d "How to" tutorial but I have a feeling some of that does not translate to 2d.

Once I get these fundamentals down I think I'll be off and running. If you've ever played either Ultima 5 or Exile: Escape from the Pit, you'll have an idea of what I'm trying to put together here.

Thanks for reading.
  • I can try to help with some of this,

    1) The site actually has a great tutorial on how to do this very thing: orkframework.com/tutorial/gameplay/battle-in-a-different-scene/

    2) I'm not sure I understand this question sorry.

    3)Setup a Interaction Controller: orkframework.com/tutorial/howto/interaction-controller/

    Onto your Player Controller Prefab, you can then place a Event Interaction onto an NPC in your scene and have it set to start on Trigger Enter which will automatically start the event (display dialogue, start battle, etc) upon entering the collider.

    Hope that helps.
  • 2) I guess you'll want to check out the grid battle system if you want to do grid-like battles. Alternatively, you can set up the movement as individual abilities (moving up, down, left, right, etc.) which each cost AP, using control maps to, well, map your controls to them :)

    3) That's up to the Start Type of your interactions. E.g. the Interact start type will start them by pressing the interaction key while it's in the player's Interaction Controller (and also by mouse click). If you want to just walk up to someone and start the interaction, use the Trigger Enter start type and add a collider (with Is Trigger enabled) on the interaction, large enough for the player to walk into.
    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 replying.

    1) I got half of this to work. I can transition into the other battle scene by following that tutorial. The part I can't get working is on the field map.

    Let's say I have a spider and I want to spawn him in somewhere and have him hunt down the player. On touch, it would then send us to the battle map. I can't figure out how to accomplish this. I tried the combatant spawner but it only creates the spider prefab sometimes, and then, the spider doesn't move. I set it with the default move AI. I would need him to move tile-by-tile like the player, as well.

    2) I'll give that a shot- is that something that would translate to opponents as well?

    3) I've been able to do this with the interaction button so I'll give it a shot with trigger enter.

    Thanks for your replies, much appreciated.
  • 1) For this you'll need to create a custom movement component. The combatant spawner just spawns the combatant, the move AI determines the movement target, but the actual movement is done by another component (e.g. a NavMesh Agent when using NavMesh).
    For such a tile-by-tile movement you'll need a custom movement component to move in that way.

    2) Hm, yeah - and you can use the battle AI (position nodes) to have the AI controlled combatants determine which way to move.
    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!
  • OK, that really helped put me in the right direction. My spider moves and the battle starts on contact now. :)

    One thing I want to implement, on the field map, is turn-based movement. All enemies are frozen in place until the player moves, then they move, then its the players move again. I've seen this programmed via things like GameManager singletons that maintain lists of active enemies on the map. Is there functionality in ORK that handles this kind of thing, or should I go towards the Gamemanager-type solution for this, and use ORK more to manage the combatant and battle aspects?

    Thanks again.
  • You'd need to implement such a roguelike system, either via custom scripts or e.g. using Makinom 2 (check out the roguelike tutorial).
    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!
Sign In or Register to comment.