Npc Guarda! Que Mata Pk's Red E White Skull

Special_Forces

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 30/09/06Posts: 88Char no Tibia: Peagah Slash

Raizen Guard.xml (data\npc\Raizen Guard.xml)

<?xml version="1.0"?>

 

<npc name="Raizen Guard" script="data/npc/scripts/defender.lua" access="5" lookdir="2" autowalk="25">

<mana now="800" max="800"/>

<health now="200" max="200"/>

<look type="131" head="116" body="94" legs="78" feet="115" addons="3"/>

</npc>

 

Defender.lua(data\npc\script\defender.lua)

-------By Far Carder------

-----------------start of config-----------------------------------------------------------------------What the formula looks like---------------

local level = 100 ----- change this to make the npc hit more/less---------------------|damage_min = (level * 2 + maglevel * 3) * min_multiplier |

local maglevel = 30 ----- change this to make the npc hit more/less -----------------|damage_max = (level * 2 + maglevel * 3) * max_multiplier |

local min_multiplier = 12.1 ----- change this to make the npc hit more/less ----------|damage_formula = math.random(damage_min,damage_max) |

local max_multiplier = 19.2 ----- change this to make the npc hit more/less ---------------------------------------------------------------------

local check_interval = 5 ----- change this to the time between checks for a creature (the less time the more it will probably lag :S)

local radiusx = 7 ----- change this to the amount of squares left/right the NPC checks (default 7 so he checks 7 squares left of him and 7 squares right (the hole screen)

local radiusy = 5 ----- change this to the amount of squares left/right the NPC checks (default 5 so he checks 5 squares up of him and 5 squares down (the hole screen)

local Attack_message = "One Invasor! DIE!!!" ----- change this to what the NPC says when he sees a monster(s)

local town_name = "Raizens OTS" ----- the name of the town the NPC says when you say "hi"

local Attack_monsters = TRUE ----- set to TRUE for the npc to attack monsters in his area or FALSE if he doesnt

local Attack_swearers = TRUE ----- set to TRUE for the npc to attack players that swear near him or FALSE if he doesnt

local Attack_pkers = TRUE ----- set to TRUE for the npc to attack players with white and red skulls or FALSE if he doesnt -- NOTE: Set this to FALSE if you are using TFS as there is no way to tell if a player is skulled on TFS, you will only get errors

local health_left = 10 ----- set to the amount of health the npc will leave a player with if they swear at him (ie at 10 he will hit the player to 10 health left)

local swear_message = "GO GO DEATH!!!" ----- change this to what you want the NPC to say when he attackes a swearer

local swear_words = {"######", "######", "######", "#####", "tnc", "pau no ######", "pnc"} ----- if "Attack_swearers" is set to TRUE then the NPC will attack anyone who says a word in here. Remember to put "" around each word and seperate each word with a comma (,)

local hit_effect = CONST_ME_MORTAREA ----- set this to the magic effect the creature will be hit with, see global.lua for more effects

local damage_colour = TEXTCOLOR_RED ----- set this to the colour of the text that shows the damage when the creature gets hit

------------------end of config------------------

local check_clock = os.clock() ----- leave this

local focus = 0 ----- leave this

function msgcontains(txt, str)

return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))

end

 

function onCreatureSay(cid, type, msg)

msg = string.lower(msg)

health = getPlayerHealth(cid) - health_left

if ((string.find(msg, '(%a*)hi(%a*)'))) and getDistanceToCreature(cid) < 4 then

selfSay('Hello ' .. creatureGetName(cid) .. '! I am a defender of '..town_name..'.')

doNpcSetCreatureFocus(cid)

focus = 0

end

if msgcontains(msg, 'time') then

selfSay('The time is ' .. getWorldTime() .. '.')

end

if messageIsInArray(swear_words, msg) then

if Attack_swearers == TRUE then

selfSay('' .. swear_message ..' ')

doPlayerAddHealth(cid,-health)

doSendMagicEffect(getThingPos(cid),17)

doSendAnimatedText(getThingPos(cid),health,180)

doNpcSetCreatureFocus(cid)

focus = 0

end

end

end

 

function getMonstersfromArea(pos, radiusx, radiusy, stack)

local monsters = { }

local starting = {x = (pos.x - radiusx), y = (pos.y - radiusy), z = pos.z, stackpos = stack}

local ending = {x = (pos.x + radiusx), y = (pos.y + radiusy), z = pos.z, stackpos = stack}

local checking = {x = starting.x, y = starting.y, z = starting.z, stackpos = starting.stackpos}

repeat

creature = getThingfromPos(checking)

if creature.itemid > 0 then

if isCreature(creature.uid) == TRUE then

if isPlayer(creature.uid) == FALSE then

if Attack_monsters == TRUE then

table.insert (monsters, creature.uid)

check_clock = os.clock()

end

elseif isPlayer(creature.uid) == TRUE then

if Attack_pkers == TRUE then

if getPlayerSkull(creature.uid) > 0 then

table.insert (monsters, creature.uid)

check_clock = os.clock()

end

end

end

end

end

if checking.x == pos.x-1 and checking.y == pos.y then

checking.x = checking.x+2

else

checking.x = checking.x+1

end

if checking.x > ending.x then

checking.x = starting.x

checking.y = checking.y+1

end

until checking.y > ending.y

return monsters

end

 

function onThink()

if (Attack_monsters == TRUE and Attack_pkers == TRUE) or (Attack_monsters == TRUE and Attack_pkers == FALSE) or (Attack_monsters == FALSE and Attack_pkers == TRUE) then

if (os.clock() - check_clock) > check_interval then

monster_table = getMonstersfromArea(getCreaturePosition(getNpcCid( )), radiusx, radiusy, 253)

if #monster_table >= 1 then

selfSay('' .. Attack_message ..' ')

for i = 1, #monster_table do

doNpcSetCreatureFocus(monster_table)

local damage_min = (level * 2 + maglevel * 3) * min_multiplier

local damage_max = (level * 2 + maglevel * 3) * max_multiplier

local damage_formula = math.random(damage_min,damage_max)

doSendMagicEffect(getThingPos(monster_table),17)

doCreatureAddHealth(monster_table,-damage_formula) doSendMagicEffect(getThingPos(monster_table),hit_effect)

doSendAnimatedText(getThingPos(monster_table),damage_formula,damage_colour)

check_clock = os.clock()

focus = 0

end

elseif table.getn(monster_table) < 1 then

focus = 0

check_clock = os.clock()

end

end

end

focus = 0

end

 

Quem Souber mexer pode mudar o nome, pois esse é do meu server e tem nome raizne guard.

E é necessário colocar ele pelo map editor, se vc não sabe coloca-lo no map editor procure um tutorial, é muito facilzinho



\/Se é meu fan use \/
||~~~~||

Sou Fan De:


MarcolinoGOD

Byte que eu gosto! (TI na veia)
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 19/06/07Posts: 267Gênero: MasculinoChar no Tibia: Rambocop Infernus

Meu amigo creio que não seja você o criador

deste NPC porque faz tempo que tenho ele aqui em casa e

quem criou ele foi um tal de hombre de um antigo forum de

OtServ! (Estas informações consegui no script que não fala muita coisa)

Coloque os devidos creditos ao criador!

 

Sem mais...

--

Special_Forces

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 30/09/06Posts: 88Char no Tibia: Peagah Slash

Não colokei créditos a mim

e eu axei que todos no forum tivessem olhos

 

-------By Far Carder------

-----------------start of config-----------------------------------------------------------------------What the formula looks like---------------

local level = 100 ----- change this to make the npc hit more/less---------------------|damage_min = (level * 2 + maglevel * 3) * min_multiplier |

local maglevel = 30 ----- change this to make the npc hit more/less -----------------|damage_max = (level * 2 + maglevel * 3) * max_multiplier |

local min_multiplier = 12.1 ----- change this to make the npc hit more/less ----------|damage_formula = math.random(damage_min,damage_max) |

local max_multiplier = 19.2 ----- change this to make the npc hit more/less ---------------------------------------------------------------------

local check_interval = 5 ----- change this to the time between checks for a creature (the less time the more it will probably lag :S)

local radiusx = 7 ----- change this to the amount of squares left/right the NPC checks (default 7 so he checks 7 squares left of him and 7 squares right (the hole screen)

local radiusy = 5 ----- change this to the amount of squares left/right the NPC checks (default 5 so he checks 5 squares up of him and 5 squares down (the hole screen)

local Attack_message = "One Invasor! DIE!!!" ----- change this to what the NPC says when he sees a monster(s)

local town_name = "Raizens OTS" ----- the name of the town the NPC says when you say "hi"

local Attack_monsters = TRUE ----- set to TRUE for the npc to attack monsters in his area or FALSE if he doesnt

local Attack_swearers = TRUE ----- set to TRUE for the npc to attack players that swear near him or FALSE if he doesnt

local Attack_pkers = TRUE ----- set to TRUE for the npc to attack players with white and red skulls or FALSE if he doesnt -- NOTE: Set this to FALSE if you are using TFS as there is no way to tell if a player is skulled on TFS, you will only get errors

local health_left = 10 ----- set to the amount of health the npc will leave a player with if they swear at him (ie at 10 he will hit the player to 10 health left)

local swear_message = "GO GO DEATH!!!" ----- change this to what you want the NPC to say when he attackes a swearer

local swear_words = {"######", "######", "######", "#####", "tnc", "pau no ######", "pnc"} ----- if "Attack_swearers" is set to TRUE then the NPC will attack anyone who says a word in here. Remember to put "" around each word and seperate each word with a comma (,)

local hit_effect = CONST_ME_MORTAREA ----- set this to the magic effect the creature will be hit with, see global.lua for more effects

local damage_colour = TEXTCOLOR_RED ----- set this to the colour of the text that shows the damage when the creature gets hit

------------------end of config------------------

local check_clock = os.clock() ----- leave this

local focus = 0 ----- leave this

function msgcontains(txt, str)

return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))

end

 

function onCreatureSay(cid, type, msg)

msg = string.lower(msg)

health = getPlayerHealth(cid) - health_left

if ((string.find(msg, '(%a*)hi(%a*)'))) and getDistanceToCreature(cid) < 4 then

selfSay('Hello ' .. creatureGetName(cid) .. '! I am a defender of '..town_name..'.')

doNpcSetCreatureFocus(cid)

focus = 0

end

if msgcontains(msg, 'time') then

selfSay('The time is ' .. getWorldTime() .. '.')

end

if messageIsInArray(swear_words, msg) then

if Attack_swearers == TRUE then

selfSay('' .. swear_message ..' ')

doPlayerAddHealth(cid,-health)

doSendMagicEffect(getThingPos(cid),17)

doSendAnimatedText(getThingPos(cid),health,180)

doNpcSetCreatureFocus(cid)

focus = 0

end

end

end

 

function getMonstersfromArea(pos, radiusx, radiusy, stack)

local monsters = { }

local starting = {x = (pos.x - radiusx), y = (pos.y - radiusy), z = pos.z, stackpos = stack}

local ending = {x = (pos.x + radiusx), y = (pos.y + radiusy), z = pos.z, stackpos = stack}

local checking = {x = starting.x, y = starting.y, z = starting.z, stackpos = starting.stackpos}

repeat

creature = getThingfromPos(checking)

if creature.itemid > 0 then

if isCreature(creature.uid) == TRUE then

if isPlayer(creature.uid) == FALSE then

if Attack_monsters == TRUE then

table.insert (monsters, creature.uid)

check_clock = os.clock()

end

elseif isPlayer(creature.uid) == TRUE then

if Attack_pkers == TRUE then

if getPlayerSkull(creature.uid) > 0 then

table.insert (monsters, creature.uid)

check_clock = os.clock()

end

end

end

end

end

if checking.x == pos.x-1 and checking.y == pos.y then

checking.x = checking.x+2

else

checking.x = checking.x+1

end

if checking.x > ending.x then

checking.x = starting.x

checking.y = checking.y+1

end

until checking.y > ending.y

return monsters

end

 

function onThink()

if (Attack_monsters == TRUE and Attack_pkers == TRUE) or (Attack_monsters == TRUE and Attack_pkers == FALSE) or (Attack_monsters == FALSE and Attack_pkers == TRUE) then

if (os.clock() - check_clock) > check_interval then

monster_table = getMonstersfromArea(getCreaturePosition(getNpcCid( )), radiusx, radiusy, 253)

if #monster_table >= 1 then

selfSay('' .. Attack_message ..' ')

for i = 1, #monster_table do

doNpcSetCreatureFocus(monster_table)

local damage_min = (level * 2 + maglevel * 3) * min_multiplier

local damage_max = (level * 2 + maglevel * 3) * max_multiplier

local damage_formula = math.random(damage_min,damage_max)

doSendMagicEffect(getThingPos(monster_table),17)

doCreatureAddHealth(monster_table,-damage_formula) doSendMagicEffect(getThingPos(monster_table),hit_effect)

doSendAnimatedText(getThingPos(monster_table),damage_formula,damage_colour)

check_clock = os.clock()

focus = 0

end

elseif table.getn(monster_table) < 1 then

focus = 0

check_clock = os.clock()

end

end

end

focus = 0

end



\/Se é meu fan use \/
||~~~~||

