I have several things on my (Coding) To Do list and number one is:
Treasure chests...or something of the sort.
So i assume i create an object (obviously)
and set it on the map (obviously)
But how to give make it give a certain reward, or perhaps a random reward(and how to go about doing so)?
First ideas that come to mind!
Option 1: Set reward
What i mean here is:
I'd probably have to make 1 chest for each different amount of reward: Giving money, or stats would be easy, but what if i wanted to give the player a sword?
Option 2: Completely Random
And here I mean:
All rewards in the chest would simply be absolutely random, from items, to gold, to stat bonuses....would i need a list for this?
Option 3: Slightly Random based on users stats
And the most advanced way i assume
Would to monitor what players would get, that way no new player could get their hands on something super powerful, and higher level players wouldn't be wasting their time. Possibly a list and some requirements here i know.
----------------------
Furthermore I must make it so that players can never open the same chest more then once.
----------------------
Please only reply if you can answer ALL of these options.
ID:155496
Jun 20 2011, 12:52 pm
|
|
In response to Mista-mage123
|
|
hehe perhaps I shouldnt have been so blunt, not new, read the guides.
I was more or less wanting to learn about the advanced part, and limiting the user's ability to open the same chest....possibly along the lines of making it a character var...like mob var chest1=0 etc....then saving that instead? I already know what you've posted here, forgive me for being so blunt. :D |
In response to Komuroto
|
|
Komuroto wrote:
hehe perhaps I shouldnt have been so blunt, not new, read the guides. Okay, good. If you want advanced chests that are influenced by some sort of loot table, it will help to have Deadron's List library before proceeding. Actually, you don't need it but i would have that regardless. What also might help is if you made yourself a getBefore() and a getAfter() proc, like i've done here: proc/getBefore(haystack="null:nil",seperator=":",needle=0) I'm a little lazy so I use these home-made procs when working with lists and strings a lot. Might not be as "memory-efficient" as most methods, but oh well. What getBefore() and getAfter() do is return the string before or after the first appearance of a character. This comes in handy a lot when it comes to coding. For the loot table, you want to do this: obj/chest What we're going to do now is modify our loot grabbing procedure a little bit. What we're looking at in each string above is the item you get, and next to the colon is the percentage of chance to get that item from the chest. Interact() This will select the reward from the chances in the loot table. Remember: You will still only get 1 item from the chest, and chances are you'll get a steak. Now, if you want some kind of Luck variable to do that, well, you would be able to modify that a tiny bit like so: mob/var/luck=5 That will increase the odds of each individual item by the luck variable. Of course, that's basic. You can play with the proc as much as you want, multiplying/etc, whatever floats your boat really. |
In response to Mista-mage123
|
|
You could always use an associative list:
obj/chest Seems like a lot of trouble messing with text so much. |
In response to ExPixel
|
|
Yeah and you could also make who opens certain chests a separate save file that loads on world/New()
|
Regardless, what you'll want to do is make an obj/chest, with an icon and all, then give it a procedure called Interact or whatever, like so.
Then have the player initiate a verb that can open the chest, or however you want the player to open that chest. If you wanted the player to execute a verb, for example...
As for the opening of the chest itself, there's a number of things you can do with that in terms of loot rewards. First, you can give the chest a list of possible rewards, like so.
And if you wanted it to keep track of who opened it, you would do this.
This wouldn't be so feasible in a game with a savesystem as it would allow people to open it again if the world should reboot, but for someone learning DM it should be pretty simple.
And now, it's a matter of stringing everything together.
As for the player's stats influencing what drop is picked, you are correct, that is advanced. For someone starting DM, i wouldn't recommend looking at that until you nail the basics.
Additionally, if you want the chest to appear as "opened" only to people who have opened it, that requires a bit more work with the fancy new override variable that you shouldn't look at yet until you nail the basics.