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 4
Playmaker Help / FSM goes through states it isn't intended to
« on: February 18, 2018, 02:54:25 PM »
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.

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.

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?

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?

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

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 i can just take a prefilled event that is, i don't know, "detect damage" state, and pull it in.


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.

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.


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 -, 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 :)


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.

Playmaker Help / Check if a game object has an FSM named "Banana" [SOLVED]
« on: November 15, 2017, 07:10:24 AM »
Hi guys,

i have an FSM which is present in some object and in some not (let's call that FSM "Banana"), but every object has an FSM which needs to check if the object has FSM named "Banana" or not on itself so it can continue doing it's stuff.

Any idea on how to do this? I suppose Has Component should do, but i probably got some more stuff to write in the component field since there are few FSM's on that object.

Playmaker Help / Ideas for system improvement
« on: November 10, 2017, 10:57:52 PM »
Hi guys,

I remade the weapon, firing, bullet and pickup system into something more universal, so i can just copy/paste FSM's to necessary objects and use local variables to do the necessary stuff, but there's an oversight i made and i need a fix. Here's a quick explanation.

I have weapons which names are structured like this:


Since i'm using pooling system, (clone 1), (clone 2) etc. string is appended when the weapon is spawned, so the name are actually like this:

PulseGunWeaponLevel1 (clone 1)
PulseGunWeaponLevel2 (clone 1)
PulseGunWeaponLevel3 (clone 1)
PulseGunWeaponLevel4 (clone 1)
PulseGunWeaponLevel5 (clone 1)

Since there will be no more than a few instances in the scene (certainly not more than nine) it made sense to make the folowing hash tables:

PlayerWeapon Key / PlayerWeapon Value
PulseGunLevel1 (string)/PulseGunLevel 1 (object)

To get the true object name out of a spawned object which contains (clone x) appendix, i get the object name, get name length, convert it into string, use the int operator to subtract the last 10 characters (" (clone_1)"), and the get string left to get the name without the (clone 1) appendix. Then i can use that name to get whatever data i need on that weapon on runtime (display name, weapon type display name for the hud and so on).

While not so complicated and applicable to weapons, it is not applicable to bullets since they appear in more than nine instances (clone 10, for example) on the screen and the whole "subtract last 10 characters" idea falls flat. Sure, i could compare the string length and then subtract last 10 or 11 characters depending on the length, but it it unnecessary complicated.

Djaydino had some ideas, and he was pointing to the problem in time, but i'm not sure how to do it, so any suggestions or step-by-steps are welcome.

Maybe using enums? I haven't used them before though. Can i define an enum so that every pooled clone always has the same name actually so i don't have to mess around with string concatenation, building and truncating?

Playmaker Help / Set FSM String problem [SOLVED]
« on: November 07, 2017, 01:44:30 AM »
Ok, so i've got this tagged game object in the scene. I get it's tag, and that works fine

When the conditions are met, i set the that value, to variable in another FSM.

I activate the global event that should compare some values including the variable i set, but it's empty

Everything's set alright, Player is a Global variable, FSM name is copy/pasted, string variable is existant, but still set fsm string action doesn't set any value.

Playmaker Help / Colliders problem
« on: November 06, 2017, 03:11:38 AM »
I'm having a banal problem, and i can't believe what's happening. I've got the Gunpoint Object that is attached as a child of the player, with these settings:

When it comes in contact with Pickup in the scene

an event should be triggered

I've set the Layer Collision Matrix, Z positions are aligned (2D game, everything uses 1 for Z transform value), i even tagged the Pickup Prefab, but still no collision is detected. I must be missing something banal, i tried all sorts of combinations of rigidbody types, istrigger checked or not, discrete/continuous collision detection and nothing works  >:( >:( >:(

Playmaker Help / Help with reactoring FSM [SOLVED]
« on: November 04, 2017, 03:08:18 PM »
Hi guys,

I while ago i made a weapon pickup and upgrade FSM system which was quite complicated and needed to be in every weapon to be functionable. Recently i got an idea to make a centralized system for that, but i'm hitting some walls.

Here's the setup:

I've got a hash table of all player weapons objects with key being their names (PulseGun1, PulseGun2 to PulseGun5...every level of weapon is considered a new weapon, but they share the same tag, PulseGun).

On the player, where the pickup system will be located, i have active and inactive weapon. So, when i hover over the pickup weapon, i compare the active weapon tag (let's say it's PulseGun, but we don't know of what level since levels 1-5 share the same tag) with pickup weapon which is also tagged PulseGun.

In that case, if we have PulseGun3 as active weapon, it should be upgraded to PulseGun4 since we picked up the weapon of the same type/tag.

Now, since we have no idea which tags matched on runtime, we need to to another tag check. Is Active Weapon X tag? No. Is Active Weapon Y tag? No. That would take maximum 30 iterations (total weapon number) until we get to is Active Weapon PulseGun Tag? Yes! Now all we need to do is run another check, this time by name. Is Active weapon name PulseGun1? No. Is active weapon name PulseGun2? No. Is Active Weapon Name PulseGun3? Yes! Despawn Active Weapon and Spawn PulseGun4 as active weapon.

Now this doesn't take much (35+ iterations top for each weapon), but it's a hell of a lot of states. I could make multitag and multistring comparison actions to shorten everything to two states (one for checking weapon tag PulseTag and one for checking weapon String, PulseGun1, PulseGun2...) But it still requires a lot of typing and is poorly scalable, especially if i pickup a weapon that's differently tagged than Active Weapon. In that case i'd need to check tag and name of Active Weapon to get to the information of which level is the Active Weapon and the replace it with the same level of Pickup Weapon, which is horrible.

Any advice on this one?

Playmaker Help / Need advice on data driven design
« on: November 03, 2017, 04:40:45 AM »
Hi guys,

A while ago i had a suggestion for the option to export/import global variables into a spreadsheet for easier editing. Jean and Djaydino were appaled by the number of global variables i use at the moment (more than 800). For me, it was the most logical way to store data since i could access it from anywhere in the project. I was a beginner and i felt that using local variables is too limiting, especially when time comes to tweak things like attack or health points of certain enemies for example. Downside to that approach (besides security and naming), as i noted further down the road, is the impossibility to manipulate it in a more meaningful way than variable by variable in a closed Playmaker environment. Besides that, local variables that don't draw data from a data source are easy to mess up and hard to debug sometimes.

In terms of programming, i'm currently in the phase of knowing more each day, but aware that i actually have more and more to learn. As a method of learning, i decompiled a lot of stuff made in Unity by opening .dll files with Resharper. I noticed that majority of games use JSON for data storing (with XML as the second most used format). I also bought Easy Save as a very praised solution which uses neither XML nor JSON, but claims to be faster than both (tho i don't care about the fast part, easy got my attentiom) but i don't know how easy is to edit those files since they are in their own enclosed binary format. They have their own editor, but that seems as handy as editing 800 globals in Playmaker (not handy at all ;D).

Why am i asking this now? I'm starting to bump into limitations. The way i work has 0 reusability and making things interesting and with variety is starting to take too much time copying and pasting the same things over and over to get a sense of controlled randomness.

The game i'm working on is an endless shmup and i want to be able to store everything and just call it as needed.

I want to create an enemy that will draw an image, flying pattern, shooting pattern, hp, attack points, armor type, bezier path points and everything else from a data structure in the format that is easy to store, read and edit. Furthermore, i want to be able to easily make subsets and combinations of data. As far as i have seen, for something like that i need multidimensional arrays (probably) and JSON seems the best suited for something like that.

One last thing i need is the advice on most painless way to refactor the existing FSM's and stored global and local variables (exporting and rearranging to empty data structures).

Any advice is more than welcome. I attached a dummy basic data structure of how enemy objects i imagine to work like, it's basically like deriving classes and adding methods.

Playmaker Help / Datamaker not working[SOLVED]
« on: November 01, 2017, 05:11:41 AM »

i tried downloading Datamaker package from Ecosystem but it wasn't working

Code: [Select]
ArgumentException: Getting control 2's position in a group with only 2 controls when doing Repaint
UnityEngine.GUILayoutGroup.GetNext () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/LayoutGroup.cs:115)
UnityEngine.GUILayoutUtility.BeginLayoutArea (UnityEngine.GUIStyle style, System.Type layoutType) (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs:344)
UnityEngine.GUILayout.BeginArea (Rect screenRect, UnityEngine.GUIContent content, UnityEngine.GUIStyle style) (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayout.cs:364)
UnityEngine.GUILayout.BeginArea (Rect screenRect) (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayout.cs:346)
Net.FabreJean.PlayMaker.Ecosystem.EcosystemBrowser.OnGUI_ItemList () (at Assets/net.fabrejean/Editor/PlayMaker/Ecosystem/EcosystemBrowser.cs:1977)
Net.FabreJean.PlayMaker.Ecosystem.EcosystemBrowser.OnGUI_Main () (at Assets/net.fabrejean/Editor/PlayMaker/Ecosystem/EcosystemBrowser.cs:836)
Net.FabreJean.PlayMaker.Ecosystem.EcosystemBrowser.OnGUI () (at Assets/net.fabrejean/Editor/PlayMaker/Ecosystem/EcosystemBrowser.cs:1153)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:285)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:278)
UnityEditor.HostView.InvokeOnGUI (Rect onGUIPosition) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:245)

I downloaded the package from Jeans Github, but i get two error after i import the package.

Code: [Select]
Assets/PlayMaker ArrayMaker/Actions/ArrayList/ArrayListGetType.cs(85,44): error CS0117: `PlayMakerCollectionProxy' does not contain a definition for `GetObjectVariableType'
Code: [Select]
Assets/PlayMaker ArrayMaker/Actions/HashTable/HashTableGetType.cs(86,43): error CS0117: `PlayMakerCollectionProxy' does not contain a definition for `GetObjectVariableType'

Unity 2017.0.2f3, Playmaker 1.8.5.

Playmaker Help / Rotating child object towards parent
« on: October 24, 2017, 06:40:45 AM »
Well, it's kinda harder to explain, so i made this neat little drawing, sorry, i'm at my office so i drew it with mouse.

I've got engine jets that are childed to the ship, and they always stay as they are, no matter if the ship moves up or down. What i want is to rotate them slightly when the ship moves up or down, as described in the picture. Now, if it wasn't childed, i could rotate it towards, but as it keeps it's local position, that doesn't work of course.

By the way, i use translate for moving the ship, i don't know what property should i listen to to adjust the rotation of the jet according to the ship movement?

Pages: [1] 2 3 4