Page 1 of 1

Right Click Context Menu on Weapons?

Posted: 10 Feb 2017, 14:11
by Axebeardbeardaxe
I saw that items can have context menus now, but wasn't able to find out much info from digging through the files.
I added this to my test weapon and it didn't seem to work:
use4_functor = spare_parts.ak
use4_action_functor = spare_parts.give_spare_parts
use4_text = "Disassemble"

The goal is to be able to disassemble weapons for different types of parts. I'm very new to scripting with CoC and could use some help, or an example script to look at. This was my feeble attempt to get something to happen:

Code: Select all

function ak(itm)
       if (ak = true) then
              return game.translate_string("ak_parts")
       end
end

function give_spare_parts(itm)
   SetHudMsg("You dismantle the weapon",5)
end

Re: Right Click Context Menu on Weapons?

Posted: 11 Feb 2017, 03:57
by Alundaio
syntax error (ak = true)
You use == operator for comparisons and = to set a variable. But that is not what you want to do.


Code: Select all

function ak(itm)
         return game.translate_string("ak_parts")
end

function give_spare_parts(itm)
   SetHudMsg("You dismantle the weapon",5)
end


Try that and build from there.