Some script question

Some script question

Postby sinisa3games » 10 Feb 2018, 16:44

Is there a script like
If tux coins>500
then tux coins -500 ?
sorry im new :cry:
'Ello
User avatar
sinisa3games
 
Posts: 117
Joined: 08 Feb 2018, 20:45
Location: Right over there

Re: Some script question

Postby mteufel » 10 Feb 2018, 16:50

There might be. But SuperTux is supposed to be a fun game. This seems to be something mean. So don't do it (and that's why I won't provide support on this, either).
SuperTux developer
mteufel
 
Posts: 139
Joined: 03 Jan 2016, 09:27

Re: Some script question

Postby sinisa3games » 10 Feb 2018, 16:52

i meant it like a shop
'Ello
User avatar
sinisa3games
 
Posts: 117
Joined: 08 Feb 2018, 20:45
Location: Right over there

Re: Some script question

Postby mteufel » 10 Feb 2018, 18:59

You can use
{l Code}: {l Select All Code}
sector.Tux.add_coins(amount);
in a level, where amount can also be a negative integer (it will then take Tux's coins).

However, there is, at the time of writing this, no way of checking whether Tux has enough coins. So a store would be quite silly. (The player could still buy stuff, without enough coins)

We might integrate the concept of a store in the main game in the future, though.
SuperTux developer
mteufel
 
Posts: 139
Joined: 03 Jan 2016, 09:27

Re: Some script question

Postby sinisa3games » 10 Feb 2018, 19:02

wait, can tux have minus coins? :shock:
'Ello
User avatar
sinisa3games
 
Posts: 117
Joined: 08 Feb 2018, 20:45
Location: Right over there

Re: Some script question

Postby mteufel » 10 Feb 2018, 21:05

No. But when you add negative coins, they will be taken from Tux (imagine, you have some coins. you owe someone else some coins. if you add to something you have (positive coins) some debt (negative coins), you will have less coins). At some point, it will reach 0 points. You can then still take Tux coins away, but none will actually be taken because Tux can't have less than 0 coins. Hence, Tux can buy everything in your store, without paying anything.
SuperTux developer
mteufel
 
Posts: 139
Joined: 03 Jan 2016, 09:27

Re: Some script question

Postby sinisa3games » 10 Feb 2018, 21:12

is coin checking going to be added?
'Ello
User avatar
sinisa3games
 
Posts: 117
Joined: 08 Feb 2018, 20:45
Location: Right over there

Re: Some script question

Postby manuel » 10 Feb 2018, 22:37

Adding a shop to the game was at least a suggestion for the next release. Therefore, it would make sense to add something like this, but I really don't know. (And I'm no developer).
manuel
 
Posts: 190
Joined: 19 Sep 2017, 09:03

Re: Some script question

Postby mteufel » 11 Feb 2018, 10:55

It has been added (well, I'm only awaiting review) to the development version soon: https://github.com/SuperTux/supertux/pull/763.

In future releases you will be able to use something like this:

{l Code}: {l Select All Code}
if (sector.Tux.get_coins() > 50) {
    sector.Tux.add_coins(-50);
    sector.Tux.add_bonus("fireflower");
}
SuperTux developer
mteufel
 
Posts: 139
Joined: 03 Jan 2016, 09:27

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron