ID:2383499
 
Code:
Face_Vaizard
icon='VaiMask1.dmi'
armor="mask"
proc
Use()
if(usr)
if(usr.henge)return
var/equ=equipped
for(var/obj/items/O in usr.contents)if(O.armor=="mask")
O.equipped=0
O.suffix=""
if(equ)usr.mask=0
else
var/obj/A=new(usr.loc,x+15)
A.layer=MOB_LAYER+10
A.icon='VaiMaskCreation.dmi'
flick("Vai3",A)
sleep(14)
usr.mask=/obj/VaiMask1
equipped=1
suffix="Equipped"
if(A) del(A)
usr.overlay()
Click()Use()
verb
Drop()
if(equipped==1)usr<<"You must unequip this first."
else loc=locate(usr.x,usr.y,usr.z)
Pick_Up()
set src in oview(1)
loc=usr
usr<<"You picked up a [src]."


Problem description:

I want to apply a +15 on the Y value, but this doesn't seem to work.

I know it's probably all wrong, but I've tried literally everything by now, and I am out of my programming skills.

Is there any other way, or the correct way of doing this.

It's about this part in specific.

var/obj/A=new(usr.loc,x+15)


Some help would be great appreciated.
You should probably look up new() to see what is actually does and the arguments it takes.


Format: New(loc) (supports named arguments)

Args: loc: The initial location.

New proc (atom)
See also: New proc (datum) new proc Format: New(loc) (supports named arguments) When: Called when the object is created. Args: loc: The initial location. Default action: None.
By the time New() is called, the object has already been created at the specified location and all of its variables have been initialized. You can perform additional initialization by overriding this procedure.

Since the initial location parameter passed to new() is applied before New() is even called, there is some special handling of the loc variable when using named arguments in a call. Normally, if a procedure is overridden, named arguments in a call are matched against those in the the overridden definition. In this case, however, the loc parameter name is hard-coded. Regardless of what you call the first argument in your definition of New(), the initial location will be taken from the first positional argument, or from the argument named loc if there are no positional arguments.
You can use locate() with modified coordinates to get a location relative to something.
var/obj/A=new(locate(usr.x + 15, usr.y, usr.z))

If you're using locate() with unmodified coordinates, like in your Drop(), you might as well be using the loc var instead.
// instead of
loc=locate(usr.x,usr.y,usr.z)

// you can do this
loc = usr.loc
No put usr in proc. Ungh.