playMaker

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Mayhem

Pages: [1] 2
1
PlayMaker Help / How to Pause/Resume a FSM or a State
« on: December 12, 2013, 01:10:52 PM »
Hey there!

So I'm working with the cool Time Control and Pausekit in order to pause my game without TimeScale. It works pretty well. The only thing is: some certain fsms are still running, like the AI.

My AI is driven with the 2D Platform Controller-Plugin AND PlayMaker. The thing is I'm telling the AI via PlayMaker how exactly it should move. I made a simple EnemyInput-Script with certain functions like:

Code: [Select]
void MoveRight()
    {
        x = (0.5f*speed)*timeController.ControllerSpeedZeroToOne;
        moveDirection = 1;
    }


    /// <summary>
    /// Moves to Left
    /// </summary>
    void MoveLeft()
    {
        x = -0.5f*speed*timeController.ControllerSpeedZeroToOne;
        moveDirection = -1;
    }

I use the "Invoke Method"-action and call these methods. For example, the Patrol-State:

- MoveRight is called
-> AI walks to right
- Wait-Action for 1-2 seconds (Invoke also Method to stop movement!)
- MoveLeft is called
-> AI walks to left
and so on

When I pause the game, the AI stands still, but the state-machine is still working and changes it's states.

Is there a way to Pause the entire FSM in the certain state and when resumed it starts working again at that state?

2
So, some months ago I asked the same question:

http://hutonggames.com/playmakerforum/index.php?topic=3677.msg17033#msg17033

We're working on a mobile game.
That time I found another "solution" at Unity Answers which doesn't have to do anything with PlayMaker. I was suggested to have a scene like the Scene before the Start-Scene which loads once and there I create the objects with "Dont Destroy On Load" and can use them as I like in the following scenes. The only problem is: This scene has to exist and won't be loaded only once. For example, when the Application is quit and complete closed by the user that specific scene will load again and duplicate objects. That is a no go for the game.

I searched here in the forums how to tackle this with PM and found different topics like:

http://hutonggames.com/playmakerforum/index.php?topic=4053.msg18891#msg18891

or

http://hutonggames.com/playmakerforum/index.php?topic=1653.msg7288#msg7288

But I can't figure out how exactly I should use these global variables.

Let's say:

- Scene 1 has the Player and a MANAGER-Object

-> The Manager from Scene1 must check if the Player exists, when the level is loaded again from Scene 2 for example -> if the Player exists, I have to destroy the duplicate (or scene-instance or whatever it is called)
- since the Manager checks also for the Player on START when I start the game in Scene1 he destroys my first player and the scene has no player at all.

How to deal with it exactly?

I need some help on this since the "life" of some certain objects have paramount importance, like the UI. We have a Booksystem Quests and Items, and these Elements should be carried over from level to level. So after revisiting older levels there can't be two/three/or more UIs.


And another thing:

As mentioned above we have these Quests and Items which are Labels and Sprites (nGUI/2DTK)
Now I don't know how to save/load these things.

For example: When the Player ends a certain Quest and gets an Item, the Questpage in the book and the Text (NGUI-Label) is marked as "Accomplished" and the Item-Sprite is shown in the Inventory.
When the Player ends the level the game should be autosaved. When the Player quits and closes the game he can load it in the Loadmenu and all the progress incl. the accomplished quests and the collected items should be "there" like he left the game.

What would be the best way to save/load these things?

3
PlayMaker Help / Call Method - Method Name is invalid?[SOLVED]
« on: November 16, 2013, 09:33:18 AM »
So I tested the Call Method - Action, which is great btw. But it gave me an error:
"Method name is invalid: PauseTime"

(PauseTime Method is a method of a third party asset)

I looked up the Behaviourscript I tried to call and copypasted the name of the function. Still an error. When I use the Invoke Method Action it works.
Then I looked up the PauseTime-Method again and saw that it's an "internal void" function and not "public void". Just out of curiousity I changed that, voilá, it worked.

So~~~~
Is it possible to allow "Call Method" to use internal methods, too :D ?

4
PlayMaker Help / How to write actions properly?
« on: November 14, 2013, 06:31:53 AM »
Hey there. So the last couple of days I'm trying to write my own actions, but the problem is: I can't to get them to work properly.

The main issue is, that I don't know exactly how to write them? When do I use which PlayMaker-function (Reset, OnEnter, OnUpdate, and so on), which PlayMaker variables are needed and so on.

I looked up the wiki and youtube but didn't find anything useful in order to team how to write them. (maybe I just didn't look good enough)
I also looked at already implemented actions, but I don't understand how they work.

It would be great if there would be a Step-For-Step guide in order to create own actions for non-programmers (like me) :)

5
Feature Requests / XBOX ONE Support
« on: November 05, 2013, 11:13:15 AM »
Since this latest news: http://blogs.unity3d.com/2013/11/05/big-xbox-one-news-for-unity-developers/

The chances of PlayMaker-Support for the XBOX ONE shouldn't be that low, should they?

6
PlayMaker Help / Wait-Action is flickering?
« on: November 02, 2013, 12:26:07 PM »
Hey there, so I stumbled about something and I would like to know if this is "normal" behaviour.

So here is the video:

https://www.dropbox.com/s/46x2vctpgsweb9z/Wait-Problem.mp4

So there is a State called "Tweenwait (ALPHA OFF) 2", look at this one. It just has the Wait-Action and waits for 0.45 seconds. While I'm doing something on the Gametab the FSM is running and it runs through this certain Wait-State, but as soon it's through (green border determines which state is currently active) it flickers green again for a brief moment after it finishes and the next states are active.

Is this normal?


Edit:

I experienced that with most of my WAIT-States.

7
PlayMaker Help / Stop sending same Event
« on: October 29, 2013, 07:43:11 AM »
Hey there.

So I'm working on a 2D Game where you have to fight against enemies and I came up with a system which works fine for now. But I stumbled over an issue:
The Player has a little Lifesystem symbolised by three Hearts. If he got hit, one heart vanishes.
Let's say there are two enemies and when they both hit the Player at the exact same time the Player will loose not only 1 heart but 2 of them and this is the problem.

I made some screens so you can see it:


The black Box is the Player, the grey Box in the air is just a static Box which will send the "PlayerHit"-Event when an OnTriggerEvent occurs. This Event takes place on a FSM which is attached to the Player and executes the logic behind the Lifesystem.


As you see the black Boxs' Collider hits the Collider of the grey one, the Hit-Event is sent and the Player looses on of his hearts.


So, if i position another grey Cube, with the same height and same settings right next to the other one and let the Black Box fall the Player looses immediately two of his hearts.

Here are the FSMs of the grey Boxes:






I have an idea how to tackle this, but I don't know how I could do this with PlayMaker. I think the solution would be to check if the "PlayerHit" was sent already in that frame, if so, don't send it again.
What would be the PlayMaker-Approach?
Do you guys have better/easier ideas to tackle this?

8
PlayMaker Help / Tweening a Variable?
« on: October 21, 2013, 12:47:28 PM »
Hey there,

so I got this little problem. I have a UISprite (NGUI) GameObject which I want to tween with the HOTween-Actions. Especially the Alpha-Values of the UISprite. When I use the Visual Editor of HOTween everything works fine (tweening the Alpha-Property from 1 to 0), but as soon as I try to do it via States I got problems: it doesn't work.

My setup:

1. State: getting the Child of a certain GameObject and storing it into a local FSM-GameObject-Variable (that works, Inspector is showing the right GameObject)

2. State: Getting the right Component (UISprite) of the saved GameObject-Variable, stored in a local FSM-Object-Variable (Variable is set to UISprite in the Object-Dropdownmenu, this is working, too, shows the right component in the Inspector)

3. State: Getting the Alpha-Property of the saved Component, storing the Value in a local FSM-Float-Variable (does work, too! Inspector is showing the right Value!)

4. State: HOTween Float-Action

Start: alpha_value (float value where the alpha is stored)
End: 0
Result: result (other float value)

The rest are default-settings of the Action.

So now in the Inspector I can see how the Variable alpha_value is tweening from it's initial value 1 to 0 but the UISprite doesn't do anything. It's there like nothing happens, it doesn't become more transparent.

I both tried saving the Property as plain Alpha and Color.a value, didn't work.

(If I do the same with PlayByID and a setup Tween in the Editor it works.)

I also tried using Animate Float or Ease Float. Both didn't work.

What am I doing wrong? I need this one to be such a system and not called by ID!

9
PlayMaker Help / Restart Level Action loading level twice?
« on: August 30, 2013, 03:13:00 PM »
Hey there,

