ID:176311
 
Im trying to make it so if your next to the turf water something happens my code is:


                    if(get_dist(/mob/units/soldiers/Digger/,/turf/water) == 1)
usr << "CHEESE"



Does anybody know why this doesnt work? Thanks in advance!

-Crio
Yes. get_dist() takes two atoms as arguments. You've passed two type paths into it.
In response to Garthor
why dont it work?
In response to Koolguy900095
In response to OneFishDown
Just typing in " [link] " looks nicer, y'know! BYOND will automatically link it.
In response to Garthor
Garthor wrote:
Just typing in " [link] " looks nicer, y'know! BYOND will automatically link it.

Yea, but its faster to just copy the link to the post.
In response to Garthor
im confused...how do i fix it tho...an atom is like a mob right
In response to Koolguy900095
You're trying to use the type path, as Garthor calls it, as arguments for the proc. That's like specifying a directory where you want to be specifying a file. You want to use a variable as an argument for that proc, like this:

<code>mob/verb/findwater() var/turf/water/WATER var/mob/MOB = src for(var/turf/water/W in range()) WATER = W break MOB << get_dist(WATER, MOB)</code>
In response to OneFishDown
You can copy the post ID in the top right corner of the post.
In response to Garthor
I would've, but I was reading his post, so it was easier to copy the link to yours then reply.
In response to Triste
why doesnt this work for every tile even if i put the guy on the water...:

var/turf/water/WATER
var/obj/moat/MOAT
var/mob/MOB = src
for(var/turf/water/W in range())
WATER = W
for(var/obj/moat/M in range())
MOAT = M
break



if(get_dist(WATER, MOB) == 1)
usr << "CHEESE"
switch(input("Which way would you like to place this moat?","Most Placement")in list("Verticle", "Horizontal","Nothing"))
if("Verticle")
new/obj/moat/moat_vert(src.loc)
if("Horizontal")
new/obj/moat/moat_hors(src.loc)

else if(get_dist(MOAT,MOB) == 1)
switch(input("Which way would you like to place this moat?","Most Placement")in list("Verticle", "Horizontal","Nothing"))
if("Verticle")
new/obj/moat/moat_vert(src.loc)
if("Horizontal")
new/obj/moat/moat_hors(src.loc)
In response to Koolguy900095
Because range() doesn't limit it to everything 1 tile away. Oh, and it's also not inside of a proc.
In response to Garthor
how do i fix this....im really confused and its in a proc:
                Dig()
set category = "Digger"
set src in oview(7)
var/turf/water/WATER
var/obj/moat/MOAT
var/mob/MOB = src
for(var/turf/water/W in range())
WATER = W
for(var/obj/moat/M in range())
MOAT = M
break



if(get_dist(WATER, MOB) == 1)
usr << "CHEESE"
switch(input("Which way would you like to place this moat?","Most Placement")in list("Verticle", "Horizontal","Nothing"))
if("Verticle")
new/obj/moat/moat_vert(src.loc)
if("Horizontal")
new/obj/moat/moat_hors(src.loc)

else if(get_dist(MOAT,MOB) == 1)
switch(input("Which way would you like to place this moat?","Most Placement")in list("Verticle", "Horizontal","Nothing"))
if("Verticle")
new/obj/moat/moat_vert(src.loc)
if("Horizontal")
new/obj/moat/moat_hors(src.loc)
In response to Koolguy900095
I have no clue what you're trying to do. And it's vertical, not verticle.
In response to Garthor
read my first post for what im trying to do...im trying to make it so when ur next to water and dig it makes a moat in the way u tell it to...then if ur next to a moat u can make a moat next to it....
In response to Koolguy900095
mob/verb/Dig_Moat()
if(locate(/turf/water) in orange(1) || locate(/turf/moat) in orange(1))
new turf/moat(src.loc)
In response to Garthor
now how do i make it check if the src is there not usr?
In response to Koolguy900095
What?
In response to Garthor
if(locate(/turf/water) in orange(1) || locate(/turf/moat) in orange(1))

checks to see if the usr is there how do i make it check is the src is orange(1) away from the water and moat
In response to Koolguy900095
Change orange(1) to orange(src,1).
Page: 1 2