modifying autofight.lua to warn on specific monster


Questions, Explanations, Howtos

Temple Termagant

Posts: 9

Joined: Saturday, 18th February 2012, 17:30

Post Wednesday, 13th June 2012, 15:57

modifying autofight.lua to warn on specific monster

I want to modify autofight.lua to warn on specific monster.

So I modify this file as follows.

  Code:
...

 info.threat = m:threat()
 info.mname = m:mname()
  return info
...

  elseif info == nil then
    crawl.mpr("No target in view!")
  elseif info.mname =="ancient lich" then
    crawl.mpr("this is ancient lich!")
  elseif info.can_hit == 3 then
    attack_fire(x,y)

...


But this is not work.

I want your advice Because I'm poor at this things.
User avatar

Ziggurat Zagger

Posts: 5832

Joined: Thursday, 10th February 2011, 18:30

Post Wednesday, 13th June 2012, 16:11

Re: modifying autofight.lua to warn on specific monster

Don't alter the lua.

Instead alter your more messages.

Goto init.txt add

  Code:
###################### Combat ###########
force_more_message = comes into view.
force_more_message = come into view.


Possibly instead use

  Code:
###################### Combat ###########
force_more_message = .* Ancient Lich .* view.


or something similar; not too keen on what the wildcards are.
"Be aware that a lot of people on this forum, such as mageykun and XuaXua, have a habit of making things up." - minmay a.k.a. duvessa
Did I make a lame complaint? Check for Bingo!
Totally gracious CSDC Season 2 Division 4 Champeen!

For this message the author XuaXua has received thanks:
yingyeo

Spider Stomper

Posts: 243

Joined: Sunday, 28th August 2011, 14:04

Post Thursday, 14th June 2012, 19:15

Re: modifying autofight.lua to warn on specific monster

Try replacing m:mname with m:name (and maybe "ancient lich" with "Ancient lich").

Return to Coding

Who is online

Users browsing this forum: No registered users and 30 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.