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 - krmko

Pages: [1] 2 3 ... 5
1
Playmaker Help / Problem with Hash Table Concat
« on: April 19, 2018, 09:55:02 AM »
Hello guys,

i need to join some hash tables, and i believe i set everything right, but the concat doesn't happen. Here are the pics:



This one shows the state that should join the tables, strings are built ok, references are ok.



And here we see that the concat did not occur, they both had 48 and 17 items respectively before the action was executed.

Any ideas on what i'm doing wrong? I hope the tables are not fixed size.

2
Playmaker Help / Improving compile time
« on: April 13, 2018, 01:53:37 AM »
Hello all,

i'm knee deep in development and my compile time when i hit play is now about 30 seconds, which makes me very inneficient at work as i spend most of my time waiting for half a minute just to perform a few seconds check on something i did.

Besides pooling which is really a kick in the head since i've got some 300 objects pooled with at least 10 copies of each, i was wondering if moving playmaker to standard assets or plugins folder would bring any benefits.

I read in lot of places it's good to move scripts you rarely change to those folders since they compile first (kinda how this plugin https://assetstore.unity.com/packages/tools/utilities/mad-compile-time-optimizer-34012 works. I haven't tried since i see it hasn't been updated for a long time and the reviews are quite polarizing.

I use Playmaker almost exclusively, and as far as i know, unless i modify them, scripts that make Playmaker are never to be altered, so i guess it would be safe to move them. UNLESS the folder locations of Playmaker itself are important, like in many other plugins, and that would break the thing.

3
Playmaker Help / Logic help on splash damage
« on: April 11, 2018, 05:26:12 AM »
Hi guys,

i want to make some explosions have radius based damage that can damage multiple enemies, but my current bullet/enemy/damage setup is giving me a hard time.

At the moment, all the damage dealing stuff is set up like this:

  • Bullet hits the enemy
  • Bullet takes the current HP from enemy, deducts the damage it is making, and feeds back the new HP to enemy
  • Enemy checks if HP is 0, if it is, it dies, if it is not, goes back to idle state

It can be simpler, but i have many modifications that makes it necessary to work this way.

Splash damage is easy to implement from the enemy side, as every enemy can detect the collision with the explosion collider and apply damage to itself, but since the logic of dealing damage in my case is on the bullet/explosion side, only the first enemy that collides with the explosion will be hit, and rest will remain undamaged.

Any ideas on this one? Some spherecast with adding enemies in the blast radius to an array and the cycling through all of them?

4
Playmaker Help / Setting fsmReceiver on runtime? [SOLVED]
« on: March 13, 2018, 12:16:48 AM »
Hi guys,

i'm using set of actions for Simple Waypoint System, but one of the actions is made quite wrong. It's Add Event At Waypoint and instead referencing the object and FSM name, it uses fsmReceiver which can be only set in editor.



Any idea how could i set this on runtime or change the action so i can add event to a referenced object and FSM, not this crap. I tried fiddling with send event action, but it's too advanced for me.

Here's the action itself

Code: [Select]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using SWS;

//implements a PlayMaker FSM method call via event insert
namespace HutongGames.PlayMaker.Actions
{
    [ActionCategory("Simple Waypoint System")]
    [Tooltip("Adds an event to a walker object for calling your own FSM state at waypoints.")]
    public class SWS_AddEventAtWaypoint : FsmStateAction
    {
        [RequiredField]
        [Tooltip("Walker object")]
        public FsmOwnerDefault walkerObject;

        [UIHint(UIHint.FsmInt)]
        [Tooltip("Waypoint index")]
        public FsmInt wpIndex;

        [RequiredField]
        [UIHint(UIHint.FsmGameObject)]
        [Tooltip("Receiver with the FSM event")]
        public PlayMakerFSM fsmReceiver;

        [RequiredField]
        [UIHint(UIHint.FsmString)]
        [Tooltip("Receiver FSM event to call")]
        public FsmString fsmEvent;
       

        public override void Reset()
        {
            walkerObject = null;
            wpIndex = null;
            fsmReceiver = null;
            fsmEvent = null;

        }


        public override void OnEnter()
        {
            Execute();

            Finish();
        }


