Registrate y participa en nuestro foro , para que cada dia sea mas completo, y mejor para todos.
 
ÍndicePortalGaleríaFAQBuscarRegistrarseMiembrosGrupos de UsuariosConectarse

Comparte | 
 

 Npc q ataka a los pks jojojojo

Ver el tema anterior Ver el tema siguiente Ir abajo 
AutorMensaje
Admin Nivaldo
Admin
avatar

Cantidad de envíos : 34
Edad : 24
Fecha de inscripción : 01/03/2008

MensajeTema: Npc q ataka a los pks jojojojo   Sáb Dic 13, 2008 12:21 pm

jojojoj mueran pks

creditos : betoxz de otservhispano

primero vamos a tu server/data/npc/scripts
copiamos uno y le ponemos lo sigiente


Código:
-------By Far Carder------
-----------------start of config-----------------
local level = 10 ----- change this to make the npc hit more/less
local maglevel = 10 ----- change this to make the npc hit more/less
local min_multiplier = 2.1 ----- change this to make the npc hit more/less
local max_multiplier = 4.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 = "An Invader, ATTACK!!!" ----- change this to what the NPC says when he sees a monster(s)
local town_name = "Archgard" ----- 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
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 = "Take this!!!" ----- change this to what you want the NPC to say when he attackes a swearer
local swear_words = {"shit", "fuck", "dick", "cunt"} ----- 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 (,)
------------------end of config------------------
local check_clock = os.clock() ----- leave this
local focus = 0 ----- leave this
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
end
function onCreatureTurn(creature)
end
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 messageIsInArray(swear_words, msg) == TRUE 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 onCreatureChangeOutfit(creature)
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 table.getn(monster_table) >= 1 then
selfSay('' .. Attack_message ..' ')
for i = 1, table.getn(monster_table) do
doNpcSetCreatureFocus(monster_table[i])
damage_min = (level * 2 + maglevel * 3) * min_multiplier
damage_max = (level * 2 + maglevel * 3) * max_multiplier
damage_formula = math.random(damage_min,damage_max)
doSendMagicEffect(getThingPos(monster_table[i]),17)
doSendAnimatedText(getThingPos(monster_table[i]),damage_formula,180)
doCreatureAddHealth(monster_table[i],-damage_formula)
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

ahora asemos esto copiamos un npc.xml i le cambiamos el nombre a defender i lo abrimos con bloc de notas i le borramos
todo i le agregamos lo siguiente:

Código:
<?xml version="1.0"?>

<npc name="Defender" 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>

i por ultimo vamos a nuestro global.lua lo asemos por el update ke iso farder darker i agregamos esto a el global.lua:

Código:
function messagecontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end

function messageIsInArray(array_name, message)
value = 0
message = string.lower(message)
for a = 1, table.getn(array_name) do
if messagecontains(message, array_name[a]) then
value = 1
end
end
return value
end

y listo el npc esta listo a ora una explicacion xD:

-------By Far Carder------
-----------------start of config-----------------
local level = 10 ----- Aki puedes modificar como quieres que attake entre mas mas fuerte attaka
local maglevel = 10 ----- Aki puedes modificar como quieres que attake entre mas mas fuerte attaka
local min_multiplier = 2.1 ----- Aki tambien le pueden modificar para incrementar su attake
local max_multiplier = 4.2 ----- Aki tambien le pueden modificar para incrementar su attake
local check_interval = 5 ----- Aki cambian la rapides del attake del defender entre mas rapido attake mas lag abra =/.
local radiusx = 7 ----- Aki cambian pues a cuantos squars meters se mueva por desir 7 squares se ma a mover a la derecha y isquierda.
local radiusy = 5 ----- Aki dejenlo hasi es para los squares que ba a attakar
local Attack_message = "An Invader, ATTACK!!!" ----- a qui cambian que quieren que diga cuando este attakando
local town_name = "Archgard" ----- Este es el nombre de la ciudad que diga cuando diga alguien hi.
local Attack_monsters = TRUE ----- si le ponen TRUE es que ba a attakar a los monstres si lo ponen false no los attaka
local Attack_swearers = TRUE ----- Treu para attakar a los que disen palabrotas alado de el como fu*ck
local Attack_pkers = TRUE ----- Aki true para que attaken a los pk false para que no los attaken
local health_left = 10 ----- Este es la vida que le ba a dejar al player si disen una mala palabra como fu*ck you guard
local swear_message = "Take this!!!" ----- esto es lo que ba a desir cuando attake al player que esta disiendo una palabrota
local swear_words = {"shit", "fuck", "dick", "cunt"} ----- aki le pones las las maldisiones de tu region que puedan desir los player (recuerda separar las palabras con (") y una (,) coma)

y por fin terminamos....
teman pks !!![left]
Código:
[code][code][/code][code]
Volver arriba Ir abajo
Ver perfil de usuario http://otserverchile.activoforo.com
 
Npc q ataka a los pks jojojojo
Ver el tema anterior Ver el tema siguiente Volver arriba 
Página 1 de 1.

Permisos de este foro:No puedes responder a temas en este foro.
OT Server Chile :: Guias y Tutoriales :: Guias Npc-
Cambiar a: