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

Pages: [1] 2 3 ... 8
1
2nd try: The 'Add Items' array now allows for FsmVariables (don't know why I didn't consider it beforehand  :o) and that remove and replace do the same thing should also be fixed.

I would realise accepting any variable type by writing a custom inspector for this action and only showing/using the FsmArray type that's selected, which means that allowing FsmVariables in those arrays doesn't pose a problem.

2
Hi craigz,

I think that's the only way you can manipulate an array, by storing its contents temporarily, adding/removing items to/from it and re-applying it to the array and I'm also not aware of any other approach for that, since PlayMaker only supports arrays as collection.

Though to make that process easier, I combined the GDEGetStringArray and GDESetStringArray into one action, which allows to add or remove items or replace the whole array with the given items. I haven't tested it yet, but it should work; would be grand if you could try it out and say if it worked or if you had something else in mind.

This is only a crude implementation and I might create a version later that allows for modifying any array variable-type in one action.

It also seems like your list is of custom type "item", which means that you're probably only retrieving their names when using GDEGetStringArray, but I don't have enough experience with custom items in GDE to assume any negative implications.

Hope that helps.

3
General Discussion / Re: Playmaker or PlayMaker or playMaker ?
« on: June 24, 2018, 11:19:40 AM »
I prefer "PlayMaker".
Looks the best, separates itself more clearly from the sport terminology and could stand (and does) as its own brand (also I'm a fan of pascal case ;))

4
No problem.
To reset all fields of an Item I've made a GDEResetItem action that you can get from my Repo or the attachments.
This one (and the ResetFields action) removes the item fields from the ModifiedData dictionary (changed data), unlike the RemoveItem action that also clears it from the DataDictionary (persistent data).

For the GDEBoolTest problem, please replace your GDEHelpers.cs script with the version in the attachments, which should work more reliable (because I reverted back to using the GDEGetBool approach to retrieve bool variables).
The InvalidCastException also often only shows up when the searched Item or Field couldn't be found, so another thing to make sure when such an error pops up is that the given search parameters are correct and that the Item/Field exists at all ("InvalidCast" because it tries to convert the retrieved object to a boolean and if the retrieved result is null/non-existent it throws this exception).

5
Playmaker Help / Re: Unable to install Playmaker
« on: May 06, 2018, 01:07:00 PM »
In your Assets folder go to PlayMaker>Editor>Installer and doubleclick on the latest .unitypackage in that folder(e.g. "Playmaker.1.8.9.unitypackage") to import it, that should install the rest of PlayMaker.

I also sometimes had that problem when installing PlayMaker that the Welcome Screen only imports this sub-package but doesn't install its content, which means you have to do it manually.

6
Playmaker Help / Re: Unable to install custom actions
« on: May 06, 2018, 12:42:51 PM »
Since the Ecosystem consist of a lot of user submitted actions, there are also some which require additional PlayMaker packages or third party plugins, which you kind of have to figure out by their name or the error that shows up when you try to implement them.
In this case you need the ArrayMaker package (for every ArrayList or HashTable action), which you can also get from the Ecosystem or download from here and which will solve your second error.
Because you probably don't have any experience with ArrayMaker, I'd suggest that you watch a tutorial video like this one, before trying to use it.

The other error says that this particular action has a different class name than the file name, which means that you have to open the "ArrayListFindGameObjectsInsideCollider.cs" (or whatever it might be called in your Assets folder), look for the word that stands after "class" and make sure that the file name matches that.
That might be still a little mistake in that one action and its 2D counterpart.

If this was your first experience using the Ecosystem, than it didn't look like a pleasant one; but be assured that it's usually not that finicky, just that you immediately used one of the few actions that require additional dependencies.  ::)

7
The farthest path you describe is the distance from the NavMeshAgent to its current destination, but that isn't needed in your case.

You should grab the 'Path Finding' package from the Ecosystem if you didn't already, since it contains an exhaustive list of actions that covers pretty much all the basic stuff you can do with Unity's built-in pathfinding system. Everything more complicated should be created by combining these to achieve the desired result.
My own custom actions might also come in handy, namely "Find Closest Agent" and "Nav Mesh Agent Move To", which I've added to the attachments or can be found in the Ecosystem.

In your scenarios, everything that shouldn't be passable needs a "Nav Mesh Obstacle" component (use as many as you need), which represent a box or capsule collider (you can also make the capsule collider act as a sphere by reducing the height) that the NavMeshAgent not only doesn't go through, but also takes into account when generating the path, which means that it will automatically go around the obstacle, if you enable carving on it (this carves the collider size into the underlying NavMesh, making that section impassable by any agent | you can also make the collider bigger than the object itself, which increases the offset to that object when going around it and the collider boundaries of obstacles can even overlap or be nested to combine them).

