Take Away Coin After Losing Match

Share your feedback or ideas
Post Reply
User avatar
mikalburrows
Contributor
Contributor
Posts: 36
Joined: Tue Nov 05, 2019 4:10 pm

It would be cool if there was an option for the coin system. That if a player loses a match he/she also loses X amount of coins.
User avatar
Lovatto
Admin
Admin
Posts: 1834
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

That sounds more like a personal modification for me :)
You can do it in bl_GameFinish.cs -> CollectData() -> you will see a local variable called "winner" you can use it to check if the player lose the match (winner == false), so if the codition is true (winner == false) -> deduct coins from the player with:

Code: Select all

 bl_DataBase.Instance.SubtractCoins(COINTS_TO_LOSE);
How to find your Invoice Number: Here
How to find your Order Number: Here
User avatar
mikalburrows
Contributor
Contributor
Posts: 36
Joined: Tue Nov 05, 2019 4:10 pm

Lovatto wrote: Fri Nov 15, 2019 12:05 pm That sounds more like a personal modification for me :)
You can do it in bl_GameFinish.cs -> CollectData() -> you will see a local variable called "winner" you can use it to check if the player lose the match (winner == false), so if the codition is true (winner == false) -> deduct coins from the player with:

Code: Select all

 bl_DataBase.Instance.SubtractCoins(COINTS_TO_LOSE);
I am pretty novice Dev, and while this seems fairly simple in concept to implement I'm not sure if I understand exactly what and where to add to that script. Sorry if my questions are very noobish. I love your product and want to learn it more.
User avatar
mikalburrows
Contributor
Contributor
Posts: 36
Joined: Tue Nov 05, 2019 4:10 pm

Okay so I was able to implement subtracting coins on lost match but does not reflect on the game finish page. How I do I make it display that you have lost coins?
User avatar
Lovatto
Admin
Admin
Posts: 1834
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

If you're not using Localization addon, in bl_GameFinish.cs find this line:

Code: Select all

CoinsText.text = string.Format("+{0}\n<size=9>COINS</size>", coins);
and replace with:

Code: Select all

        if (winner)
        {
            CoinsText.text = string.Format("+{0}\n<size=9>COINS</size>", coins);
        }
        else
        {
            CoinsText.text = string.Format("-{0}\n<size=9>COINS</size>", LOSS_COINS);
        }
replace the "LOSS_COINS" with the same parameter that you set in bl_DataBase.Instance.SubtractCoins();
How to find your Invoice Number: Here
How to find your Order Number: Here
User avatar
mikalburrows
Contributor
Contributor
Posts: 36
Joined: Tue Nov 05, 2019 4:10 pm

Awesome worked perfect. Thanks Lovatto.
Post Reply