playMaker

Author Topic: [SOLVED] Finding reference to grid cell  (Read 1521 times)

tjarvstrand

  • Playmaker Newbie
  • *
  • Posts: 3
[SOLVED] Finding reference to grid cell
« on: December 18, 2016, 03:27:49 AM »
Hi,

I've just started Unity a littlel while ago and I'm trying my hand at making a turn based strategy game. I'm a developer by trade but I thought PlayMaker would fit the bill nicely anyway since most of the game can easily be modeled as a bunch of FSMs.

I've run into some trouble however and I'm trying to wrap my head around what the best practices are for what to do in scripts and how to interact with them.

In my scene I have a Grid game object, which has all the individual grid cells as children. I have a Grid script attached with a method that returns the cell corresponding to given coordinates. Now, there are many cases when I will have to find cell references, eg. when a unit is created, I will have to somehow give it a reference to the cell it's occupying.

Is there a nice way of dooing this in PlayMaker?

Thomas
« Last Edit: December 28, 2016, 05:13:11 AM by tjarvstrand »

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: Finding reference to grid cell
« Reply #1 on: December 18, 2016, 04:57:19 AM »
Have you looked at Arraymaker? https://hutonggames.fogbugz.com/?W715

tjarvstrand

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Finding reference to grid cell
« Reply #2 on: December 26, 2016, 06:30:36 AM »
Sorry for the late response.

Imay be able to bend arraymaker to get some manner of solution at the moment but I don't think it solves the general problem of interaction between FSMs and scripts. Isn't there any good way of just calling a function/method on any behaviour and putting the return value in a variable?

Say for example I want to do pathfinding. I have a method on a behaviour that implements the algorithm and return a list of grid cells that represent the path from A to B. How would I call my pathfinding method? If possible I would like stick to using PlayMaker for simple comparisons and state transitions and implement the complex logic in scripts.

tjarvstrand

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Finding reference to grid cell
« Reply #3 on: December 28, 2016, 05:12:12 AM »
I think I've been able to find a solution to my problem using the send message and call method actions. For some reasson I wasnt able to get them to work the way I wanted previously. Sorry for the noise.