For your first scenario you don't want your player to move to the goal directly, but rather add subsections where the agent moves to first (in this case add an empty GameObject where the gate is and set this as the target the agent should go to; after that you could warp the agent to the goal with the 'Agent Warp' action | I prefer to use empty GameObjects as placeholders when it comes to animations or subtargets, because you can move them more easily around in the editor than specifying Vector3 positions).
Here you can use the "Nav Mesh Agent Move To" action and because you added an obstacle component to the barriers, your agent will automatically search for the shortest way around them to the gate (of course you always need to bake your NavMesh in the 'Navigation' window when changing anything).

The second scenario is a bit more complex and I'm not quite sure how to achieve this, but still got some ideas:
- if those blocking units are static, by giving each of those a NavMesh Obstacle component and checking if the path is invalid/stale (don't know which one :P)
- by shooting a NavMesh Raycast (they are different from normal Raycasts) to the goal with the action "Agent Ray Cast" and checking if it hit any of the units
- by creating a path and continuously sampling its position ('Agent Sample Path Position'), then using that position with my "Find Closest Agent" action (every blocking unit would then need a NavMeshAgent component) and seeing if the distance is in a certain threshold (if that distance is bigger than your players size it should be able to pass through for example)

In the end you should experiment with the given actions from the Path Finding package or try to alter your approach.

8
@Marc Saubion
I though of that too and had that initially in the additional suggestion list, but the problem with that is, that you have to first set a field to 'None' before creating a new variable, which deletes/resets the value in that field.

9
I just came up with a great idea that would drastically improve managing variables and save quite a lot of time:

Directly setting the variable value when creating a new one in any action


(emphasis on the field between "animDelay" and the "Create Variable" button)

So whenever you want to add a new local or global variable or convert a hard-coded value to one, you can immediately set the value in the same small pop-up that allows you to set the name of the variable (a similar example would be the pop-up when adding an aspect ratio to the game view where you can specify multiple values).

Like that you wouldn't need to switch to the variables tab, search for the variable, select the variable and select the value field of the variable. That's more than 3 clicks and can add up to quite a lot of time when dealing with lots of variables every user would save with that option. And if you want to replace something with an FsmVariable you would also have to copy over that value to the variable-field in the variables tab, which is neither ideal nor any fun.


If you consider implementing this, here are additional suggestions that would make this most useful:
- the value field should match the type of variable to add (should be even enough space for the 3 fields of an FsmVector3 variable and you don't need to add any label next to it anyway)
- the default value for the variable type should be pre-set, so that it's complete optional to set the value directly
- on an object-field it should detect the type of object to be put in, if defined (e.g. Collider, AudioSource, ...);  it should also be possible to drag and drop matching objects into that field

10
Feature Requests / Re: Reset bool option on standard get next actions
« on: April 14, 2018, 02:46:31 PM »
I actually added a reset button to those default "get next" actions a short while ago while working on the DialogManager for my game, without even knowing that there seems to be a demand for that functionality.

As it turns out, there couldn't be anything more trivial: since those actions rely on caching the current index in a private variable which don't get reset when re-entering the action, so you have to do it yourself at the start of OnEnter(), like so:
Code: [Select]
if(reset.Value) nextItemIndex = 0; reset.Value = false;(as you can see I even added that the reset bool automatically gets set back to false after resetting the index, since there's no plausible reason to keep resetting the action, and if there is, one could just keep the bool set to true in the action after that "get next" action).

You can find the two customized actions for 'Array Get Next' and 'Get Next Child' in the attachments and I would also urge HutongGames to add that option to the standard actions, so that no one has to rely on these or their own custom actions just for that function (even though you rarely need it, it's very nice-to-have if one does).

11
Share New Actions / Re: ArrayList Find GameObjects Inside Collider
« on: April 13, 2018, 03:25:30 PM »
Yup, that was a mistake on my part.
In the original actions the GameObjects in the scene got searched by tag with the function "GameObject.FindGameObjectsWithTag()", which requires a tag to be specified and doesn't seem to allow the 'Untagged'-tag.
Since I naively assumed that it would just work to set the 'Untagged'-tag by default and only tested both actions with a specific tag, I didn't think 'Untagged' would cause any trouble.

I fixed this problem, which means you'd need to re-download the actions from the Ecosystem. Sorry for the inconvenience.

I also re-worked both actions to not only allow to filter by 'Untagged'-GameObjects but also made that tag filter completely optional, meaning you now can set the tag to 'None' and it ignores that tag filter, resulting in listing every GameObject regardless of the tag. The layer-filter is unaffected and can be used in conjunction with the tag-layer to narrow down, which GameObjects to capture.
Additionally, I implemented an error check when the collider target wasn't set and that when toggling the tag from 'None' to the tag-list it shows 'Untagged' instead of an empty entry (uses OnGUI so it might not always do that, but that would be just a minor inconvenience if not).


P.S.: If anyone is interested to know how any of these actions work (for clarity or performance reasons), here a short rundown:
- the action searches for each active GameObject in the scene (dudebxl's versions directly by tag, which is slightly more performant but forces you to define a tag, while mine search for any Object of type GameObject; in either case these actions should be repeated/used as scarcely as possible to reduce that overhead of constantly going through all GameObjects in the scene);
- it checks for each found GameObject if it matches the specified tag and layer;
- skips any GameObject that doesn't contain an appropriate collider component;
- gets the bounds of each collider, sees if it intersects the bounds of the user-defined collider and only lists the GameObjects that match all these criteria

12
You might also need to define the object type with the attribute 'ObjectType', like so:
Code: [Select]
[ObjectType(typeof(AudioClip))]
[ArrayEditor(VariableType.Object, elementName: "Clip")]
public FsmArray myArray;

In the list of supported action attributes you can also see that the "fairly new" attribute 'ActionTarget' could be exactly what you're looking for (I haven't seen any use for it yet and never tried it myself, so I don't know for sure).

Sidenote: The Reset() function is only to specify default values for the action variables so that shouldn't be the place to define what type of object an array is supposed to contain.

13
Playmaker Help / Re: ArrayListSort with vector3
« on: April 11, 2018, 12:55:55 PM »
Try
Code: [Select]
pos.Value.z
since your "pos" variable is probably a FsmVector3 and those FsmVariables are wrappers for their original counterparts containing additional extensions and support for their own custom PlayMaker fields.

So on every FsmVariable (like FsmGameObject, FsmString, ...) you access the value of that variable wrapper with .Value, check if it's set to none (in the Action) with .None and so forth.

Once you write pos.Value it behaves like a normal float variable and thus can be modified like one but note that when you want to set/overwrite the value for pos you'd have to also asign the new value to pos.Value.

Example:
Code: [Select]
//store the current value of pos
float tmpPos = pos.Value;
//this won't change the value for pos...
tmpPos += 3f;
//...you also have to overwrite the value of the FsmVector3
pos.Value = tmpPos;
---
//you could also directly set the value without another variable
pos.Value += 3f;

14
Playmaker Help / Re: CustomActionEditor Set FsmVar[] variable Issue
« on: April 04, 2018, 01:32:00 PM »
I replicated your setup because this remote maintenance proves quite difficult :).

It turns out that there is a problem with resizing the FsmVar[] xxxxx by creating a new object ("new FsmVar[fsmvars.Count]") and trying to use it immediately afterwards.

You can test it yourself by throwing a Debug.Log() at the end of BuildFsmVariableList(): whenever you try to do something with xxxxx, wheter updating, setting or getting a value to/from it, it seems to break the function without throwing any error, and anything afterwards won't get executed (as if that action variable gets corrupted or isn't accessible).

When you comment that resizing process out (
Code: [Select]
//action.xxxxx = new FsmVar[fsmvars.Count];), you'll see that it reaches the end of that function.

It might be that something needs to be done to the FsmVar[] after resetting/resizing it, but I think your best bet would be to go for a different collection variable if possible, like FsmArray which natively has a .Resize() function and can also hold any object type.
If you do, you should know that with FsmArrays you need to do the following when resizing/manipulating them (kind-of pseudo-code):
Code: [Select]
FsmArray array;
...
array.SetType.(...);
array.Resize(...);
for(...) {
array.Set(i, ...);
}
array.SaveChanges();


While setting up your scenario I also noticed that you were missing the UnityEditor using directive ( "using UnityEditor;" ), to get things like EditorGUI to work and you'd need to set the types to string before filling it with string values:
Code: [Select]
action.xxxxx[v].Type = VariableType.String;

I guess I can't help you any further than that. Maybe Jean or someone else sees this and might know what is going with FsmVar[]'s in such a scenario, but It could be that using an FsmVar[] is not be the desired approach and the reason that something like FsmArray exists.

15
Playmaker Help / Re: CustomActionEditor Set FsmVar[] variable Issue
« on: April 02, 2018, 12:32:11 PM »
Oh sorry, I thought PlayMakerUtils where a native thing in PlayMaker, but it rather seems to be an extension to it. You can get it from here (click on 'Clone or Download', 'Download ZIP', extract and put it in your "Assets" folder).
In there are also the helper methods "RefreshValueFromFsmVar" and "GetValueFromFsmVar" which might also help you out, but I think I the problem might be with how you set the variable in each single FsmVar:
try
Code: [Select]
action.xxxxx[v].SetValue(fsmArray.Name);or
Code: [Select]
action.xxxxx[v].stringValue = fsmArray.Name;instead of
Code: [Select]
action.xxxxx[v].variableName = fsmArray.Name;because ".variableName" seems to be the name of the FsmVar variable, not the value that you want to set.

Further thoughts:
When you tried the code in OnGUI() did you also return true at the end, so that it updates whenever something changes in that action? You could also try to put the "DrawDefaultInspector();" at the end of OnGUI() before returning true, so that it only draws the fields after you've modified their values.
Also IIRC, PlayMaker already provides a list of all FSMs in the current scene, just like "Fsm" gives you the current fsm as a variable or "Owner" returns the GameObject of the current FSM, but I don't remember how to access that list. Maybe you find something of that sort so that you don't have to search them through the resources.

Pages: [1] 2 3 ... 8