Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addSeparator("separator")
- addLabel("attacktext", "Attack Settings")
- addSeparator("separator")
- local toAttack = nil
- onMissle(function(missle)
- if not storage.attackLeader or storage.attackLeader:len() == 0 then
- return
- end
- local src = missle:getSource()
- if src.z ~= posz() then
- return
- end
- local from = g_map.getTile(src)
- local to = g_map.getTile(missle:getDestination())
- if not from or not to then
- return
- end
- local fromCreatures = from:getCreatures()
- local toCreatures = to:getCreatures()
- if #fromCreatures ~= 1 or #toCreatures ~= 1 then
- return
- end
- local c1 = fromCreatures[1]
- if c1:getName():lower() == storage.attackLeader:lower() then
- toAttack = toCreatures[1]
- end
- end)
- macro(50, "Attack leader's target", function()
- if toAttack and storage.attackLeader:len() > 0 and toAttack ~= g_game.getAttackingCreature() then
- g_game.attack(toAttack)
- toAttack = nil
- end
- end)
- addLabel("leadertext", "Leader: ")
- addTextEdit("attackLeader", storage.attackLeader or "player name", function(widget, text)
- storage.attackLeader = text
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement