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.


Messages - GonerGames

Pages: [1] 2 3 4
1
I have the wait in there so that I know that the Activate Game Object will fire off correctly. If I put Activate Game Object in the first state then it didn't seem to work properly. Just a testing thing that worked for us.

2
MoreMountains creates a pool of your platform prefabs in the Spawn Manager. As you collect the coins from each spawned platform you are then deactivating the coins permanently using the Playmaker FSM. As the pool recycles the platforms it does not automatically turn the coins back on as it remembers that you have deactivated the coins.

To get around this:
Make a Empty Game Object "Coin Holder"
Drop your collectable coin into the Coin Holder as a child
On the Coin Holder make an FSM with:
   - State 1: Wait 0.1 -> go to state 2
   - State 2: Activate collectible coin object

Now when the platform reactivates the FSMs on the Coin holder will run and reactivate the collectible coins.

By also having the collectable coin as a child of the Coin Holder it is also easy to reset the position of the collectable coin if needed. Eg. Magnet power up that pulls the coins towards you therefore needing a reset of the coin position for next time.

3
PlayMaker Help / Re: How do I make this faster?
« on: April 12, 2019, 09:16:05 PM »
I'm not sure your exact layout of your game, so the above may not work for you. I do see what you are trying to do. By having mutiple arrays looping, checking for duplication, and then calculating damage from another loop and then finally clearing the array will get costly on a single process. You may want to pull these out of the main thread and put it in a coroutine. This way the damage still gets calculated and applied without bogging down the main thread. I haven't used the Playmaker Start Coroutine action, so I can't walk you through that. Hopefully someone else has and can guide you through.
I know people either love or hate coroutines :) . If your not planning on having 1000 run at once you should be fine.

4
PlayMaker Help / Re: How do I make this faster?
« on: April 11, 2019, 05:41:17 PM »
You could probably speed this up by putting the onus on the player or enemy to calculate damage.

Simplified version:
The weapon can have a set float damage value and we use a tag of "weapon". *Note name of FSM in the inspector must match the Fsm Name in next step. Let's use the default "FSM" for this example*
Now set the weapon with a Playmaker local float variable called Hit_Damage = 5. No actions

Your player/enemy:
Will now have a FSM to watch for collision event.
Will have a variable called Health/Life = 10 (let us get a couple of hits before we die).

State 1 = Collision event (3D or 2D) -> On collision enter, Tag = "weapon", send event "hit", Store collider "Hit_With"

State 2 = Get FSM Float *This is where we get the colliding weapon damage*
               GO = Specify GO, Object = "Hit_With", Fsm Name "FSM", Variable name = "Hit_Damage" *Matches weapon variable name*, Store value = "Damage"

State 3 = Float subtract of Health/Life - Damage. Add in your defence score here to reduce damage

State 4 = Float compare to check if health is equal or less than 0. If 0 then go to state 5, if not go back to state 1

State 5 = destroy player/enemy i.e the death of the object.

With this you can simplify how damage is applied to the player/enemy.
In short the weapon has a value that then gets subtracted from the objects life. Quicker than storing all the hits in an array and cycling through them.

Hope I'm not sending you down a wrong path. I've always considered weapons/bullets to be a static damage item. Then it is up to the player/enemy to check on how to deal with that damage.

5
PlayMaker Help / Re: Puzzle Help
« on: March 04, 2019, 09:54:12 AM »
Try this. It is based on the wires and nodes not being rotated

Main Power Source - Tag "PowerON" - Box Collider - Trigger On - Rigidbody

**Wires and Nodes can function the same using the below**

Wire/Node - Tag "Untagged" - Box Collider - Trigger On - Rigidbody
        - Move/scale box collider to one end - ie. input side
        - Create Empty Child object - Box Collider - Trigger On
        - Move/scale box collider to opposite end - ie. output side