so I had an issue with another plugin after using the Restart Level Action. The developer of the plugin looked into it and told me this:

Quote
With the SoundManagerPro debug logs on (check 'Show Debug Info'), I noticed that PlayMakers call to Restart Level is loading the level twice immediately (which is making SoundManagerPro essentially run it's functions in Awake on the second load). You might want to contact them about that, because I'm sure that's not intended behavior.

Let me know if that's not what's happening to you. With the Debug logs on, it'll show something like this:
(2.489183) In Level Loaded: Sandbox
If that shows up twice exactly the same(the number in parenthesis is the time it is called), then something is wrong with their restart level.

Is there something wrong with that action?

Edit:

Same stuff with the Level-Load-Action...

10
PlayMaker Help / FSMs switching on "Play"
« on: July 22, 2013, 11:20:36 AM »
Hey there.

So I have two or more FSMs on one Gameobject and when I want to observe one certain FSM and hit Play the FSM in the PM-Editor switches to another FSM of the GameObject.

Why is that? There a way to disable that, didn't find any option in the preferences, though.

Working with the new 4.2 Unity Release and the latest PlayMaker-Version.

11
Official Action Updates / SoundManagerPro Actions
« on: July 21, 2013, 07:52:53 AM »
Hey there guys. I managed to convince the developer of the great Audio/Sound-Plugin "SoundManagerPro" for some PlayMaker-Support. In the end, he nearly covered the whole Plugin with PM-Actions :D

http://forum.unity3d.com/threads/186067-RELEASED-SoundManagerPro-Easy-Game-Music-Plugin

We have Actions like:
- Add Soundconnection
- Create Soundconnection
- Play Soundconnection
- Mute
- Mute Music
- Mute Sfx
- Set All Pitch
- Stop
- Next
- Pause
- Get Current Song
- Play Clip
- Play Pooled Sfx
- Store Sfx

and many more. On top of that, the actions are all well documented :D

So, you can update the PlayMaker-Wiki. SoundManagerPro is not only a great Audiokit but also ships with a great implemented PM-Actions.

12
PlayMaker Help / Best approach for 2D AI
« on: July 11, 2013, 09:33:01 AM »
Hey there.

The last weeks I was working on the AI for my 2D Platformer game. I watched the Tutorial-Series on AI with PlayMaker and tested some things and got it working. The Movement was done by iTween when patrolling or chasing the Player. But I ran into some problems on the platforms -> when the Player jumps from the platform where the enemy is located and is chasing the Player to another platform the Enemy is of course chasing the Player and falls into the pit. I tried making two Boxes which where Triggers and served as Waypoints  but couldn't manage to achieve a rocksolid AI which stays on the platform.
Some of the Enemies should chase the Player, if they reach an end of a plattform, they should stop. (While Patrolling, Chasing and Attacking the
Enemies are playing 2D Toolkit Animations)
Other Enemies can chase the Player over obstacles, meaning: they can jump over pits, too.

So, know I would like to hear some experiences on tackling this monster, especially with PlayMaker.
Do I have to bear in mind something special?
Should I try a Pathfinding-Solution like A* Pathfinding or Simply A* Pathfinding (http://forum.unity3d.com/threads/164003-Released-BFGames-Simply-A*-Pathfinding!) ?

13
PlayMaker Help / [SOLVED]Rotating Raycast for Enemy-AI
« on: May 31, 2013, 08:44:41 AM »
Hey there. So I watched the great "Basic-AI-Tutorial Series" and customized it for my personal need on a 2D Plattforming Game.

What do I want to do?

The Main-System of the AI is pretty much the same like in the Tutorials of BadSeedGames, only the Movement-FSM and the Orientation-FSM are changed, but the Problem isn't the Movement-FSM it's the Orientation. Here's mine:



What am I doing? So, first of all I'm checking if the Enemy is headed to the Left or the Right, that I'm checking with the XScale of the Enemy-Position and depending on the value the Raycast is firing left or right.



This is actually working, but the problem is the System itself. The Raycast only starts firing if the Character is in Range, and then it is stuck in it's direction (Left or Right).

This is the "normal" behaviour:
1. Enemy is patrolling left to right , no Raycast
2. Player comes from the Left, Enemy is heading in Players direction
3. Player is in Range, Raycast is Firing to the left and hits the Player
4. Other States are triggered (Chasing etc.)

Fine.

And this is the "unnormal" behaviour:

1. Enemy is patrolling left to right , no Raycast
2. Player comes from the Left, Enemy is heading in Players direction
3. Player waits till Enemy comes to the point where he's turning himself around to patrol in the opposite direction.
4. Player follows Enemy, which is patrolling now to the right.
5. Player is in Range, Raycast is Firing to the right, although Player is on the Left side of the Enemy



6. Enemy is stuck in the "Raycast"-Action, because there is nothing to hit on the other side.



The Enemy stops only Raycasting when the Player is out of Range again, which is fine, but it's kind of dumb when the Enemy is facing the opponent but isn't chasing him...

Any ideas how one can solve this issue?

I thought about rotating the Ray but I don't know exactly how to do that.

14
PlayMaker Help / Editor Window behaves strange
« on: May 25, 2013, 07:17:45 AM »
Hey there. I don't know if this is the right forum, if not, please move it to another section.

So, what's the deal. In the last months/weeks I was very happy working with PlayMaker and I still am. And that certain problem occured the moment I started working with PlayMaker, months/weeks ago, as said. I thought this was kind of a "thing" of the Plugin but now it's a problem within prototyping.

So: when I setup my Actions for a certain GameObject in the PlayMaker-Window and hit Play WHILE having the PM-Editor-Window open the game and the editor-window are behaving strange. I cant scroll around the Editor-Window, can't zoom in/out, can't select another state than the State which is currently active etc.
The game itself does "well", but there are always some hiccups (NO FPS-Drops, just some hiccupish behaviour of the Characters) and not 100% correct Script- or FSM-behaviours till the moment I close the PlayMaker-Window/Tab or change to another Tab -> then the game works perfectly fine, no hiccups etc. But as soon the PM-Editor-Window is open again these behaviours start, in the game and in the PM-Editor-Window.

Any explanation?

I am using the latest PM-Version on Unity 3.5.7 with a Mac.

15
PlayMaker Help / Error while DebugLogging
« on: May 10, 2013, 03:25:18 AM »
Hey there.

I have some nGUI Buttons which have the UIEventsToPlayMaker Script attached.

They also have this Script attached:

Code: [Select]
    using UnityEngine;
    using System.Collections;
     
    public class NGUIButton : MonoBehaviour
    {
        public ButtonType type;
        public NGUIInput input;

        public PlayMakerFSM targetFSM;


void OnEnable()
{
if (targetFSM == null)
{
targetFSM = GetComponent<PlayMakerFSM>();
}

if (targetFSM == null)
{
enabled = false;
}
}



       
        public void OnPress(bool pressed) {
            if (pressed) {
                switch (type) {
                    case ButtonType.LEFT :  input.SetX(-1f);
targetFSM.Fsm.Event("LEFT");
break;
               
case ButtonType.RIGHT : input.SetX(1f);
targetFSM.Fsm.Event("RIGHT");

break;
                   
case ButtonType.ATTACK : input.SetX(0f);
targetFSM.Fsm.Event("ATTACK");


break;
                   
case ButtonType.JUMP :  input.Jump(true);
targetFSM.Fsm.Event("JUMP");

break;
                }
            } else {
                switch (type) {
                    case ButtonType.LEFT :  input.SetX(0.0f); break;
                    case ButtonType.RIGHT : input.SetX(0.0f); break;
                    case ButtonType.ATTACK :  input.SetY(0.0f); break;
                    case ButtonType.JUMP :  input.Jump(false); break;
                }
            }
        }
    }
     
    public enum ButtonType { LEFT, RIGHT, JUMP, ATTACK };


In order to test if this works I'm sending some events here as you see like "LEFT", "RIGHT", "ATTACK" and "JUMP". These Events are Global Transitions in the FSM of the Buttons and everything works fine, it's working.

The States of the FSM have all just one Action:

DebugLog - The just print a certain Text like "RightButton was pressed" "LeftButton was pressed" etc.
But as soon as I stop the game after looking the the Playmaker-DebugLogger, I get this error:

Quote
NullReferenceException: Object reference not set to an instance of an object
HutongGames.PlayMakerEditor.FsmLogger.DoLogView ()
HutongGames.PlayMakerEditor.FsmLogger.OnGUI ()
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)


Log in file: at line: -1

It's nothing dramatical, and it doesn't crash the game or whatever, but I would like to now what's going on, since it's happening AFTER stopping the game.

Pages: [1] 2