Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: AndersM on Wed 13/07/2005 21:19:25

Title: Score as money
Post by: AndersM on Wed 13/07/2005 21:19:25
Many years ago I asked about some way of using score as money. i got an working answer then, but i lost it.

I'ts easy to add / remove score if the player buys / earns money, but the thing is how to solve the problem if the score is to low.

like if he tries to buy something that cost $ 100 and only have the score 50. there would be some kind of

'if score < 100 display 'you cant afford that'

any suggestions?
Title: Re: Score as money
Post by: Rui 'Trovatore' Pires on Wed 13/07/2005 21:22:20
...there is. ain'0t there? game.score? Or something to that effect?
Title: Re: Score as money
Post by: Ubel on Wed 13/07/2005 21:36:01
Yes, for example (this script is for 2.6):

if (game.score < 100) {
Ã,  Display ("You don't have enough money.");
}
else {
Ã,  Display ("You bought it.");
Ã,  AddInventory (1);
}

That could work.
Title: Re: Score as money
Post by: Pod on Wed 13/07/2005 23:21:55
you forgot to remove the money from the game score :)
This way, he'd get things for free!
Title: Re: Score as money
Post by: Bad Voo-doo man on Thu 14/07/2005 10:35:41
Couldn't you just use a global int, and display it somewhere on the screen or something to that effect?
Title: Re: Score as money
Post by: Gilbert on Thu 14/07/2005 10:49:48
Yes, but game.score is just one lazy super easy method if you don't need that to serve other purposes.
Title: Re: Score as money
Post by: Nethros on Sun 17/07/2005 14:38:30
Pablo, You must be lucky never paying for something you buy! ;) I'll change your script so It is how most the people trades stuff. :D

if (game.score < 100) {
Ã,  Display ("You don't have enough money.");
}
else {
Ã,  Display ("You bought it.");
Ã,  AddInventory (1);
Ã,  [B]GiveScore(-100);[/B]
}


This does something like this:

This is if he DIDN'T have enough money.

Trader: Hello!
Girlbrush Peepwood: Hello!
Trader: Wanna buy a car for 100$?
*Girlbrush doesn't have that much.*
Girlbrush Peepwood: I don't have that much, sorry.

Now if he HAD 100$

Trader: Hello!
Girlbrush Peepwood: Hello!
Trader: Wanna buy a car for 100$?
*Girlbrush has that much.*
Girlbrush Peepwood: Sure thing, here's the dough!
*Guybrush gives the Trader 100$ and recieves the car in his inventory. (Really, These stuff is annoying me. HOW THE HELL CAN PEOPLE CARRY AROUND BIG STUFF IN THEIR POCKETS? I know my game characters does it too, but It's just weird!)*

I added GiveScore(-100);. If you use the minus it will be negative and you will LOSE score instead of GETTING score. I had a posted a thread like this, asking about exactly same thing.

PS: In the script, there is nothing that has to do with Girlbrush ;)

Hope this helps. And most thanks to Pablo, I wouldn't know the script if he didn't post it ;)
Title: Re: Score as money
Post by: Ubel on Sun 17/07/2005 15:18:19
I just thought it would be much nicer if you got everything for free... ::)

Okay okay, I forgot it. Thanks for correcting me.
Title: Re: Score as money
Post by: Nethros on Sun 17/07/2005 15:33:40
No problem ;) And you're right, I'm so poor I can't even buy World of Warcraft.  :(