Page 1 of 1

Generic Game Objects

Posted: Sun Jul 07, 2019 1:16 am
by ez2ciamaprincess
Hi,
I'm just learning the framework and was trying to find a way to have an unlock for coins for items that are attached to my player. The way I have it set up is the player has hats rigged to the character as children and I turn them on and off with button click. I want to know how to charge coins for the hat and enable it. What would be the best way to do this. Any help would be great! I have tried level unlock as an item and generic game object and I can't seem to understand it. Is there some code snippet I can add to a button that checks if the player has enough coins and unlocks??

Also If it would be easier to just buy a panel with all my buttons on it?

Wonderful Framework!

Also... Localisation key L1.Name not found for language English (index 0).

I keep getting this error..

Re: Generic Game Objects

Posted: Wed Jul 10, 2019 7:58 am
by mahewitt
Hi,

You can access the current players coins / score through GameManager.Instance.Player.Coins / GameManager.Instance.Player.Score. You could also look at the ConditionalAction component to automatically display different gameobjects based upon the players coins / score.

For the localisation error - the getting started tutorial should contain steps on what is needed.

http://www.flipwebapps.com/unity-assets ... tutorials/

Regards,
Mark

Re: Generic Game Objects

Posted: Sat Jul 13, 2019 11:40 am
by ez2ciamaprincess
Thank You,

Is there any tutorials on Generic lock Setup? Or do they work the same as level locks?

Re: Generic Game Objects

Posted: Wed Jul 17, 2019 2:49 pm
by mahewitt
Everything uses the same base 'GameItem' class, so the principles should the same whether using Levels, Worlds, Players, ....

Re: Generic Game Objects

Posted: Sun Jul 21, 2019 8:28 am
by ez2ciamaprincess
I think I figured out most of it all except The conditional item part. How would I set up a condition that turns on an item from the character (Customizer Game) only if they have enough coins to enable it. Im confused. Is this a player or character? I dont know how to set this up properly.

Re: Generic Game Objects

Posted: Thu Jul 25, 2019 7:17 pm
by mahewitt
Using the ConditionalAction you can do something like the following:
Capture.png
Capture.png (40.53 KiB) Viewed 2939 times
Although this would only affect the display and you will have more control accessing the API through code. The 'Player' is the one that collects coins score (think the one playing the game). Characters are items within the game e.g. Mario, Luigi, or types of cars.

Re: Generic Game Objects

Posted: Mon Jul 29, 2019 2:45 pm
by ez2ciamaprincess
Thank You So much for taking the time and helping me!

Im just not sure this will work with how I have my game setup.

I did find a work around, But Im getting errors on scene change:

-----------------------------------------------------------------------------------------------------------
You are trying to remove a handler that isn't registered for UpdateMessage
Assertion failure. Value was False

Expected: True
-----------------------------------------------------------------------------------------------------------

I was trying to let the user buy a character button with the click to buy and unlock option.
Once the player has enough coins to unlock the character button it performs as it should,

I added a conditional action to destroy the character button (I tried disable too) after the player buys the button and removes the coin amount
the button destroys itself and then I have my button under the character button that alows the player to turn on "a hat" and change the colors etc.
everything works how I want it to, Untill I switch scenes (Main Menu).

Im pretty sure something is going on with the destroy button part and causing the error when I switch scenes.

I think there is no way around this unless you know what the issue might be? Otherwise I am out of ideas on how to make this work.

Re: Generic Game Objects

Posted: Sun Aug 04, 2019 10:33 pm
by ez2ciamaprincess
I got it working! So Happy!!

Re: Generic Game Objects

Posted: Mon Aug 05, 2019 7:29 pm
by mahewitt
glad to hear :D