Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: anyone knows how to test in lua if a reaction is being done by...  (Read 770 times)

Abadrausar

  • Bay Watcher
  • empowering ideas
    • View Profile
    • ♫♪♀HDFPS♂♪♫
anyone knows how to test in lua if a reaction is being done by...
« on: September 08, 2014, 03:41:47 pm »

Anyone knows how to test in lua if a reaction is being done by the elected MAYOR?

I am a dabbling gm-editor user  :-\

Not even sure where I should track this, if in the entity object or in those of the individual units...
Logged
::: Humble Dwarf Fortress Publishing System ♫♪♀HDFPS♂♪♫ Mods Push Published in DFFD are auto updated in local Players Catalog :::

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: anyone knows how to test in lua if a reaction is being done by...
« Reply #1 on: September 09, 2014, 02:13:26 am »

onReactionComplete(reaction,unit,input_items,input_reagents,output_items,call_native)

I forgot exactly where in the unit it is; it may be the hist fig. You can find the hist fig structure with df.historical_figure.find(unit.historical_figure_id) or something along those lines (the unit.historical_figure_id is what I'm fuzzy on).

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: anyone knows how to test in lua if a reaction is being done by...
« Reply #2 on: September 09, 2014, 06:52:05 am »

I suggest using way more user-friendly function:registerReaction(reaction_name,callback)

Abadrausar

  • Bay Watcher
  • empowering ideas
    • View Profile
    • ♫♪♀HDFPS♂♪♫
Re: anyone knows how to test in lua if a reaction is being done by...
« Reply #3 on: September 11, 2014, 05:22:01 pm »

Thank you both very much!
Logged
::: Humble Dwarf Fortress Publishing System ♫♪♀HDFPS♂♪♫ Mods Push Published in DFFD are auto updated in local Players Catalog :::