        void Execute()
        {
            var go = Fsm.GetOwnerDefaultTarget(walkerObject);
            if (go == null) return;

            List<UnityEvent> events = null;

            splineMove spline = go.GetComponentInChildren<splineMove>();
            if (spline)
                events = spline.events;
            else
            {
                navMove nav = go.GetComponentInChildren<navMove>();
                if (nav)
                    events = nav.events;
            }

            UnityEvent myEvent = events[wpIndex.Value];
            myEvent.AddListener(delegate { fsmReceiver.SendEvent(fsmEvent.Value); });

        }
    }
}

5
Hi guys, would someone have the knowledge to make an action that would have the possibility of locking the weight of the value, but not only that, to affect all other values so the complete weight sum is 1, the way it should actually be. I don't get how the current action works.

A simple example of values that interract:

I have two float values, each set to 0.5. When i start dragging the slider of one up, the value of another one goes down, so the sum stays 1. If i dragged the first one to 0.7, other one will go to 0.3.

Another example:

I have 3 float values, first is set to 0.2, and another two to 0.4. I want to change to values of the other two, but i don't want the first one to move from 0.2. So i click a small check box beneath it which says "lock" and adjust the other two values. So, i reduce the value of the second one to 0.2 also, and the third one only changes by increasing to 0.6.

What do you think?

6
Playmaker Help / Problem with Animator and Pooling
« on: March 04, 2018, 02:11:28 PM »
Hello guys,

I'm using pooling for my objects, and most of them have animator. I encountered problems with pooling before, i didn't know that i'm supposed to reset variables, but one problem persists.

Before despawning, to make sure all is tidied up, i set the object animator to idle state (which has no exit time), disable the component and then disable the object, so the animator should start fresh from the idle state and wait for the action trigger to start the desired state in the animator.

BUT, when object is respawned, the animator frame in which the animation stopped is set as the sprite renderer sprite. I tried sorting this out by making texture hashtable and the object fetching the texture converting it to sprite and setting it as sprite in sprite renderer since i can't get sprite from hash table, even though i can hold it there.

But i get a bunch of errors and unwanted behaviour when i fetch the texture from hashtable and convert it to sprite, and besides, i don't know how convenient is to actually convert the texture everytime the object spawns. Sure, i could just use set sprite and drag the texture from the project, but i like to work with references to ensure everything is ok in the build tomorrow.

7
Hi guys,

i'm trying to make a controller for my 2D shmup, i'm trying with the usual get axis vector/set velocity approach vector, but it's not responsive enough. If i set the multiplier low, acceleration and decceleration is visible, and if i ramp up the multiplier, it moves too fast.

Is there a way to set a high multiplier but somehow clamp the vector?


8
Playmaker Help / Having problem with making Fixed Joint 2D work [SOLVED]
« on: February 26, 2018, 04:26:42 AM »
Hi guys,

I'm making a sticky mine that should attach itself to the enemy, but it doesn't quite work as intended, so i'd like some help if someone did this before. This is the setup:



Nothing too fancy, when the mine hits the player, the movement is disabled, i get the FixedJoint2D component and the rigidbody of the object the mine hit, and then set the connected property of the fixed joint to the hit object's rigidbody.



As you can see, everything looks fine, but the mine is not moving along with the enemy. Any ideas what's the proper setup?

Edit: Btw, i don't know if it matters, bodies are kinematic/simulated and move without physics.

9
How is this even possible?



I've got a problem and started debugging, and it seems that FSM went to BOTH states from the switch.

10
Hi guys, i'm having the problem that has been bothering me since the start of the project, and it's time to put it to an end.

Imagine this little fella is a spaceship with an engine jet behind him.

(]>

They are separate objects for the reason of only ship changing the color when he is hit (sprite masks are too complicated for this).

When the ship is moving from right to left, i set it's scale properly be getting if he's beyond a certain x position and the jet is rotated towards right. That's ok. When it's moving from left to right, i set the x scale of the ship to -1, the jet detects if engine is -x, and flips too.

But, there are certain situations when the rule is unnaplicable. Like when ship is spawned in the middle of the screen (from a carrier for example), and though the spawn location indicates one jet position, it should be placed on the other side.

There are lots of exceptions, too much to cover in a simple way.

I tried using Get Forward Direction, Get Speed, Get Velocity to get some parameters that could help me out, but i get nothing because the ships are moving either by tweening or by translate.

