Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: mistral on Thu 13/04/2006 20:58:11

Title: money systems
Post by: mistral on Thu 13/04/2006 20:58:11
 ???hi, im having trouble with adding a money system into my game, please can someone help me out with it, and yes i read the manual and the bfaq, thanx!! :=
Title: Re: money systems
Post by: DoorKnobHandle on Thu 13/04/2006 21:10:15
What's the problem? Did you try it yet or don't you know how to start at all?

Just use variables (look them up in the manual) and if-statements as well as simple addition and subtraction to give or take money from or to the player and check whether he has enough to - for example - buy a certain item or whatever.
Title: Re: money systems
Post by: R4L on Thu 13/04/2006 21:22:09
Well you could do this:

Use the GameScore for money. You could add score when you wanted and keep track of money pretty easily. Or:

You could use a varible. You would create a varible called cash, or whatever, then you set its value say 100 for 100 dollars. Then, if you wanted to display it on the GUI you could do this:

In repeatedly_execute in global script
string temp;
StrFormat(temp,"%d",GetGlobalInt(1));//one being cash
lblLabel.SetText(temp);//where lblLabel is the label name


This means that if you had a label 3, it will take the values of GI 1 and print it out to the label you request. since it's repeatedly execute, it will constantly update.

Hope I helped.