ID:166563
Jul 20 2006, 12:05 pm
|
|
I want to make a money verb that the user can drop a certain amount of money. I also want to be able to store a number into an obj named money. I was thinking of having an obj/var/gold for the gold contained in the bag of money, then have a mob/var/amount and do gold = amount so that the bag contains the amount of gold. Is this the right way of doing this? Also, the topic is my main question :) (usr drops [amount] of money!) something like that.
|
In response to Talion Knight
|
|
Although that's a start, you should also make sure of the following:
1) The amount isn't negative. 2) The player has enough gold to drop. 3) The player has the ability to cancel. I'll leave you to figure out how to achieve points 1 and 2, as for point 3: mob/verb |
In response to DeathAwaitsU
|
|
Good call there. Don't know how missed something as simple as that :\
|
In response to DeathAwaitsU
|
|
Don't forget if the player has enough gold to drop.
mob/verb |
In response to BeyondPower
|
|
BeyondPower wrote:
Don't forget if the player has enough gold to drop. > mob/verb I didn't forget. If you read my post more closely, you'll notice I said "I'll leave you to figure out points 1 and 2". As for your example, you should actually do if(usr.gold - amt >= 0) so that the player can drop all his money. |
In response to DeathAwaitsU
|
|
Ok, was just wondering if I was on the right track. I can do all that stuff. The problem I'm having is making a gold icon appear after the usr drops the gold and have that obj hold the amount specified. Can't get the variables right. Do I use atom, obj, mob? That's the part I can't figure out. Oh and I got the answer to everything else, thanks.
P.S. I have the code for the checking of 1,2,and 3. ;) Well to summarize what I'm asking: 1)storing a value to obj/gold that will be accessible by mob/player. for ex: obj/gold = 100 //mob uses get when one space away... mob/player/gold += (src) Something like that for picking up the gold bag and adding it to his money. 2)drawing a new obj/gold icon where the usr dropped gold 3)I can't remember what the third one was...>.< |
In response to SuperSonicD
|
|
Make sure to round() too!
|
In response to SuperSonicD
|
|
You could do something like this:
obj *Edit* And as Flame Sage suggests, you may want to round() some values so that we're not dealing with 10.0356 gold. |
That should get you started.