ID:1714937
 
(See the best response by NNAAAAHH.)
So I'm trying to put all the skills in a skill tab with an icon for each skill, then allow the player to use the skill be clicking on it.
skill
parent_type = /obj

icon = 'Skills.dmi'

Attack
icon_state = "Attack"
Click()
var/mob/M
if(M in get_step(usr, usr.dir))
usr.Attack(M)

mob/verb
usr.Attack(var/mob/M in get_step(usr, usr.dir))
set category = "Skills"
set popup_menu = 0
if(attdelay || stam < attstam || KOED || train || rest || Deathbox()) return
AttackDelay()
ustats()
M.ustats()
AttackStam()
AttackProcs()
UAMastery()
SMR()
if(M.KOED)
Death(M)
else
DamageU(M)
spawn(attdelayt) attdelay = 0


How do I determine if there is a mob infront of step infront of the char? This just doesn't seem to work.

I know its possible to use for, but won't it use it on every person thats infront of them?
Best response
The second usr.Attack should just be Attack.

Inside Click() var/mob/M need to be defined. var/mob/M = locate(get_step()) I believe. I can't recall if you can call verbs in this manner, check the reference for the call() proc, please.

Also, you can use for() and just insert break after you call attack.
It is just Attack, I think I copied it wrong. I was thinking about defining it but wasn't sure how.
Forgive, I think it's locate() in get_step()
Its ok, I went with for/break.
skill
parent_type = /obj

icon = 'Skills.dmi'

Attack
icon_state = "Attack"
Click()
for(var/mob/M in get_step(usr, usr.dir))
usr.Attack(M)
break

Much more cleaner that way.
Glad I could help.