SHOW:
|
|
- or go back to the newest paste.
1 | local info = [[ | |
2 | Name: Invisible Monster Attacker | |
3 | Description: Executes an AoE when monsters go invisible | |
4 | Author: Cavitt Glover (Syntax) | |
5 | Version: 1.0.00 (updated 04.25.2012)]] | |
6 | ||
7 | local config = { | |
8 | attacks = { | |
9 | --[[ | |
10 | runes/spells should be prioritized from top to bottom, eg: exori gran will be attempted before exori or exori mas. | |
11 | ||
12 | aggressive: | |
13 | 0 = attack triggers when no players are in the area. | |
14 | 1 = attack triggers when only war enemies and skulled players, noone else. | |
15 | 2 = attack triggers when innocents are in the area but not when friendlies are. | |
16 | 3 = attack triggers when friendlies are in the area but not when innocents are. | |
17 | 4 = attack triggers without any regards to players in the area. | |
18 | ]] | |
19 | --{spell="exori gran", threshold=5, mana=50, radius=1, aggressive=0}, | |
20 | - | {rune=3191, threshold=2, radius=6, aggressive=4}, |
20 | + | {rune=3191, threshold=2, radius=5, aggressive=0}, |
21 | --{spell="exori mas", threshold =7, mana=80, radius=4, aggressive=0} | |
22 | } | |
23 | } | |
24 | ||
25 | local attack = false | |
26 | local function think() | |
27 | - | local target = Creature.GetByID(Self.TargetID) |
27 | + | local target = Creature.GetByID(Self.TargetID()) |
28 | if(target:isVisible() and target:isAlive() and target:isValid())then -- target is visible, record it | |
29 | attack = true | |
30 | elseif(not target:isVisible() and attack)then -- creature went invisible, attack it | |
31 | attack = false -- for next check | |
32 | for _, info in ipairs(config.attacks)do | |
33 | local check = getTargetsInArea(Self.Position(), info.radius, info.aggressiveness, true) | |
34 | if(check)then -- if it's not false from a security check, continue | |
35 | if(info.spell)then | |
36 | Self.Cast(info.spell, info.mana) | |
37 | elseif(info.rune)then | |
38 | Self.UseItemWithMyPosition(info.rune) | |
39 | end | |
40 | wait(2000,2500) | |
41 | end | |
42 | end | |
43 | end | |
44 | end | |
45 | ||
46 | print(info) | |
47 | wait(5000) | |
48 | while (true) do | |
49 | think() | |
50 | wait(500) | |
51 | end |