Sou Fan De:


decion

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 02/09/07Posts: 19

Kara eu testei ele aki mas ele fika dando ums erros no programa do ot ...

 

 

 

Luagethingfrompos

 

 

 

flow

Special_Forces

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 30/09/06Posts: 88Char no Tibia: Peagah Slash

Para ele só atacar creaturas em

local Attack_monsters = TRUE ----- set to TRUE for the npc to attack monsters in his area or FALSE if he doesnt

coloque false e ele nao ataka os monstros



\/Se é meu fan use \/
||~~~~||

Sou Fan De:


decion

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 02/09/07Posts: 19

Nah xP

N tem nada a v kom os bixos é: Luagethingfrompos () Tile Not Found

 

Algo assim

Special_Forces

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 30/09/06Posts: 88Char no Tibia: Peagah Slash

seu ot não tem supórte a o NPC então



\/Se é meu fan use \/
||~~~~||

Sou Fan De:


decion

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 02/09/07Posts: 19

aries 4.5 ... :/

blz :(

valew

nightshade

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 03/02/08Posts: 18Char no Tibia: Ysuldur

poderia dizer em qual ot roda?

 

 

eh soh pegar o script como ta ali e ele vai funcinar jah? ou precisa fazer alteracao?

 

 

Cya



Sou fan de..

Misterius

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 14/08/06Posts: 24

da hora , tou fazendo um test aki no meu ot se fumfa eu posto aki memo.

MarcolinoGOD

Byte que eu gosto! (TI na veia)
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 19/06/07Posts: 267Gênero: MasculinoChar no Tibia: Rambocop Infernus

Se você colocar "TRUE" aqui:

local Attack_monsters = TRUE ----- set to TRUE for the npc to attack monsters in his area or FALSE if he doesnt

O Npc fica atacando os npc! Oo

 

Sem mais...

--

Darllan0

Darllan \___Bleach___/
avatar
Cavaleiro
Cavaleiro

INFOS

Grupo: CavaleiroRegistrado: 04/11/07Posts: 192Char no Tibia: Ranzor Raven

ele tbm ataca a pessoa quando ela xinga??

Darllan Client Maker/Npc Maker
XD

Metas:
(x) 10 Posts
(x) 30 Posts
(x) 50 Posts
(x) 80 Posts
(x) 100 posts
(x) 200 Posts
(x) 250 Posts
(x) 280 Posts
(x) 300 Posts
(x) 350 Posts
( ) 380 Posts
( ) 400 Posts
( ) 450 Posts
( ) 480 Posts
( ) 500 Posts....

Sou Fan De:
<div style="margin:0px 0px 0px 0px">
<div class="smallfont" style="margin-bottom:0px">
<input type="button" value="Mostrar Spoil" style="width:80px;font-size:10px;margin:0px;padding:0px;" onclick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Esconder'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Mostrar Spoil'; }">
</div>
<div style="margin: 0px; padding: 0px; border: 0px inset;">
<div style="display: none;">
<img src="http://img156.imageshack.us/img156/2959/tymaoes949di7.png" border="0" class="linked-sig-image" />
<img src="http://img216.imageshack.us/img216/7688/sadfcopyyp9jm4df0.png" border="0" class="linked-sig-image" />
</div>
</div>
<img src="http://i492.photobucket.com/albums/rr287/Fliper_010/darllanxtibia.png" border="0" class="linked-sig-image" />

Ajudar é Humano e Tibiano =D:
<a href="http://s8.bitefight.com.pt/c.php?uid=95671" target="_blank">http://s8.bitefight.com.pt/c.php?uid=95671</a>

Te Ajudei ?, me ama?, me odeia? ou so que enfeitar sua assinatura? entao use
<img src="http://i492.photobucket.com/albums/rr287/Fliper_010/DarlanFANxtibia.png" border="0" class="linked-sig-image" />

boladuu

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 15/08/07Posts: 35

eaw gostei do npcm u unico lugar que vi dar erro foi qnd falo "time" pra ele mas retirei essa fala do npc e agora ta tudo certo

vlw

......:::::Metas:::::.......

Ser um dia tao bonito quanto minha mae acha-----------------( )
Ser um high-level no tibia-----------------------------------------( )
Passar de ano no colegio sem recuperaçao---------------------( )
Virar um jogador de futebol famoso-----------------------------( )

Parar de sonhar----------------------------------------------------( )





Misterius

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 14/08/06Posts: 24

cara eu colokei ess npc no meu ot ficou muito roxxxxxx vlws