playMaker

Author Topic: ...just another big Custom Action collection (A-L)  (Read 3927 times)

Deek

  • Full Member
  • ***
  • Posts: 112
    • View Profile
Re: ...just another big Custom Action collection
« Reply #15 on: January 19, 2018, 06:48:18 PM »
@Voa
Thanks for your feedback and sorry for the late reply (busy workweek).
I've noticed that error message already back then when creating that action but started to ignore it, since there were a few ways to circumvent it; though I knew that this was anything but ideal.
That's why I looked into it (and also because of your "reminder" :P ), created a better version and found out a few things on what caused it.

tl:dr
You can now get the improved and working action "Send Events" from the Ecosystem, should likely convert any 'Send Event Multi' actions to that and delete the SendEventMulti.cs from your Custom PlayMaker Actions folder (or keep it if you want).

Details:
The problem was, that the default 'Send Event' action uses an FsmEventTarget (Self, Broadcast, ...) and an FsmEvent variable, which get linked internally, so that depending on the selected EventTarget, the Event either only shows global variables or also local ones and automatically checks if the selected target does have the global event or not.
Since I was using an FsmGameObject[] (-Array) instead of FsmEventTarget in my "Send Event Multi"-Action, the FsmEvent variable had no target at compile time to check against, thus it always showed all available events and threw an error if it couldn't find a matching event/transition by default.

First I created another version with an FsmEventTarget[] instead of the FsmGameObject-Array, but that also didn't seem to work and made everything more bloated + you had to click more often to set up even one entry.

After that I thought of letting the user only define the EventTarget once and have him be able to select several of these targets, but since I couldn't directly manipulate the FsmEventTarget class itself and intervene it's functionality, I had to create my own version of it by creating a custom inspector that mimics the default functionality by only showing the relevant fields depending on the selected target type and hooked up matching functionality in the actual action.
I've added even more options than the standard version provided, like only sending events to FSMs with the right FSM-name, searching for SubFSMs by their name and hiding/disabling the delay field when either Broadcast All or Every Frame is selected.
But even after that, the error still showed up and I couldn't find a way to tell the FsmEvent that it should only show global events when a certain EventTarget was selected, until I found that someone already posted a similar problem on this forum (here).
I adapted that "temporary" fix (since it seems like he didn't add that NoErrorCheck-attribute) to get the FsmEvent into thinking that there is an FsmEventTarget available which won't get drawn by my custom inspector and now it stops showing that pesky error.

So the final result isn't 100% perfect, but at least way better than my inital attempt.

craigz

  • Full Member
  • ***
  • Posts: 125
    • View Profile
    • Haven Made
Re: ...just another big Custom Action collection
« Reply #16 on: March 08, 2018, 01:02:32 PM »
Hey @Deek!

Saw you asking questions on the Unity Forum for Game Data Editor :)

Gotta say, I discovered the asset from your actions for it here a few months back, and seriously it is SO awesome :) thanks for taking the time to write all these actions for it. It's made my life so much easier :D

Also! Did you end up getting the delete item action to work you were talking about with Celeste? I'm looking into reworking my player inventory and that would be huuugely useful xD

best,

craigz

Deek

  • Full Member
  • ***
  • Posts: 112
    • View Profile
Re: ...just another big Custom Action collection (A-L)
« Reply #17 on: March 10, 2018, 07:25:20 AM »
@craigz

Thanks for your kind words.

I was actually spending the last few weeks creating a helper class for GDE containing various useful functions for the GDE PlayMaker actions, because there was a lot of redundancy in them (unnecessary duplicate code); meaning that you will also need that script to make most of the other actions work, but also that there are now even more actions for GDE available :)

Additionally, I've combined the Add Int, Add Float, Multiply Int and Multiply Float into Float Operator and Int Operator, but you can still use the old versions in your project if you want.

With Celeste's help I also figured out how to remove items, though I'm not quite convinced that it works 100% of the time, that's why it would be great if you could also test the action "GDERemoveItem". To debug the ModifiedData dictionary, I've also created the GDEDebugData action, to make that process more simple.

Currently, there's also a problem with GDECreateItem not applying the field values, so you should stick to the previous version until I fix that (and GDEFind is currently not finding any Field Types, but that's a minor issue). If you run into any problem with the new actions, don't hesitate to notify me.

P.S.: Because of the character limit on this topic I had to split it in half, which means that the third party section is now on this post if you're looking for updates, because I'm not done with creating actions for GDE yet :D


