|
Post by illustrator on Aug 14, 2019 17:43:00 GMT
There's "Restart game" button on Game Status Panel. Is there a way I can use Playmaker to trigger the "Restart game"?
|
|
|
Post by DarkTonic Dev on Aug 14, 2019 19:10:59 GMT
The code behind that method just calls a static method, so if you can call a static method from Playmaker, then yes. Otherwise no, without coding up a Custom Action. You need to call this:
LevelSettings.RestartGame();
|
|
|
Post by illustrator on Aug 14, 2019 19:16:59 GMT
So like this?
Class name is: LevelSettings Method name is: RestartGame
|
|
|
Post by DarkTonic Dev on Aug 14, 2019 19:27:01 GMT
Yeah, that should work.
|
|
|
Post by illustrator on Aug 15, 2019 4:47:23 GMT
I get "class is invalid: LevelSettings" This Playmaker FSM is on the same game object where Level settings script component is.
|
|
|
Post by DarkTonic Dev on Aug 15, 2019 5:03:03 GMT
I get "class is invalid: LevelSettings" This Playmaker FSM is on the same game object where Level settings script component is.
Does it require you to enter the namespace of the class too? If so, class would be "DarkTonic.CoreGameKit.LevelSettings". If that doesn't do it, I think you're going to need to ask Playmaker support or look up the documentation for that Custom Action. I haven't used it and it didn't exist when I learned Playmaker.
|
|
|
Post by illustrator on Aug 15, 2019 14:34:04 GMT
Yes it seems to need the namespace of the class. I entered the information and the error message is gone but now when I enter play mode and it triggers the state switch I get:
"Unsupported type: null"
On the "Call static method" action there's a field to type parameter. Does the RestartGame method need parameters? Can you tell from the below console output if this error is caused by Playmaker or Core GameKit?
Unsupported type: null UnityEngine.Debug:LogError(Object) HutongGames.PlayMaker.FsmVar:SetValue(Object) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmVariables/FsmVar.cs:808) HutongGames.PlayMaker.Actions.CallStaticMethod:DoMethodCall() (at Assets/PlayMaker/Actions/ScriptControl/CallStaticMethod.cs:92) HutongGames.PlayMaker.Actions.CallStaticMethod:OnEnter() (at Assets/PlayMaker/Actions/ScriptControl/CallStaticMethod.cs:44) HutongGames.PlayMaker.FsmState:ActivateActions(Int32) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:205) HutongGames.PlayMaker.FsmState:OnEnter() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:175) HutongGames.PlayMaker.Fsm:EnterState(FsmState) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2771) HutongGames.PlayMaker.Fsm:SwitchState(FsmState) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2718) HutongGames.PlayMaker.Fsm:UpdateStateChanges() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2643) HutongGames.PlayMaker.Fsm:DoTransition(FsmTransition, Boolean) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2685) HutongGames.PlayMaker.Fsm:ProcessEvent(FsmEvent, FsmEventData) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2273) HutongGames.PlayMaker.Fsm:Event(FsmEventTarget, FsmEvent) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2376) HutongGames.PlayMaker.Fsm:Event(FsmEvent) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2457) HutongGames.PlayMaker.Fsm:Event(String) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2444) PlayMakerFSM:SendEvent(String) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:731) CGKPlaymakerUtility:SendEventIfValid(PlaymakerEventSetting, Dictionary`2) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Utility/CGKPlaymakerUtility.cs:74) LevelSettingsPlaymakerListener:GameOver(Boolean) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Level/LevelSettingsPlaymakerListener.cs:45) DarkTonic.CoreGameKit.LevelSettings:set_IsGameOver(Boolean) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Level/LevelSettings.cs:1705) DarkTonic.CoreGameKit.InGameWorldVariable:EndGameIfIntInRange() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/WorldVariables/InGameWorldVariable.cs:174) DarkTonic.CoreGameKit.InGameWorldVariable:set_CurrentIntValue(Int32) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/WorldVariables/InGameWorldVariable.cs:66) DarkTonic.CoreGameKit.InGameWorldVariable:SetIntValueIfAllowed(Int32) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/WorldVariables/InGameWorldVariable.cs:204) DarkTonic.CoreGameKit.InGameWorldVariable:AddToIntValue(Int32) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/WorldVariables/InGameWorldVariable.cs:245) DarkTonic.CoreGameKit.InGameWorldVariable:ModifyVariable(WorldVariableModifier) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/WorldVariables/InGameWorldVariable.cs:128) DarkTonic.CoreGameKit.WorldVariableTracker:ModifyPlayerStat(WorldVariableModifier, Transform) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/WorldVariables/WorldVariableTracker.cs:183) DarkTonic.CoreGameKit.Killable:ModifyWorldVariables(WorldVariableCollection, Boolean, Boolean) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Combat/Killable.cs:931) DarkTonic.CoreGameKit.Killable:PerformDeath(String, Boolean) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Combat/Killable.cs:961) DarkTonic.CoreGameKit.Killable:LateUpdate() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Combat/Killable.cs:517)
|
|
|
Post by illustrator on Aug 15, 2019 14:45:56 GMT
Okay, I noticed that it's probaly on Playmakers side because it seems to need a variable to store something. I put it like it's on the attached screenshot and there are now no errors but the game does not restart or at least the game status does not change it stays on Game Over. Any advice?
|
|
|
Post by illustrator on Aug 15, 2019 15:03:49 GMT
Hmm.. I needed to check the "Every frame" check box. It's working, maybe...
|
|
|
Post by DarkTonic Dev on Aug 15, 2019 15:48:07 GMT
No that method doesn't take any parameters. You definitely don't want to do "every frame", and it could trigger more than once. Also, there is no value to store because the return type of the method is "void" i.e. no return value.
You will need to consult Playmaker support for help on how to call "void methods", I don't know.
|
|
|
Post by illustrator on Aug 15, 2019 18:16:12 GMT
Thanks. I found out that if I try to put a variable there Playmaker informs me that it is not needed because the method does not return value. I mainly put this information here in case someone else is using Playmaker with Core GameKit and stumbles upon same problems. But anyway, it's working now.
|
|
|
Post by DarkTonic Dev on Aug 15, 2019 18:54:36 GMT
Awesome.
|
|