ID:268139
 
I know this is sorda a newbish question, for such an advanced coder like me, Im drawing blanks right now..
mob/Portal/
icon = 'Overlays.dmi'
icon_state = "Portal"
var/LevelSpawn = 1
New()
CheckDistance()
..()
proc/CheckDistance()
if(istype(src,/mob/Player in view(10)))
world<<"Fount Player"

How would it find a mob/Player in view(10)? Is my code right?
Kasumi Tomonari wrote:
I know this is sorda a newbish question, for such an advanced coder like me, Im drawing blanks right now..
mob/Portal/
icon = 'Overlays.dmi'
icon_state = "Portal"
var/LevelSpawn = 1
New()
CheckDistance()
..()
proc/CheckDistance()
if(istype(src,/mob/Player in view(10)))
world<<"Fount Player"

How would it find a mob/Player in view(10)? Is my code right?

You can try this
proc/CheckDistance()
for(var/mob/M in oview(10,src))
if(istype(M,/mob/Player))
world << "Player Found"

With your check distance proc, i doubt that the istype function would work, then again, im not used to the advanced working of most of the standard procs. But when you used 'src' in that proc, src refers to the Portal(itself) thus it would have never outputted anyway.
In response to Lazyboy
Now another problem
proc/CheckDistance()
for(var/mob/Player/M in oview(3,src))
world<<"A"
if(src.LevelSpawn == 1)
var/Enemies = rand(1,4)
if(Enemies == 1)
new /mob/monster/Imp(src.x+1,src.y,src.z)
if(Enemies == 2)
new /mob/monster/Imp(src.x+1,src.y+0,src.z)
new /mob/monster/Imp(src.x,src.y+1,src.z)
if(Enemies == 3)
new /mob/monster/Imp(src.x+1,src.y+0,src.z)
new /mob/monster/Imp(src.x+0,src.y+1,src.z)
new /mob/monster/Imp(src.x+1,src.y+1,src.z)
if(Enemies == 4)
new /mob/monster/Imp(src.x+1,src.y+1,src.z)
new /mob/monster/Imp(src.x+1,src.y+0,src.z)
new /mob/monster/Imp(src.x+0,src.y+1,src.z)
new /mob/monster/Imp(src.x+2,src.y+1,src.z)
They dont appear.
Kasumi Tomonari wrote:
I know this is sorda a newbish question, for such an advanced coder like me, Im drawing blanks right now..
mob/Portal/
icon = 'Overlays.dmi'
icon_state = "Portal"
var/LevelSpawn = 1
New()
CheckDistance()
..()
proc/CheckDistance()
if(istype(src,/mob/Player in view(10)))
world<<"Fount Player"

How would it find a mob/Player in view(10)? Is my code right?

Hmm, you're going about it kinda backwards. You can't use istype() to check against a type in a list. However, it would be simpler to just grab the first player in view(10), assuming there is one, right?
mob/Portal/
icon = 'Overlays.dmi'
icon_state = "Portal"
var/LevelSpawn = 1
New()
CheckDistance()
..()
proc/CheckDistance()
var/mob/M = locate(/mob/Player in oview(src,10)) //have to use src, defualt is usr
if(M)
world<<"Found Player"


Remember, locate can take a type path and a container to look in (ie: a list).
In response to Kasumi Tomonari
You're handling it backwards. You should have players trigger the portals to spawn monsters in their Move() proc.