[Solved]LuaGuiElement question
Posted: Sun Feb 16, 2020 9:06 pm
I want create right click event and 40 damage my character but I try "shift+right click" in game and notting happened. I look here https://lua-api.factorio.com/latest/LuaGuiElement.html but I don't understand I am new on modding. here is my control.lua ;
Code: Select all
local function right_mouse_click(event)
local element = event.element --LuaGuiElement
local player_index = event.player_index --uint
local player = game.get_player(event.player_index)
local button = event.button --defines.mouse_button_type
local alt = event.alt --boolean
local control = event.control --boolean
local shift = event.shift --boolean
if element == {"button"} and player_index == player and button == defines.mouse_button_type.right and alt == false and control == false and shift == true then
player.character.damage(40, "player")
end
end
script.on_event(defines.events.on_gui_click, right_mouse_click)