FSM on Wire:
         State 1 - Trigger event **Check for inital trigger**
                           - Use Owner - OnTriggerEnter
                           - Collide tag - PowerOn
                           - Send Event - Turnon
                           - Store Collider - PoweredObj

                      - Trigger event **check for still colliding/Incase power is cut and restored upstream of this connection**
                           - Use Owner - OnTriggerStay
                           - Collide tag - PowerOn
                           - Send Event - Turnon
                           - Store Collider - PoweredObj

         State 2 - Set Material - Index 0 - Material of choice **this is where you visually show the wire is active**
                    - Set Tag - Owner - "PowerOn"
                    - Set Tag - Specifiy Object - Child Obeject Ouput - "PowerOn"
                    - Use FINISHED as auto forward to next state

          State 3 - Game Object Compare Tag **See if what we are colliding with changes tags, useful if power gets cut up stream**
                            - GameObject = PoweredObj
                            - Tag = "PowerOn"
                            - False Event - TurnOff
                            - Every Frame - On
                      Trigger Event - On Trigger Exit **if we manually move this away from power**
                             - Collide Tag = "PowerOn"
                             - Send Event - TurnOff

         State 4 - Set Material - Index 0 - Material of choice **this is where you visually show the wire is inactive**
                    - Set Tag - Owner - "Untagged"
                    - Set Tag - Specifiy Object - Child Obeject Ouput - "Untagged"
                    - Use a Wait of .2 or .3 - FINISHED

6
PlayMaker Help / Re: Projectiles are deflecting off of targets
« on: January 25, 2019, 01:18:06 PM »
Sorry that didn't work for you.

We recently came across this problem in an in house project we are working on as well. It seemed that the Playmaker collision event detection didn't quite keep up or wasn't being notified. Unity would make the collision happen, but Playmaker wouldn't fire the event. Timestamp worked at first to solve, but then at faster speeds the issue came back. To solve in the meantime we have the below in a c# script attached our object to detect collisions. It was more reliable than the Playmaker detection. I am not a Playmaker custom action expert so I can't explain why this was more efficient in our case.

To setup:
1. put script on bullet
2. Drag the bullet object onto the "go" reference in the script.
3. create a bool variable in your fsm called "hit"
4. Just have a bool test state where your collision detection would go and have the bool switch to true from the script. Remember to turn it back to false in the next state :)

Code: [Select]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HutongGames.PlayMaker;



    public class Tester : MonoBehaviour {

    public PlayMakerFSM go;

    //check for 3D collision

    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "[Tag here]") //put tag name here alt - collision.gameObject.name == "[name here]" can also be used
        {
            //get our variable from the FSM
            FsmBool hit = go.FsmVariables.GetFsmBool("hit");

            //turn value to true
            hit.Value = true;

            //Log event to be sure
            Debug.Log("Bullet hit");
        }
    }


    //check for 2D collision
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "[Tag here]") //put tag name here alt - collision.gameObject.name == "[name here]" can also be used
            {

            //get our variable from the FSM
            FsmBool hit = go.FsmVariables.GetFsmBool("hit");

            //turn value to true
            hit.Value = true;

            //Log event to be sure
            Debug.Log("Bullet hit");
        }
    }

}

I still think this is more of a Unity issue than Playmaker.

Hope this helps  ;D

7
PlayMaker Help / Re: Projectiles are deflecting off of targets
« on: January 24, 2019, 09:01:13 AM »
This is more likely a Unity issue as your log isn't even registering the event.
Unity's default physics calculation happens at 50 fps. If your game is running higher than 50fps, then these issues can happen. Especially with multiple events per frame.

In Edit -> Project Settings -> Time you can adjust the Fixed Timestep value. The calculation is 1/fps so for 60 fps you would use 1/60 = 0.0166666
Note that the lower the number the higher the CPU overhead will be.

Mobile:
If this is for mobile then 0.01666 (60fps) is probably the lowest you want to set this.
Also for the Maximum Allowed you'll want this between 8-10 fps (0.125 - 0.1)

Hope this helps



