ID:146702
 
Code:
obj
HUD
Command
Attack
layer = MOB_LAYER + 3
icon = 'commands.dmi'
icon_state = "attack"
var/client/A
New(client/M)
screen_loc = "7,1"
M.screen+=src
Click()
usr.closebasiccommands()
usr.commandattack = 1



mob
NPC
var/troop_commander = "Mardok"
var/selected
var/mob/NPC/M
var/obj/HUD/O
Mechanic
icon = 'troop.dmi'
icon_state = "troop"
Click()
if(src.troop_commander == usr.name && usr.commandattack == 0)
for(O in usr.client.screen)//the HUD in the users screen
del(O)//delete the HUD...
new/:Mechanic2(usr.client)//...and set up new ones
new/:Attack(usr.client)
new/:Build(usr.client)
else
if((src.troop_commander == usr.name) && usr.commandattack == 1)
for(M in world)
if(M.selected == 1 && M.troop_commander == usr.name)
walk_towards(M,src)


When you click on a mob and your name equals their proper commander a hud appears. i didnt include all the code of this test program. when you click on the attack button, you click on the mob you want it to attack (i just want the mob to walk towards the target for now).

Problem description: When you click on the attack hud that appears when you click on a mob, the hud dissapears like its supposed to, but when you click on the target, the mob you want to attack doesnt do anything.