ID:170941
 
I use this code to place a mob where i click.


turf
Floor2
icon_state = "Floor"
Click()
if(usr.Unit == "Archer")
new/mob/Units/Archery/Archer(src.loc)

The check goes through and everything but it vreates the mob at (1,1,1). It will not create where i click. Any ideas?

try src.unit? lol, no clue.

[EDIT]
According to the pros, NO USR IN PROCS, UNGH!
Click(), The Click() proc, usr.unit? O_O
In response to Lenox
Lenox wrote:
According to the pros, NO USR IN PROCS, UNGH!
Click(), The Click() proc, usr.unit? O_O

No. Click(), by usage, is an exception to that rule. Putting "usr" in Click() is perfectly fine.
In response to Wizkidd0123
Also DblClick() is fine..if you search on BYONDscape, you can find Dream Tutor: By Lummox Jr. One of them shows the different ways usr can be used, and can't be.
In response to N1ghtW1ng
thats nice to know, but can anyone solve my problem :P
Tazor07 wrote:
I use this code to place a mob where i click.


turf
Floor2
icon_state = "Floor"
Click()
if(usr.Unit == "Archer")
new/mob/Units/Archery/Archer(src.loc)

The check goes through and everything but it vreates the mob at (1,1,1). It will not create where i click. Any ideas?

The actual problem is that you are using src.loc in the new() line. In that click proc, src is the turf that you are clicking on. Its loc is the area it is in, likely the default area. The new mob created in that area shows up in the first turf in the area at (1, 1, 1). If you want it to show up on the turf itself, use "src" instead of "src.loc" in the new() line.