ID:163837
 
Right, This is probebly something that has the most simple solution, But. I need to move the Targeted Mob thats targeted, And keep the rest of the group Staitonary, But the code I have doesn't seem to do the job. So any help will be greatly Aprechiated ^_^' Thanks In advance - Keiron.

 obj/Click()
for(var/mob/npcs/Pet/B in world) //Pet in world,
if(B.Owner == "[usr]") // Check if its your pet
if(B.Frozen) //Check if there frozen
return
if(B.Targeter == "[usr]") //Check if there is a mob Targeted,
walk_towards(B,src) //Walk towards the clicked point.
return // << This is where I want it to stop , And not continue.. But,
else // This is probebly the problem where the rest of the group decides to move
if(B.Owner == "[usr]") //Same check as before ect ect
walk_towards(B,src)
else
return


How my code works, For those picky about not helping even though I dont believe it is needed to explain in this situation, But, Targeteing the Pet mob Changes its Variable so ''usr'' is Its Targeter, And frozen is obviously something that stops movement, Once again. Thanks for any help anyone can give - Keiron.
 obj/Click()
for(var/mob/npcs/Pet/B in world)
if(B.Owner == "[usr]")
if(B.Frozen)
return
if(B.Targeter == "[usr]")
walk_towards(B,src)
return
walk_towards(B,src)

else
return


Think that's what you're after anyway?

In response to Farkas
For some reason it doesn't work at all, let me post my not so great Targeting code.. It may be a problem there, (When i mean it doesnt work at all, None of the mobs then move) Here is the
Targeting code :

client
DblClick(M)
if(istype(M,/mob/npcs/Bunshin))
call(usr,/mob/proc/Target)(M)
else
if(usr.newT)
var/mob/P = usr.newT
usr.Hastarget = 1
var/p = P.targets.Find(usr)
if(p) P.targets.Remove(usr)
P.Targeter = "None"
del usr.enemy_marker
usr.Hastarget = 0

..()

mob
proc
Target(mob/M)
if(src.newT)
var/mob/P = src.newT
var/p = P.targets.Find(src)
if(p) P.targets.Remove(src)
src.Target = "None"
del src.enemy_marker
src.target_icon = 'target.dmi'
src.enemy = M
M.Targeter = "[src]"
src.Target = "[M.name]"
src.enemy_marker = image(usr.target_icon,M)
src << usr.enemy_marker
M.targets.Add(src)
if(src.newT) src.oldT=src.newT
src.newT=M



mob
var/tmp
targets[1]
oldT
newT
mob/enemy
enemy_marker
target_icon = 'target.dmi'
Targeted
Sorry, None of it is commented But, If there is something wrong with that. It may be the problem, Also, What i'm trying to achieve in more detail. Is a group of say.. 15 mobs, When none are targeted I wish for them all to move, But when selecting one, I wish for the targeted one to move alone, And the rest Stand and be good little mobs like they should do, Hope this helps with anyone able to help me ^_^' And thanks for trying Farkas.. Its weird it doesn't work.
In response to Keiron
client
DblClick(M)
if(istype(M,/mob/npcs/Bunshin))
call(usr,/mob/proc/Target)(M)
else
if(usr.newT)
var/mob/P = usr.newT
usr.Hastarget = 1
var/p = P.targets.Find(usr)
if(p) P.targets.Remove(usr)
P.Targeter = "None"
del usr.enemy_marker
usr.Hastarget = 0

..()


Try changing that to:
mob/DblClick(mob/M)
if(istype(M,/mob/npcs/Bunshin))
src.Target(M)
//etc...


BTW: change del usr.enemy_marker to usr.enemry_marker = null
In response to Farkas
Dont really understand what your getting at, Doesn't it do the exact same as the code I have above, Besides. It seems hard to adapt using src.Target,
In response to Keiron
Why is it hard to adapt, if it did the same as your code, then surely nothing would change?

To help you out with your Target proc - change mob/M to mob/Targeted, that way when you look through your code to see who is the target and who is being targeted, it's easier to see.

To me, it seems your problem is with your Target proc:
mob
proc
Target(mob/Targeted)
/*if(src.newT)
var/mob/P = src.newT
var/p = P.targets.Find(src)
if(p) P.targets.Remove(src)
src.Target = "None"*/

//I'm ignoring the above cause I don't know what it's supposed to do
src.enemy_marker = null
src.target_icon = 'target.dmi'
src.enemy = Targeted //Your enemy is the person you targeted
Targeted.Targeter = "[src]" //Targeteds targeter is you
src.Target = "[Targeted.name]" //Your target is Targeted's name
src.enemy_marker = image(src.target_icon,Targeted)
src << src.enemy_marker
Targeted.targets.Add(src) //Add yourself to Targeteds "targets" list?
//Should that not be src.targets.Add(Targeted)?
if(src.newT) src.oldT=src.newT
src.newT=Targeted


Is that the problem or am I just talking crap? In which case I'll shut up :D