Jump to content

deathgun

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by deathgun

  1. I tried to use the kill event, but I found that it couldn't find the event.target. According to https://wiki.hoggitworld.com/view/DCS_event_kill, the event table should have the following members when id=29:

     

    Event = {
    id = 29,
    time = Time,
    initiator = Unit,
    weapon = Weapon,
    target = Unit,
    weapon_name = string,
    }

     

    However, when I executed a test script in the mission using doscriptfile:

     

    env.setErrorMessageBoxEnabled(true)
    local e = {}
    function e:onEvent(event)
      if event.id == 29 then -- kill
        MessageToAll("type: " .. tostring(type(event)), 10, "DEBUG")
        MessageToAll("id: " .. tostring(event.id), 10, "DEBUG")
        MessageToAll("Time: " .. tostring(event.time), 10, "DEBUG")
        MessageToAll("Initiator: " .. tostring(event.initiator), 10, "DEBUG")
        MessageToAll("Weapon: " .. tostring(event.weapon), 10, "DEBUG")
        MessageToAll("Target: " .. tostring(event.target), 10, "DEBUG")
        MessageToAll("weapon_name: " .. tostring(event.weapon_name), 10, "DEBUG")
      end
    end
    world.addEventHandler(e)

     

    The result is as the following image.
    How can i use 'kill' event correctly?
     

    killeventtest.png

×
×
  • Create New...