I made this because i was bored
!
Go to your npc-lua file and replace
With
Every 5 seconds, the npc will attack players with white, red or black skull on a range of 5x5 (Configurable)
Each time npc attacks the same player, damage will be higher for that player.


Go to your npc-lua file and replace
LUA:
function onThink() npcHandler:onThink() end
With
LUA:
local damaged = {}
local times = {}
local combat =
{
type = COMBAT_FIREDAMAGE,
min = -20,
max = -80,
effect = CONST_ME_FIRE,
disteffect = CONST_ANI_FIRE
}
local rangex, rangey = 4, 4
local timeBetweenAttack = 5 --seconds
function onThink()
local list = getSpectators(getCreaturePosition(getNpcCid()), rangex, rangey)
if list and #list > 0 then
for _, uid in ipairs(list) do
if isPlayer(uid) and getCreatureSkullType(uid) > 2 then
if not damaged[uid] then
damaged[uid] = os.time(t)
times[uid] = 1
doTargetCombatHealth(getNpcCid(), uid, combat.type, combat.min * times[uid], combat.max * times[uid], combat.effect)
doCreatureSay(getNpcCid(), "Get out of here " .. getCreatureName(uid) .. "!", TALKTYPE_SAY)
doSendDistanceShoot(getCreaturePosition(getNpcCid()), getCreaturePosition(uid), combat.disteffect)
return npcHandler:onThink()
else
if os.time(t) - damaged[uid] > timeBetweenAttack then
times[uid] = (os.time(t) - damaged[uid] > 20 and 1 or times[uid] + 1)
damaged[uid] = os.time(t)
doTargetCombatHealth(getNpcCid(), uid, combat.type, combat.min * times[uid], combat.max * times[uid], combat.effect)
doCreatureSay(getNpcCid(), "You again " .. getCreatureName(uid) .. "?... Get out of here!", TALKTYPE_SAY)
doSendDistanceShoot(getCreaturePosition(getNpcCid()), getCreaturePosition(uid), combat.disteffect)
return npcHandler:onThink()
end
end
end
end
end
return npcHandler:onThink()
end
Every 5 seconds, the npc will attack players with white, red or black skull on a range of 5x5 (Configurable)
Each time npc attacks the same player, damage will be higher for that player.

Last edited: