playMaker

Author Topic: Activating a game object problem.  (Read 13032 times)

kanae

  • Junior Playmaker
  • **
  • Posts: 52
    • View Profile
Re: Activating a game object problem.
« Reply #45 on: November 05, 2014, 04:02:21 PM »
Well it looks like you're most of the way there.  You're only missing is the variables and logic to determine when all the buttons are pressed.

What you need to do is create 3 bool variables, try creating 3 global bools, name them "button1" "button2" "button3", default is false and that's good.

Now when your player goes into the "enter" state use the action 'bool flip' on the variable regarding each button.  So after the player steps on a button it's bool is 'flipped' from false to true.  Since it's being flipped, if it's stepped on again it will do it again, I've never actually used colliders like this before so hopefully if you exit it doesn't trigger the flip AGAIN and set it as false (if it does, try just using 'bool set value' as true which is the check mark in that set value action)

Then I suggest you put in the gate as a start action a listener "all true" that waits for all three button globals to return "true".  when it does, have it go to a new state which uses either "destroy object" or "activate object" (unchecked means it de-activate) and use it on "owner" since it's on the gate, it will perform the action on the owner of that action which is the gate.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: Activating a game object problem.
« Reply #46 on: November 05, 2014, 04:50:16 PM »
Then I suggest you put in the gate as a start action a listener "all true" that waits for all three button globals to return "true".  when it does, have it go to a new state which uses either "destroy object" or "activate object" (unchecked means it de-activate) and use it on "owner" since it's on the gate, it will perform the action on the owner of that action which is the gate.

Just to double check, do you mean I need to add "bool all true" at the Gate's FSM's starting state? Or the state that the "Start" global transitions it's on?

kanae

  • Junior Playmaker
  • **
  • Posts: 52
    • View Profile
Re: Activating a game object problem.
« Reply #47 on: November 05, 2014, 07:08:55 PM »
It really doesn't matter as long it's checking those bools every frame and the state with "bool all true" is always active (when it needs to be, to check the bool values)

if it's on the start state but then your FSM goes to another state, it won't matter where it is because you won't be checking for those bools anymore.

so when you run it, just make sure the state with "bool all true" is green and checking every frame.  that way when everything is finally all true it runs the next states you specify.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: Activating a game object problem.
« Reply #48 on: November 05, 2014, 08:58:34 PM »
Added bool all true to the gate FSM, made three globals for each button and added bool flip, now it works. Thanks. Pretty soon, I will probably upload a sample of the game but haven't figured out how to end a level and transition to another.

kanae

  • Junior Playmaker
  • **
  • Posts: 52
    • View Profile
Re: Activating a game object problem.
« Reply #49 on: November 05, 2014, 09:31:04 PM »
Nice!

I believe loading levels is used with "load level" action.  The level name is the same as the scene in your assets folder (levels are in fact, the same scene files that you've been saving).  You also need to include all scene files in your build, which you can do from the Build Settings menu

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: Activating a game object problem.
« Reply #50 on: November 07, 2014, 11:34:47 AM »
Nice!

I believe loading levels is used with "load level" action.  The level name is the same as the scene in your assets folder (levels are in fact, the same scene files that you've been saving).  You also need to include all scene files in your build, which you can do from the Build Settings menu

Would that mean that "load level" would be added to the players FSM? Or would that require a global variable and global transition system on a empty object?

kanae

  • Junior Playmaker
  • **
  • Posts: 52
    • View Profile
Re: Activating a game object problem.
« Reply #51 on: November 10, 2014, 10:27:29 AM »
Hey coffeeAndsoda,

sorry for the late reply.  It sounds like you're a little confused about how FSMs work.  An FSM is just like a script, it's simply a set of instructions.  For the most part, it doesn't matter what object an FSM is placed on.

Object-specific FSMs are only most important if you're using something like "Get Owner" or you are using objects with specific layers or tags.  Unity does use some basic tags and layers such as "main camera" and "player".  But largely FSMs are simply like scripts, they can be used in any way, at any time, with or for any object - all depending on how you code it.

Now to answer your question, all you have to do is use load level under the circumstances you decide.  Whether the player enters a trigger, collects an item, solves a puzzle, whatever, at whatever point you want your logic to say "load level", that's when you use load level.  It doesn't matter what object the FSM is on.

This is true for most the questions you've been asking, it doesn't matter what object an FSM is on.  Remember, the only thing that matters is the set of instructions your FSM has.  An FSM on an object can communicate with any other FSM in your level, any FSM can do anything you want to anything you want - it all depends on how you code it!

edit:  you should watch the Huttong tutorial on "managers" this will probably help you on things like this.
« Last Edit: November 10, 2014, 10:30:48 AM by kanae »

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: Activating a game object problem.
« Reply #52 on: November 10, 2014, 08:59:12 PM »
I see. Well this is what I have so far for the game. The second level's puzzle unlocks by itself, so I thought about designing another puzzle instead.

https://dl.dropboxusercontent.com/u/75323608/Puzzle%20Playmaker%20plaformer/Puzzle%20Simple%20Playmaker%20Example.html
« Last Edit: November 10, 2014, 09:03:46 PM by coffeeANDsoda »

kanae

  • Junior Playmaker
  • **
  • Posts: 52
    • View Profile
Re: Activating a game object problem.
« Reply #53 on: November 10, 2014, 10:19:03 PM »
Nice!  Can't figure out how to rotate my character/camera...

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: Activating a game object problem.
« Reply #54 on: November 10, 2014, 10:26:26 PM »
Nice!  Can't figure out how to rotate my character/camera...

It's a pretty basic camera. What do I do to add in order to set up a camera that auto adjusts so items don't block it?
« Last Edit: November 11, 2014, 01:05:23 AM by coffeeANDsoda »

kanae

  • Junior Playmaker
  • **
  • Posts: 52
    • View Profile
Re: Activating a game object problem.
« Reply #55 on: November 12, 2014, 02:14:37 AM »
Try changing the camera clip distance on the camera.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: Activating a game object problem.
« Reply #56 on: November 14, 2014, 01:42:24 PM »
Try changing the camera clip distance on the camera.

You mean Clipping Planes? Because when I do that it doesn't really solve the problem of the camera being blocked by walls.