• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC [NPC] Policeman - Kill Pk Players!

SeRoN

Banned User
Joined
Feb 6, 2012
Messages
760
Reaction score
32
Location
when angels cry, when birds don't fly, When Blood
Read The Following Before Reading the Thread :
1. Iam Not Author Of This NPC.
2. I Found This Npc In My PC And I think It Well Be Nice To Share It With You Guys.
3. Don't Be Fool And Put Other Links In My Thread, :p

This Policeman Kills All Pk Players , Today You can Add This Funny NPC To your OT!
I Think It Will Be Funny :$

~|You Can Edit His attack |~ Either Higher Or Lower ...
doTargetCombatHealth(getNpcCid(), target, COMBAT_LIFEDRAIN, -8000, -20000, CONST_ME_EXPLOSIONAREA)





NPC-:

PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Policeman" script="data/npc/scripts/Policeman.lua" walkinterval="2000" floorchange="0" speed="1500">
<health now="100" max="100"/>
<look type="151" head="62" body="62" legs="62" feet="114" addons="3"/>
</npc>



NPC-SCRIPT: Policeman.lua :w00t:
PHP:
 local target = 0
local prevTarget = 0
local maxChaseDistance = 40
local origPos = 0
local lastAttack = 0
local followTimeout = 10
local function isSkulled(cid)
if(getPlayerSkullType(cid) >= 3 and isPlayerPzLocked(cid) == TRUE) then
return true
end
return false
end
local function goToOrigPos()
target = 0
lastAttack = 0
selfFollow(0)
doTeleportThing(getNpcCid(), origPos)
end
local function updateTarget()
if(isPlayer(target) == FALSE) then
goToOrigPos()
elseif(not isSkulled(target)) then
selfSay("Now, behave in the future.")
goToOrigPos()
end
if(target == 0) then
local list = getSpectators(getNpcPos(), 9, 9, false)
for i = 1, table.getn(list) do
local _target = list[i]
if(_target ~= 0) then
if(isPlayer(_target) == TRUE and isSkulled(_target)) then
if(getTilePzInfo(getCreaturePosition(_target)) == FALSE) then
if(selfFollow(_target)) then
target = _target
if(target ~= prevTarget) then
selfSay("You Have No Respect For Me And Going Pk In Front Of My Sight!")
end
prevTarget = target
break
end
end
end
end
end
end
end
function onCreatureAppear(cid)
if(cid == getNpcCid()) then
origPos = getNpcPos()
end
end
function onCreatureDisappear(cid)
if(cid == target) then
goToOrigPos()
end
end
function onCreatureMove(creature, oldPos, newPos)
--
end
function onThink()
updateTarget()
if(target == 0) then
return
end
local playerPos = getCreaturePosition(target)
local myPos = getNpcPos()
if(myPos.z ~= playerPos.z) then
goToOrigPos()
return
end
if(math.abs(myPos.x - origPos.x) > maxChaseDistance or math.abs(myPos.y - origPos.y) > maxChaseDistance) then
selfSay("I'll catch you next time.")
goToOrigPos()
return
end
if(lastAttack == 0) then
lastAttack = os.clock()
end
if(os.clock() - lastAttack > followTimeout) then
selfSay("You got me this time, but just wait.")
goToOrigPos()
return
end
if((math.abs(playerPos.x - myPos.x) <= 1) and (math.abs(playerPos.y - myPos.y) <= 1)) then
doTargetCombatHealth(getNpcCid(), target, COMBAT_LIFEDRAIN, -8000, -20000, CONST_ME_EXPLOSIONAREA)
lastAttack = os.clock()
end
end



Rep + IF You Like IT
 
Or, you can do something like that:
Lua:
doTargetCombatHealth(getNpcCid(), target, COMBAT_LIFEDRAIN, -getCreatureMaxHealth(target)/100, -getCreatureMaxHealth(target)/99, CONST_ME_BLOCKHIT)

Now NPC deals about 1% of max hp of target (per one hit, so +/- 20% per sec).
 
Will it work for TFS 0.2?
I need one for my RaceWars server, haven't looked around much but this one looks nice.
Would even need direct attack on certain VOCS if possible, however, if yours works for TFS as it is, Im glad as a start. Good job anyway!

Kind Regards,
Eldin.
 
Mmm, the NPC can attack to the player with storevalue 14588?
 
doTargetCombatHealth(getNpcCid(), target, COMBAT_LIFEDRAIN, -100, -200, CONST_ME_EXPLOSIONAREA)
My RlOT - I use this Npc Look Like Event :) ty bro
 
ahahaha
this Npc Attack Red Skull Players
i want this npc kill white skull only :p

Replace:
Lua:
if(getPlayerSkullType(cid) >= 3 and isPlayerPzLocked(cid) == TRUE) then
for:
Lua:
if(getPlayerSkullType(cid) == 3 and isPlayerPzLocked(cid) == TRUE) then
 
Back
Top