Edit (important):
Now I know why I wasn't quite convinced: In order to completely remove an Item from the GDE data it's for some reason also necessary to remove the Item from the DataDictionary, not just the ModifiedData. I adjusted the function so now it removes any Item correctly 100% of the time.
I also bundled the current version of my GDE actions so that you (or anyone interested) doesn't need to download my whole repo or has to copy over each single script individually (see attachments).
« Last Edit: March 11, 2018, 10:13:43 AM by Deek »

craigz

  • Full Member
  • ***
  • Posts: 125
    • View Profile
    • Haven Made
Re: ...just another big Custom Action collection (A-L)
« Reply #18 on: April 19, 2018, 12:17:28 PM »
Deek!

I am SO sorry again for the late response, I forgot to click notify on the thread xP

Ahh! :D I'm so excited to play with these actions, thanks for making an operator for the float/int interactions as well, I had ended up building out a few of them that I needed, but combined is WAY more practical :)

Saw your edit change on the other topic, so I'll be sure to download the actions from your repo instead. So, SO useful :D

-craigz



craigz

  • Full Member
  • ***
  • Posts: 125
    • View Profile
    • Haven Made
Re: ...just another big Custom Action collection (A-L)
« Reply #19 on: June 21, 2018, 02:05:50 PM »
Hey Deek! :D

Just wanted to give a shout, I'm having issues with the (more) updated version of GDE Bool Test, for some reason if I point it towards an older GDE bool I've created, it works no problem, but any of my new ones I've made I get a 'InvalidCastException' from xD

Any ideas? :/

-craigz

*EDIT: I'm primarily using the action in a template, but am getting the issue in and out of a template.

Code: [Select]
InvalidCastException: Cannot cast from source type to destination type.
HutongGames.PlayMaker.Actions.GDEBoolTest.CheckGDEBool () (at Assets/PlayMaker Custom Actions/UsefulUnityUtilitiesMaster/Custom PlayMaker Actions/_ThirdParty/GDE Customs/GDEBoolTest.cs:56)
HutongGames.PlayMaker.Actions.GDEBoolTest.OnEnter () (at Assets/PlayMaker Custom Actions/UsefulUnityUtilitiesMaster/Custom PlayMaker Actions/_ThirdParty/GDE Customs/GDEBoolTest.cs:40)
HutongGames.PlayMaker.FsmState.ActivateActions (Int32 startIndex) (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:205)
HutongGames.PlayMaker.FsmState.OnEnter () (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:175)
HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state) (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2695)
HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState) (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2642)
HutongGames.PlayMaker.Fsm.UpdateStateChanges () (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2570)
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state) (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2711)
HutongGames.PlayMaker.Fsm.Update () (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1934)
HutongGames.PlayMaker.Actions.RunFSMAction.OnUpdate () (at Assets/PlayMaker/Actions/RunFSMAction.cs:55)
HutongGames.PlayMaker.FsmState.OnUpdate () (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:265)
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state) (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2710)
HutongGames.PlayMaker.Fsm.Update () (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1934)
PlayMakerFSM.Update () (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:539)
« Last Edit: June 21, 2018, 02:15:12 PM by craigz »

craigz

  • Full Member
  • ***
  • Posts: 125
    • View Profile
    • Haven Made
Re: ...just another big Custom Action collection (A-L)
« Reply #20 on: June 22, 2018, 07:48:51 PM »
Sorry for the double post :) also wanted to ask if you know of any way with the current actions to reset a particular item at run time? (all of its fields) Rather than having to manually reset them all xP

I have a feeling there might already be a way and I'm overlooking a term, but I though I should ask :D

Thanks again Deek for all these rad actions! :D

-craigz

Deek

  • Full Member
  • ***
  • Posts: 112
    • View Profile
Re: ...just another big Custom Action collection (A-L)
« Reply #21 on: June 24, 2018, 10:32:55 AM »
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).

craigz

  • Full Member
  • ***
  • Posts: 125
    • View Profile
    • Haven Made
Re: ...just another big Custom Action collection (A-L)
« Reply #22 on: June 24, 2018, 09:20:23 PM »
AH! :D

Deek you are seriously the best :) you make me feel invincible with GDE! :D

So a huge thank you for the updates and the scripts, it really means a lot to me. I'm pulling them in now.

Good call on double checking for existing an Item/Field, always my first gut call :) good to know that's what the InvalidCastException is usually meaning.

best,

craigz