One idea i'm having is to get the x position of a ship and the position on the next frame and then compare them. If the new float is lower, ship is moving left, if it's higher, then it's moving right and the jet can be rotated accordingly. Unfortunately, this is also unnaplicable for the ship that are rotated either left or right but move only up or down.

Any good ideas on this one, i'm pulling my hair out for months.

11
Hi guys,

i have a system with weapon upgrades in the game where the equipped weapon gets upgraded if you pick up the same weapon again.

I want to make the possibility of spawning the same weapon from the pickup a bit higher, so, for example, if i have a sword equipped and there's a loot box, which can contain one item of 10 random items (10% chance for every weapon) and i ramp up the weight for sword by 20%, there will be 30% possibility to spawn a sword and 7,77% possibility of spawning something else.

I have a bit inefficient system, so i'd like some ideas how to improve it. Currently, i get the name of the equipped weapon and do 20 string switches. When i get a match, i raise the matched weapon's weight a bit. The thing is, i also need to lower the other weapons' weights and then reset everything after the spawn, which is tedious.

Also, i don't quite get the concept of weighted index, if one item weight is 0.6, and other is 0.8, which is 1.4 altogether, what is the actual chance of those being selected? Should i have a 0.05 weight for every item if i want 5% chance of spawning it? And what when i put a new item, do i have to recalculate the weight for all items again?

12
I'm using a small asset (2d homing missiles) which uses a static method for launching missiles. It has three parameters:

GameObject[] targetGameObjects
bool randomTargeting
bool swarmMissilesOutward

One array and two bools. However, when i try to set the first parameter to array i get this:

Error editing field: Parameters
Unknown FsmArray Type: Use ArrayEditorAttribute to specify a VariableType. And a wall of text of course:


System.ArrayTypeMismatchException: Unknown FsmArray Type: Use ArrayEditorAttribute to specify a VariableType.
  at HutongGames.PlayMakerEditor.ActionEditor.EditFsmArray (UnityEngine.GUIContent label, System.Object fieldValue, System.Object[] attributes) [0x00039] in c:\Users\Alex\Documents\Unity\Playmaker\Projects\Playmaker.source.unity\Assets\PlayMaker\Editor\Classes\ActionEditor.cs:2746
  at HutongGames.PlayMakerEditor.ActionEditor.GUIForFieldTypes (System.String labelText, System.Type type, System.Object fieldValue, System.Object[] attributes) [0x00053] in c:\Users\Alex\Documents\Unity\Playmaker\Projects\Playmaker.source.unity\Assets\PlayMaker\Editor\Classes\ActionEditor.cs:1158
  at HutongGames.PlayMakerEditor.ActionEditor.EditFsmVar (UnityEngine.GUIContent label, System.Object fieldValue, System.Object[] attributes) [0x00017] in c:\Users\Alex\Documents\Unity\Playmaker\Projects\Playmaker.source.unity\Assets\PlayMaker\Editor\Classes\ActionEditor.cs:1726
  at HutongGames.PlayMakerEditor.ActionEditor.GUIForFieldTypes (System.String labelText, System.Type type, System.Object fieldValue, System.Object[] attributes) [0x00053] in c:\Users\Alex\Documents\Unity\Playmaker\Projects\Playmaker.source.unity\Assets\PlayMaker\Editor\Classes\ActionEditor.cs:1158
  at HutongGames.PlayMakerEditor.ActionEditor.EditArray (UnityEngine.GUIContent label, System.Type elementType, System.Array array, System.Object[] attributes) [0x00000] in c:\Users\Alex\Documents\Unity\Playmaker\Projects\Playmaker.source.unity\Assets\PlayMaker\Editor\Classes\ActionEditor.cs:1258
  at HutongGames.PlayMakerEditor.ActionEditor.EditArray (UnityEngine.GUIContent label, System.Type elementType, System.Object fieldValue, System.Object[] attributes) [0x00000] in c:\Users\Alex\Documents\Unity\Playmaker\Projects\Playmaker.source.unity\Assets\PlayMaker\Editor\Classes\ActionEditor.cs:1186
  at HutongGames.PlayMakerEditor.ActionEditor.GUIForFieldTypes (System.String labelText, System.Type type, System.Object fieldValue, System.Object[] attributes) [0x00053] in c:\Users\Alex\Documents\Unity\Playmaker\Projects\Playmaker.source.unity\Assets\PlayMaker\Editor\Classes\ActionEditor.cs:1158
  at HutongGames.PlayMakerEditor.ActionEditor.EditField (System.Object obj, System.Reflection.FieldInfo field, System.String labelText, System.Type fieldType, System.Object fieldValue, System.Object[] attributes) [0x00014] in c:\Users\Alex\Documents\Unity\Playmaker\Projects\Playmaker.source.unity\Assets\PlayMaker\Editor\Classes\ActionEditor.cs:1019

