(8.1) Npc Guard

 
Tibia.net.pl

Wróć   Tibia.net.pl > OpenTibia > Skrypty Lua & XML > NPC

#2 event Tibia.net.pl: Kończymy rozgrzewkę! (Start - Sobota, godz. 17:00) Big meeting (22 listopada, Poznań)


  Tibia.net.pl (#?)
(8.1) Npc Guard

Dyskusja dotycząca tematu (8.1) Npc Guard, który znajduje się w kategorii Skrypty Lua & XML (Znajdują się tutaj potwory, NPC, itd. Publikacja tylko GOTOWYCH skryptów!), na forum NPC (). Treść: Potrzebuje npc guarda żeby atakował pk, a nie ze zabija jak ktoś przeklnie itp... Mógł by mi zrobić tego Guarda Z ...


Odpowiedz
 
31-08-2008, 19:45  
Nowicjusz

(8.1) Npc Guard


Potrzebuje npc guarda żeby atakował pk, a nie ze zabija jak ktoś przeklnie itp... Mógł by mi zrobić tego Guarda Z góry dzięki
 


06-09-2008, 11:35  
Gaduła
 
Użytkownik adus41 na Tibia.net.pl

Odp: (8.1) Npc Guard


Stwórz w Data/NPC/Scripts plik o nazwie defender.lua
wklej tam :
Kod:
local level = 10  ----- change this to make the npc hit more/less---------------------|damage_min = (level * 2 + maglevel * 3) * min_multiplier |
 local maglevel = 10  ----- change this to make the npc hit more/less -----------------|damage_max = (level * 2 + maglevel * 3) * max_multiplier |
 local min_multiplier = 2.1  ----- change this to make the npc hit more/less ----------|damage_formula = math.random(damage_min,damage_max)      |
 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 (,) 
 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 shoot_effect = CONST_ANI_SUDDENDEATH  ----- set this to the magic effect that will be shot at the creature, 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 = getCreatureHealth(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 ..' ')  
			doCreatureAddHealth(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 getPlayerSkullType(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[i])  
						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)
						doSendDistanceShoot(getCreaturePosition(getNpcCid(  )), getThingPos(monster_table[i]), shoot_effect)
						doSendMagicEffect(getThingPos(monster_table[i]),hit_effect)  
						doSendAnimatedText(getThingPos(monster_table[i]),damage_formula,damage_colour)  
						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
W Folderze NPC stwórz plik o nazwie Defender.xml i wklej tam :
Kod:
<?xml version="1.0"?>
 <npc name="Defender" script="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>
Daj reputa jak pomogłem
 
14-09-2008, 15:43  
Maniak
 
Użytkownik Marszal na Tibia.net.pl

Odp: (8.1) Npc Guard


kurcze na 8.20 mi nie dziala jak cos powiem np fuck (srry za przeklenstwa) to mi blad w silniku wyskakuje ;(
 


Odpowiedz

Narzędzia tematu
Wygląd

Podobne wątki

Poszukuje NPC Guard 7.6!!! - Potrzebny mi do mojego OTS npc ktory bedzie zabijal Pk ;p. THX za pomoc. /Przenoszę do Request. Jozo16, 18-10-2008 [8.10]Poszukuje: Guard oraz The Oracle. - 1.Poszukuje Guarda, co tylko stoi i nic nie robi.gdy ktos mowi ,,hi" on odpowiada ,,Dlugie zycie GM'a" i konczy rozmowe.help me? 2.Poszukuje The... Bruko, 27-09-2008 [8.1][NPC] Guard - Skrypt polega na tym że Guard zabije osobę która przeklnie. Więc wchodzimy w xxx\data\npc\scripts i tworzymy plik guard.lua. W nim piszemy:... adsko, 23-09-2008 [8.1][NPC]Prison Guard - Autor:Johan Na sam początek tworzymy w data/npc/scripts plik prison.lua Wklejamy tam to: focus = 0 talk_start = 0 target = 0 following =... Agacik, 16-08-2008 Inne The Inquisition Quest - The Inquisition Questv1.1 Początek: Thais Wymagane: # Ekwipunek: Lina, Łopata, Maczeta, # 20 Vampire Dusts # 20 Demonic Essences ... Kavarito, 14-08-2008


Tibia.net.pl: NPC ()
Temat: (8.1) Npc Guard Potrzebuje npc guarda żeby atakował pk, a nie ze zabija [...]


[TFS]Paru podstawowych NPC na kazdego OTS - Gesior.pl (0) Wczoraj 16:28 Obronca miasta/graczy - Gesior.pl (1) Wczoraj 16:23 [8.2x][NPC]NPC Trade System - Hoster (0) 18-11-2008 13:10 [8.22] Potrzebny NPC - wiewiorQ (0) 16-11-2008 13:32 [8.1][npc] Jubiler, Djinn, Bp Potions... - Ariantede (0) 16-11-2008 08:47 [7.6] 2 fajne NPC - Kaspersky 2008 (2) 14-11-2008 20:31 [-8.1] Priv NPC by Aragorn - Aragornkk (0) 14-11-2008 16:03 [8.1][Poradnik]Jak napisać swojego 1 NPCa? - mayu11 (5) 14-11-2008 20:17 [8.31] Npc Sprzedajacy Addon item - Xrobix (0) 09-11-2008 12:48 [8.0] Prosze opomoc z NPC sprzedajacym faje wodne - zimny36 (0) 09-11-2008 00:55


Czasy w strefie GMT +1. Teraz jest 05:12.




Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.2.0 © 2008, Crawlability, Inc.