Resource managment

I wanted to create a game that deals with resources. Such as "wood" and "stone" which would then be used to build things.
Let's say you have a warehouse that can hold a combination of 50 resources and any excess would be lost. How would I code that? And how I be able to raise the 50 'cap'?


You could make status attributes like Wood: 10/50 Stone 12/30.
http://docs.textadventures.co.uk/quest/status_attributes.html
I don't know if there is a way to raise the bar, but you could, if you wanted to do it this way, there may really be an easier way, but create more than one player character, one for each level change. The status attributes change according to who or what the player character is, so you would change player object to "player 2" or whatever you would name the next player, add a script to make player2.wood =player.wood and another to make player.woodmax = 75 or 100 but all stats would have to upgrade at the same time, or in the same order. You would have to do the same things for player2.stone as player2.wood, even if player.stone was not changing at the same time.

That may be more work than it needs to be. There is possibly an easier way. At the same time, it is not a lot of work. But, of course, you would move everything in inventory to player2, as well And make sure player2 is moved to the room player is in, maybe right before the change, after which you would make player invisible or move player to an offsite room.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums