ok lets say you have arrows and when you drop them you want to be able to drop an amount and it creates a new object with that amount.
obj
projectiles
arrows
icon = 'weapons.dmi'
icon_state = "arrows"
var/amount = 5
verb/Get()
set src in oview(1)
usr.arrows += src.amount
usr << "You got [src.amount] arrows!"
del(src)
so each packof arrows is defined with an amount
ID:149497
Apr 16 2002, 8:04 pm
|
|
I really shouldnt be helping, because im so tired, but i would suggest doing something like this:
mob Please, someone else help if you see any big things wrong here...ZzzzZzzzz....hmm? *stutters* erm, uh, beh.. I wasnt asleep.. I was doing the uhh... Zilal mating call? :P -Rcet |
Mrhat99au wrote:
ok lets say you have arrows and when you drop them you want to be able to drop an amount and it creates a new object with that amount. I'd go for a semi-simple counting sytem: obj There are a few things to be wary of here: I'm not sure if "as null|num" will work right for a verb argument. If it does, then you can say "Drop arrows 5" and it will drop 5 arrows. You'd set up an arrow like this: obj/item/arrow This is the simplest system I could think up on short notice. Lummox JR |
In response to Lummox JR
|
|
var/obj/item/arrow/A=..()
I've never seen that before, what exactly does that do? I'd guess it would assign whatever is returned by the parent proc to A but there is no return statement in the parent proc and I thought procs returned null by default. |
In response to English
|
|
English wrote:
var/obj/item/arrow/A=..() Whoops! I forgot the return statement. I've edited the post to include it. Lummox JR |
mob
verb/DropArrows(amount as num) // Verb on the player to drop arrows.
if(amount < 1) // 0 or less is impossible
usr << "You cannot drop [amount] arrows!"
else if(usr.arrows < amount) // you don't have that many...
usr << "You don't have [amount] arrows!"
else // ok to drop.
var/obj/projectiles/arrows/A = new(usr.loc) // Create an arrow object at the users feet.
A.amount = amount // Apply the amount of arrows to the object.
usr.arrows -= amount