![]() |
![]() ![]() ![]() ![]() ![]()
|
Author | Topic: gold |
0 Ste 0 |
![]() i need the players to start off with 200 gold. when they buy an item from a shop, i will need some gold to be taken, if they dont have enough, it will need to say "you do not have enough gold". im using QDK for this (is there a topic in the manual about this?) |
MaDbRiT |
![]() Hi 0 ste 0 Yes there is - try looking under STATUS VARIABLES, they are intended for this kind of thing and there is a good example if I remember correctly. Al |
0 Ste 0 |
![]() lol, i got that far, all i need to know now is how to take gold away from people when they buy an item (im using QDK by the way, not coding in ASL). and, i need to know how to make it so when they die, they return to The Local Pub and lose all their gold, and have to start again. |
MaDbRiT |
![]() If you code it so that your player starts in 'The Pub' with no money, when he/she loses the game (i.e. when you invoke 'playerlose' - they will automatically be offered a "start again" option - and they'll start in "The Pub" - with no money... So I don't see where there is a problem on that one! To reduce the amount of 'gold' your player has when he buys something, you set the status variable exactly as if it were a regular numeric one. e.g. set <money;%money%-20> would reduce the amount of money by 20. Al |
MaDbRiT |
![]() Here's a very simple 'buying stuff' demo, made with QDK. I've used a 'custom player command' to do the work. You can see it by selecting the room, click "Edit Room", then select the "Misc" tab and click "Edit custom player commands". This is where I built the command that does the work.
quote: Hope that helps. Al |
0 Ste 0 |
![]() slight problem. when the player has 0 gold, and he tries to buy another, is goes to minus, making it so the player has infinate gold, and can get infinate items. |
0 Ste 0 |
![]() ive made it so that if he already has a long sword, he cant buy another. i trying to figure out how to make so that if he dont have a long sword he cant sell one lol. im still trying to find out how to stop the player from buying stuff when he has 0 gold. i guess ill have to use conditions for every buying system lol. |
0 Ste 0 |
![]() ok, after lots of fiddling i came up with it. for every buying system, i have to use this condition... IF player has object "sword" THEN msg "you cannot buy this" ELSE "blah dee blah dee blah" lol |
MaDbRiT |
![]() WHOAA!! You are making this MUCH too difficult! All you need is ONE 'buy' command, and to give every object you want it possible to buy at any time a 'price' property. Then in your buy command you... a: check the object has a price property (if it doesn't it isn't buy-able). If all the conditions are O.K. then you give the player the object and remove the value of its 'price' property from the player's money. If it fails at any stage you print an appropriate message to the player telling him why. This way coding one buy command will deal with all objects that have a price - makes sense - yes? By the same method, you can code one SELL command to deal with all the possible sell-able items, testing the price property again as a key and of course ensuring the player actually HAS the item he's trying to sell. I was well aware that the demo didn't prevent the player buying more than he has money to afford, I wasn't trying to offer you a complete solution, only to point you in the right direction so that you could solve it yourself! :-) Al |
0 Ste 0 |
![]() and i did, just in a more....slightly of course kind of way lol. thanks Al :) |