Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Bainto on June 24, 2018, 07:38:48 PM

Title: Vegetation System
Post by: Bainto on June 24, 2018, 07:38:48 PM
Im Also trying to figure out how to use playmaker in order to create a transition from 1 vegetation system layout to another based on a trigger or something along those lines. upon entering a building and reaching a point the vegetation changes so when they exit they see the new vegetation.
Title: Re: Vegetation System
Post by: djaydino on June 25, 2018, 04:24:03 AM
Hi.

There are probably different ways to do so, but it depends a bit also what platforms you are targeting.

But i think Load Scenes Async 'additive'would be the best way to go.

But if you are still new with PlayMaker, i would suggest you to follow some tutorials and make some simple projects to get familiar with PlayMaker.
And then start your main project

You can find many tutorials on the user tutorials wiki page (https://hutonggames.fogbugz.com/default.asp?W548), on the tutorial page (http://www.hutonggames.com/tutorials_game_design_with_playmaker.php) and on youtube

Here is a little tutorial about Load Scenes Async Additive :

Title: Re: Vegetation System
Post by: Bainto on June 25, 2018, 05:30:10 AM
I appreciate the help. Thank you :D
Title: Re: Vegetation System
Post by: Bainto on June 25, 2018, 06:25:37 AM
Ok so i watched the video but it didn't really answer my question on how to do this but ima do a few tests and try and figure it out. The video mostly covered different ways you may have errors but not on how to do this. a step by step video showing the setup would have been more helpful.

Also each package is an asset not a scene or a level. so maybe i need to know how to load and unload assets.
Title: Re: Vegetation System
Post by: djaydino on June 25, 2018, 09:45:47 AM
Hi.
On the video i am 1st showing these errors as it is very important to know this.
After that (around 6th minute) it is showing how to load/unload.

But you can have multiple scenes loaded and load/unload several parts.

Like in this tutorial (this is a c# tutorial, but if you understand the previous video then you can understand what is happening in this video)



So in your case you would load 'vegetation scene 2' and unload 'vegetation scene 1'  upon entering a building and reaching a point .
Title: Re: Vegetation System
Post by: verybinary on June 26, 2018, 07:30:35 AM
The building blocks you are essentially asking about are:
-make a global variable, lets call it "gameprogress", in a fsm that sets up everything, set this global to "0"(just in case it isn't 0 at startup)
-when you walk into the house, set up a trigger to check what progress is, if 0, maker it 1, if 1, make it two
-in the fsm that sets up your garden, have it look at gameprogress. if 0, load the dirt. if 1, load the sprouts. if 2, load full crops.

now walk in and out of the building, look at your crops. walk in and out again, they should be fully grown.

when it gets tested successfully, move it from global to a fsm int inside your garden fsm, and when you walk in the house(or whatever its set to), int add 1 to the fsm int. (but then again, that might not work, the garden may not be active when you are inside the house. you might need a gardenmanager object that stays active all the time? or just keep the global)
Title: Re: Vegetation System
Post by: Bainto on June 26, 2018, 07:12:12 PM
ty for the help :D ill take a look and see if i cant figure it out when i get home.
Title: Re: Vegetation System
Post by: Bainto on June 29, 2018, 02:14:14 PM
My problem so far is ending up with how to order everything is there a diagram someone can draw up or anything XD
Title: Re: Vegetation System
Post by: djaydino on June 30, 2018, 09:30:30 AM
Hi.
That is very depending on your game flow.

What do you have so far and what are you trying to achieve?
Title: Re: Vegetation System
Post by: Bainto on July 01, 2018, 01:59:54 AM
so far i tried using a trigger object (a cube set as trigger with mesh render off) set on a path as a test for when the player enters to do a Load Scenes Async Additive however that wont work as it wont work with the asset when i try to add it it comes up with a grayed out box with 2 choices that i cant click, so i added a path to the asset and that comes with no errors but wont work either.
Title: Re: Vegetation System
Post by: djaydino on July 01, 2018, 04:12:23 AM
Hi.

What asset?
Title: Re: Vegetation System
Post by: Bainto on July 01, 2018, 04:33:39 PM
Vegitation System on the unity asset store
Title: Re: Vegetation System
Post by: djaydino on July 01, 2018, 05:11:49 PM
Hi,
Can you share a link to that asset.

you will need to do things differently as you are using an asset
Title: Re: Vegetation System
Post by: Bainto on July 01, 2018, 11:02:03 PM
https://assetstore.unity.com/packages/tools/terrain/vegetation-studio-103389
Title: Re: Vegetation System
Post by: djaydino on July 02, 2018, 03:02:25 AM
Hi.
As i don't own the asset, i can't really see how they change the vegetation.

Best is to contact the Author and ask if he could support with playmaker actions.

You can also let him contact me if the author needs some help with that.
Title: Re: Vegetation System
Post by: Bainto on July 02, 2018, 06:30:09 AM
i know it works within the vegitation studio to where you can open each inside the studio, however he also advertises you can set it up to change seasons and other things while playing
Title: Re: Vegetation System
Post by: djaydino on July 03, 2018, 05:39:53 AM
Hi.

To change season you will need to do that in a script with some code.

But..
Many 3rd party asset uses certain code to work with their assets.
That code (which you would use i a script) can also be used for making actions for PlayMaker to be used with that asset.

The author can make PlayMaker actions to support its assets, or someone else can make them (but they would need to have a copy from the asset to see what code is used).

So it is best to contact the author from that asset 1st
Title: Re: Vegetation System
Post by: Bainto on July 03, 2018, 08:04:47 AM
will do, ty :D
Title: Re: Vegetation System
Post by: verybinary on July 03, 2018, 08:06:32 AM
that asset seems to be an extension on unity's terrain. I cant recall seeing any scripting that can change those at runtime...
unless im wrong about the usefulness of the terrain system, you might have to use the terrain system to build your world, and use standard game objects to create your vegetation that grows based on code.
Title: Re: Vegetation System
Post by: Bainto on July 03, 2018, 08:25:39 AM
What you can do is create 2 vegetation packages. 
They can both have different grass, trees etc.

when you want to, trgger or other game logic you call SetVegetationPackage on the VegetationSystem component and it will load the new vegetation.

I have not used Playmaker but I do not think there should be any problem to use both in the same project.

This is the reply i got.
Title: Re: Vegetation System
Post by: djaydino on July 03, 2018, 10:00:21 AM
Hi.

Probably the author has no idea what playmaker is...

You can explain to him that Playmaker is a 'visual scripting solution' that works with 'Action' (small scripts do do certain things in unity)
So that no coding is required when using PlayMaker.

I can see if i can make the action, but i need to know how to call SetVegetationPackage

Maybe you can find something in the documentation.

Probably the call is done, something like this :
Code: [Select]
using (namespace from script package)


void OnEnter()
{
SetVegetationPackage("package 1")
}
Title: Re: Vegetation System
Post by: Bainto on July 04, 2018, 05:01:20 PM
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Load_Vegitation : MonoBehaviour
{
     public VegetationSystem VegetationSystem;

    void OnTriggerEneter(collider other)
{
   VegetationSystem.SetVegetationPackage(1,true);
 
}
}

rough setup with c#
Title: Re: Vegetation System
Post by: 600 on July 04, 2018, 10:43:32 PM
I have it, you can change certain things at runtime with SetProperty action, but it may be buggy don't know why, it works on build but on editor it throws error sometimes.
Would be great if it had actions for PM.
Title: Re: Vegetation System
Post by: Bainto on July 04, 2018, 10:45:36 PM
I have it, you can change certain things at runtime with SetProperty action, but it may be buggy don't know why, it works on build but on editor it throws error sometimes.
Would be great if it had actions for PM.

what do you mean by this statement how would i add this and how would it help?

also this is what i got as a good start it allows me to setup the actual vegitationstudio and everything however upon entering it still does not change from the 0 package to the 1 package

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using AwesomeTechnologies;

public class Load_Vegitation : MonoBehaviour
{
    public VegetationSystem VegetationSystem;

    void OnTriggerEneter(Collider Load_Vegitation)
    {
        VegetationSystem.SetVegetationPackage(1, true);

    }
}

also i know Vegetation was misspelled, its just what i had called it and didnt change it .. brain fart lol
Title: Re: Vegetation System
Post by: 600 on July 04, 2018, 11:51:56 PM
I am using to change spawn rate at runtime.
Drop the Vegetation system script in Set Property and it will show available options to change.
Title: Re: Vegetation System
Post by: djaydino on July 05, 2018, 01:09:09 AM
Hi.
Get/Set properties can indeed be buggy sometimes especially for mobile.
You will need to use the Linker Wizard (http://hutonggames.com/playmakerforum/index.php?topic=11126.0)

I have contacted Lennart (the author from this asset) thru discord,
So lets see what will happen :)
Worst case you can sponsor me so that i can purchase (i do not need this asset so i am not planning the purchase this myself) the asset and i can make actions for you.
Title: Re: Vegetation System
Post by: Bainto on July 05, 2018, 10:41:44 AM
ok so i figured this out so far... i tried using playmaker and logically doing this and got it to work but it throws an error on trigger enter. it actually throws 655 if the same error.
ArgumentException: only single dimensional arrays are supported for the requested action.

this is what i came up with

Trigger Enter -> Call Method (Behaviour = VegetationSystem, Method = SetVegetationPackage, Index = 1) -> Exit Trigger -> Destroy Object (trigger)

This actually works and calls the correct asset however it really lags the scene almost like it freezes and and then actually freezes the char but i can still ctrl p and stop the game to edit

any ideas?
Title: Re: Vegetation System
Post by: Bainto on July 05, 2018, 10:42:30 AM
Also i tried using the SetProperty action but it didnt get the results i wanted
Title: Re: Vegetation System
Post by: Bainto on July 05, 2018, 10:56:39 AM
ok so i shrunk the trigger to basically the player runs into and and runs out of it causing the trigger to trigger and be destroyed almost immediately. this removes the freeze problem (idk why) but it comes up with 655 different errors saying that i cant use destroy object i must use destroy. And just like before however, i get this wierd gray blob the moves on the screen at the center of the screen. lol
Title: Re: Vegetation System
Post by: Bainto on July 06, 2018, 07:33:51 AM
this is one of the errors i get. I redid the setup and now its not giving me the other 1 and i dont even have it set to destroy so i think it has something to do with the fact that its destroying the 1st vegetation package. This also contains the visual error probably having to do with the Destroying GameObjects immediately error.
Title: Re: Vegetation System
Post by: Bainto on July 08, 2018, 08:09:18 AM
would this work?
"It seems like you can not destroy objects in the trigger event.

Try setting a local boolan to true and then testing this in Update() doing the code there.
Then setting the boolean back to false.

this way you move the code to update from the trigger. "

this is what the author said. and how would i add this in if so?
Title: Re: Vegetation System
Post by: 600 on July 10, 2018, 02:10:34 AM
I have contacted Lennart (the author from this asset) thru discord,
So lets see what will happen :)
Worst case you can sponsor me so that i can purchase (i do not need this asset so i am not planning the purchase this myself) the asset and i can make actions for you.
I like this idea, if Lennart do not want to port to PM, we could do the sponsorship way some time in August. Until then we could gather action requests here.
Title: Re: Vegetation System
Post by: Bainto on July 10, 2018, 09:34:01 AM
that would be awesome lol
Title: Re: Vegetation System
Post by: Bainto on July 15, 2018, 11:42:40 PM
so i actually full screened the game to see more of what was happening when i got this error both of it not being able to be used on multiple arrays as well as for when it gives me the visual error with this grey splotch on the screen where as i move it goes crazy. When i actually max screened the game and got this error the other trees from the original package were shooting out of it and moving. idk if this helps but its some extra info. Ill post a pic of the problem.
Title: Re: Vegetation System
Post by: Bainto on July 18, 2018, 12:36:40 AM
Thank you :D

For? XD
Title: Re: Vegetation System
Post by: Bainto on July 19, 2018, 04:04:29 AM
I've tried both creating a c# script and using playmaker
Playmaker lets me get to the error so it actually does something but the script does nothing lol, even though it came untested from the creator
Title: Re: Vegetation System
Post by: djaydino on July 19, 2018, 01:29:11 PM
Hi.
If you get the error also in script it is best to contact the author :)
Title: Re: Vegetation System
Post by: Bainto on July 19, 2018, 04:18:49 PM
i created a script in collab with the author and they said it was untested, just a thought on how it should go, and it did absolutely nothing. Ive also contacted them about the error on the actually working but screwy playmaker script i made lol
Title: Re: Vegetation System
Post by: djaydino on July 20, 2018, 12:13:43 PM
Hi.
If he can send me a copy/voucher from his asset i can make the action and he can add then to his asset.

I can't really help if i do not have the asset.