ID:963173
 
(See the best response by Geldonyetich.)
mob
verb
Action_Verb(atom/a in get_step(src, src.dir))
if(ismob(a))
if(istype(a, /mob/Monster))
Attack(a)


Problem description: I can't make the code differentiate between certain obj's and mobs. When in-game the code makes a menu-box appear, asking what to target. I need assisstance on how to make it skip over certain obj's and mobs, not counting them at all in the proc.

Best response
Change Action_Verb(atom/a to Action_Verb(mob/a and it will only build a list of mobs from the turf returned from get_step instead of a list of all atom types.

Alternately, if you do want to target only some kinds of obj or mob what you'll want to do is take out the verb argument entirely. Then, create a new list and manually populate it with the things you want. After you have completed the list, pass it to an input() proc. This will produce the identical effect of giving the player a menu-box to choose from, but now with a tailor-built list.

mob/verb/Action_Verb()
var/list/actionList = new()
for (var/atom/thisAtom in get_step(src,src.dir)
if (ismob(thisAtom) && istype(thisAtom,/mob/Monster)) actionList.Add(thisAtom)
// some time later
var/atom/playerChoice = input(usr,"Choose dat thing") as anything in actionList
Ah, I see. Thanks for the quick response.
I cant seem to find out where to place my attack proc so that it'll work. [Edit] Nvm, it works perfectly. I was just being a tad ignorant there. Thx for all your help Geldonyetich! [End Edit]
In response to Geldonyetich
Always* use "as blah|null in List" to your inputs to give the client a Cancel button! It's worth the extra check.


*unless you're evil