8
PlayMaker Help / Re: 2d weapon animation
« on: November 16, 2018, 09:11:37 AM »
Depending on how your 2D charater is setup using Unity's Anima2D might be a good option for you. It allows you to set up a skeleton frame work for your 2D characters. This would allow you to dynamically adjust your weapons around the bone framework. This is a bit of effort to setup, but is far more flexible for runtime operations.

Anima 2D is free on the asset store and here is a link to the youtube tutorial series for Anima 2D.
Anima Youtube

Hope this helps.

9
General Discussion / Humble Bundle - RPG Pack
« on: November 15, 2018, 11:26:40 AM »
Hello fellow Playmakerians,

Humble Bundle has a great bundle on right now for anyone needing some 2d art and sounds. Listed for making RPGs, but a lot of assets even for other types of 2d games. Total of all files (if you spend the full $20+) is 66,747 files in 4,206 folders. Takes up about 70 gigs in HD space. Proceeds go to charity and you get a bunch of assets for your next great idea. Win win.
RPG Game Dev Bundle


10
PlayMaker Help / Re: Delete Object or De-activate Object ?
« on: November 10, 2018, 01:25:53 PM »
Best is to use the Pooler Destroy Self action. This will deactivate the object and make it available to the pooler.

On the ground prefab you can have a wait time (2-3 seconds) then fire the Pooler Destory Object State. Less overhead then checking to see if it hit/exited a collider.

For obstacles:
You can add a global event to fire the Pooler Destroy object state directly. This way you can clear all the obstacles at once and put them back in the pool. This was used this for a "watch the ad and revive" mechanic.

Hope this helps.

11
PlayMaker Help / Re: Sending values from a script to Playmaker
« on: November 10, 2018, 10:12:55 AM »
This shoud work for you:
Make sure you have Using HutongGames.Playmaker at the top
then find and set the Global Value

example:
 
 if (aim == true)
        {
           //find Playmaker global and set as aim variable
           FsmInt aim =  FsmVariables.GlobalVariables.FindFsmInt("IsAim");

           //set aim variable value
           aim.value = 1;
           
            print("Setting Aim 1");
        }
        else
        {
             //find Playmaker global and set as aim variable
             FsmInt aim = FsmVariables.GlobalVariables.FindFsmInt("IsAim");
           
              //set aim variable value
              aim.value = 0;
                       
            print("Setting Aim 0");
        }

12
PlayMaker Help / Re: Send event on every 3 kills
« on: November 02, 2018, 01:50:06 PM »
In your state you can use the float/int compare with 2 variables:
1st Kill Count - Global Variable - Actual Kill count
2nd "Compare Value" - Local variable - Inital is 3

When the compare statement fires, in the next state do your action(s) and then add 3 to the "Compare Value" variable. This way the compare value will "auto increment" as you move up in kills.

Just remeber to reset "Compare value" back to 3 when applicable.

Hope this helps.


13
PlayMaker Help / Re: Instance material at runtime?
« on: October 15, 2018, 12:40:58 PM »
Using Arraymaker I set up an Hash table of materials. Then during runtime I use Hash Table Get to get the material I need and then use Set Material to change it out on the fly.

It won't save the changes when you exit. You'll need to use Easy Save or Player Prefs for that.

14
PlayMaker Help / Re: Problem with animation stop
« on: October 04, 2018, 04:46:12 AM »
When you start your scene click on your gun and see what the rotation values are before you switch weapons.

Stop the game and add an FSM to your gun with a Set Rotation Action. Put the values in the x, y and z you recorded from above.
I'm am guessing that when you switch weapons you deactivate your original gun object and then reactivate it when switching back. If that is the case then the FSM will fire again and correct your rotation.

Hope this helps
 



15
PlayMaker Help / Re: Problem with animation stop
« on: October 03, 2018, 06:58:10 AM »
It's looks like your rotation on the gun is not getting either set or reset properly when you switch back.
Maybe put a FSM on the gun that sets the rotation on start back to default value.

Pages: [1] 2 3 4