ID:165236
 
Why doesnt this work?

for(var/mob/M in world)
if(locate(M.name) in usr.party)
M.lastx=M.x
M.lasty=M.y
M.lastz=M.z
M.loc=locate(B.x+2,ony,B.z)
M.dir=WEST
ony-=1
world<<"found [M.name]"

I dont get... "mob found" so, it must not be finding it :(.

Its in the middle of my coding but there should be enough there to determine the problem, Any help appreciated. thanks.
Well, if when you add them to your party list you add THEM and not THEIR names, then of course it won't work.
In response to Pyro_dragons
........


usr.party+="[M.name]"


//also tried...


usr.party.Add("[M.name]")



Im not that dumb. I did sucessfully make a complete HM game with alot of stuff... :P. just have problems here and there :).
If infact your party list is full of mob references, instead of searching throughout the world.contents and comparing, search through the party list itself.
for(var/mob/m in ref.party)
...
world << "Found [m]!"


Your snippet didn't work because you were trying to use locate without setting the atom.tag variable. And because you didn't do so made it so that a reference to the object could _not_ be obtained.
In response to Bladeshifter
Still NOTHING! how about i hook you up with a little more info, Im gonna put alot of code but ill just mark whats used where! :P.


//New Game Proc, At the bottom i assign the guy to be in the party.

mob/var/list/party()




mob/proc/NewGame()
for(var/obj/HUD/Text/T in usr.client.screen)
del T
for(var/obj/HUD/title/O in usr.client.screen)
del O
src.attacktime=5
src.hp=30
src.maxhp=30
src.dmg=5
usr.logged=1
usr.UpdateHP()
usr.UpdateEXP()
usr.UpdateMP()
usr.loc=locate(1,1,1)
usr.icon='body1.dmi'
var/image/head/I=new/image/head
I.icon=usr.head
I.layer=MOB_LAYER+1
I.pixel_y=15
usr.overlays+=I
usr.icon=usr.body
var/mob/npcs/N=new/mob/npcs/helper(locate(usr.x,usr.y+1,usr.z))
N.owner="[usr.name]"
var/a=input("Hey, Im Lost can you help me? My name is... Ummm. I can't seem to remember, Will you give me a name?","","[usr.name]s Helper") as text
N.name=a
usr.party+=N //<-----RIGHT HERE!
usr.companion=a


And this is where he is supose to be located in the party...

//Basically i Need to find the mob to pull him in battle
mob/proc/gointobattle()
src.inbattle=1
var/yep=0
for(var/turf/battle/B in world)
if(!yep)
if(!B.inuse)
src.move=0
yep=1
src.lastx=src.x
src.lasty=src.y
src.lastz=src.z
if(!src.client)
var/ony
src.loc=locate(B.x-2,B.y,B.z)
src.dir=EAST
ony=ony-1
for(var/mob/M in usr.party)//<----HERE!
M.lastx=M.x
M.lasty=M.y
M.lastz=M.z
M.loc=locate(B.x-2,ony,B.z)
M.dir=EAST
ony-=1
world<<"found [M.name]"
else
var/ony
src.loc=locate(B.x+2,B.y,B.z)
src.dir=WEST
ony=ony-1
for(var/mob/M in usr.party)//<--- and here
M.lastx=M.x
M.lasty=M.y
M.lastz=M.z
M.loc=locate(B.x+2,ony,B.z)
M.dir=WEST
ony-=1
world<<"found [M.name]"



Sorry for so much coded that wasnt needed to be displayed, Or maybe the problem is in THIS coding. and i know i have a little jumbled and my codings a little un-unique but, it should all work either way... right?
In response to Bladeshifter
Bump! Well... Any help would be very appreciated!!! :P.