Any ideas what to do?

13
Feature Requests / Few Suggestions - Clipboard and better editor
« on: December 19, 2017, 12:32:38 AM »
Clipboard

Hi, i've been using a cool tool from the asset store last few weeks, it is basically a drag and drop clipboard where you can store components and then drag them wherever you want, saving you a ton of time in the process when making a huge amount of prefabs that need to be somewhat different for example.



I got the idea that playmaker can use something similar. Yeah, we got templates, and yeah, we can copy and paste, but this would be something different, in the FSM component itself and it would store actions or complete states visually, so you can just drag and drop filled out states and actions in the clipboard and pull them back to where you need them.

Speaking of which, it would be great if we could actually save STATE TEMPLATES, without entering the component which holds the stuff we need and then copy and paste, copy and paste...so i can just take a prefilled event that is, i don't know, "detect damage" state, and pull it in.

2.

I accidentally stumbled upon this picture and i was wow.



Sure, it's all nice and dandy on a 2000x2000 screenshot, and it's quite a difference when working in unity itself, but editing a state with 5-10-15 actions in it can be quite tiresome when you need to scroll around up and down. Yeah, we can break states into several states, but why would i make more states then necessary when i want the same type of logic to stay in one state so i can reuse it?

Basically, maybe a different state editor would be a great idea. Besides the default one, you could double click on a state to open a new window that would contain a subset of actions in it in a whole new window, something like this:



The connections between them would actually be the action sequence if you want to use them in the state.

14
Playmaker Help / Using ScriptableObjects with Playmaker[SOLVED]
« on: November 29, 2017, 06:52:35 AM »
As noted in another topic, i made a neat system with hashtables, once i get the prefab name, it's easy to reference the appropriate hashtable containing that enemies HP, weapon, explosion prefab etc. I even made an almost universal template which i just need to put on the enemy and it will draw everything it needs on runtime. But, there are already so many hashtables (around 30) that it will probably be a pain to edit in a while, plus the inspector is getting laggy.

But!

Yesterday a friendly guy from twitter asked me why am i not using scriptableobjects for storing data? I've read about them before, and it's a really small page on unity api reference page, couldn't really care less. Then i got to watch this video from Unite '16 (it's really great, i recommend it - https://www.youtube.com/watch?v=6vmRwLYWNRo), and i've seen it's the perfect data container actually.

I'm looking to further simplify my current configuration, i've just started to dig a little deeper to find if i can use scriptableobjects better than hashtables, but i was wondering if some of you had experience in using scriptableobject AND playmaker and do you have a workflow you would recommend? What else can i do except get property and inherit stuff from it that would be useful?

By the way i've seen the global variables are actually stored in an asset container, as well as fsmtemplate :)

15
Hello,

I'm using this action a lot in my project since it's a lot better than default VISIBLE/NOT VISIBLE actions which take the scene view into consideration too, so i can enter the play mode without maximizing the window and see what's happening outside the frustum.

I've got some objects that spawn outside frustum, start moving and upon entering the frustum activate their children, submodules etc. There are many reasons for that, from getting exact count of enemies on screen, over avoiding firing from outside the screen and finally for deactivating the object when it leaves the screen.

It served me well until today. I'm using a templated FSM for configuring the whole object which contains the aforementioned action that activates a set of states upon entering frustum, and deactivates them when the object exits. But, as i applied it to two new object today, they are detected as visible in frustum when they enter it and then, when they pass the few states (matter of few frames perhaps), they are immediately detected as not visible and deactivated. They basically don't even enter the frustum, it's like they hit the frustum edge and disappear.

The only difference between objects used before and these ones is speed. The ones set to 0.8f and 0.4f work as intended, but these are 0.2f.

Is it somehow possible that they are too slow and they somehow jitter around and enter and exit the frustum? I use translate with fixed update, so that shouldn't be a problem, but nothing else comes to my mind.


Pages: [1] 2 3 ... 5