In response to Jeff8500
I thought that line would fix my problem -.-

new dropped_obj(usr)
In response to Mizukouken Ketsu
dropped_obj it still a type path, though, as you're setting it to one, then never modifying it, therefore it remains as one throughout the proc - pretty simple stuff.
While your new() call is creating an appropriate object, you're not using it at all throughout your proc, effectively discarding it, since you're not even using the reference new() returns to the new object for anything. Had you not given it a location, it would've been immediately deleted by the garbage collector.
In response to Kaioken
Okay I decided to redo the coding. Before I use the following as reference, I need to fully understand it.

Kaioken wrote:
obj/item
var/amount
verb
Get()
set src in oview(1)
if(src.Move(usr)) //if movement succeeded
if(src.amount)
usr << "You pick up [src.amount] [src]\s."
else usr << "You pick up [src]." //insert "the" as needed
Drop() //you may design this a little differently.
//set src in usr //default
var/obj/dropped_obj = src
if(src.amount)
//ask player how many to drop, etc...
//...
dropped_obj = XYZ
//XYZ is the new object we're dropping, or if \
we're dropping everything then it's src

if(dropped_obj.Move(usr.loc))
usr << "You dropped..."
//make sure 'XYZ' is created inside the player's \
inventory in case of movement failure. you could \
also reverse the item separation in case of failure\
but it's not required.

proc/IsEqual(obj/item/O)
/*this is a proc to check if 2 items are equal
enough for them to be merged together (by increasing
amount). this is a rather important step to make if
you do item object instance customization yourself, or
allow players to do it to some extent (eg item forging
system, choose custom stats/name/icon...
if this returns 1, it's equal as far as we're concerned,
and can be merged*/

var/list/checked_vars = list("type","name","desc","icon","icon_state"
"strength/power","wear/condition","magic/enchantment")
for(var/X in checked_vars)
//look up the 'vars' list
if(src.vars[X] != O.vars[X]) return 0
return 1 //if all those vars are equal, return 1
mob
Entered(obj/item/O)
if(istype(O)) //if what has entered is an item and not something else
var/obj/item/X = locate(O.type) in src //try to find an object of the same type already in src**
if(X && O.IsEqual(X))
X.amount += O.amount
del O
if(O) ..()
//you could also do the same on turf/Entered(), if you \
want dropped items to stack on the ground


Where the flip are you getting XYZ from?

Objects.dm:88:error:XYZ:undefined var
Okay I think I'm making a little progress >.<

obj/Items
Weaponry
Knife
//...
Bronze
Material = "Bronze"
Amount = 5
verb
Drop()
set src in usr
var/obj/dropped_obj = src
if(src.Amount)
var/drop = input("How many do you want to drop?\n- You have [src.Amount] [src]\s","Drop") as num
if(drop > src.Amount || !isWhole(drop) || drop <= 0) return
src.Amount -= abs(drop)
src.suffix = "([src.Amount])"
XYZ = dropped_obj
XYZ.Amount = drop
new XYZ(usr.loc)
if(!src.Amount) del(src)
if(dropped_obj.Move(usr.loc))
usr<<"You dropped [dropped_obj]\s"
usr.AutoSave()


It gives me a runtime error saying it can't make obj type "/obj/Items/Weaponry/Knife/Bronze" (without the quotes).
In response to Mizukouken Ketsu
Right, I'm back now for a while.

Mizukouken Ketsu wrote:
Where the flip are you getting XYZ from?

Objects.dm:88:error:XYZ:undefined var

You're kind of misunderstanding it there. XYZ is simply a stand-in intended for replacement, not an actual var... just a figure. You're supposed to insert 'what's supposed to be there' instead, in your code. Typically enough, since you're dropping an object, you'll want to set the dropped_obj to a new object of the same type of the object being thrown (and set its amount), unless the amount that is being dropped is the total amount, in which case you would of course set it to the dropped object itself to be moved, since creating a new one isn't necessary in that case.
Page: 1 2