User Tools

Site Tools


lua:scripting:examples:findtargets

This is an old revision of the document!


function getTargets()
  -- Find a non-healer target to be the de-facto tank
  for _, player in ipairs(mob.room.players) do
    -- echo ("player = "..player.name)
    -- echo ("class = "..player.class)
    if not(player.class == "cleric" or player.class == "templar") and target == nil then
      target = player
      -- echo("chosen target = "..target.name)
    elseif target == nil then
      target = mob.room.players[1]
      -- echo("default target = "..target.name)
    end
    if player.class == "cleric" or player.class == "templar" and healer == nil then
      healer = player
      -- echo("healer = "..healer.name)
    else
      healer = nil
    end
    if not(healer == nil) and not(target == nil) and #mob.room.players> 2 then
      third = player
    else
      third = mob.room.players[2] or nil
    end
  end
end
lua/scripting/examples/findtargets.1720128728.txt.gz · Last modified: 2024/07/04 21:32 by astark