Prosba o npc dam reputa

Status
Zamknięty.

Kebabik

Active User
Zarejestrowany
Dołączył
Sierpień 11, 2009
Posty
106
Liczba reakcji
10
Czy moglby ktos dac mi npc guarda tylko takiego ktorego mozna atakowac :)

Notka moderatorska:
Z?y dzia?, przenosz?.
 
Odp: Prosba o npc dam reputa

Data-->/npc/Npc [Cityguard.xml]<utworz> a w nim, wklej:

Kod:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Cityguard" script="data/npc/scripts/cityguard.lua" walkinterval="0" floorchange="0" speed="900">
	<health now="750" max="1000"/>
	<look type="131" head="19" body="19" legs="19" feet="19"/>
  <interaction range="3" idletime="60">
    <interact keywords="hi" focus="1">
      <keywords>hello</keywords>
      <response text="Jestem ciezko walczacym wojownikiem, chronie tego miasta. Splywaj stad!.">
        <action name="idle" value="1"/>
      </response>
    </interact>
    <interact keywords="bye" focus="0">
      <keywords>farewell</keywords>
      <response text="Bye? Mowie tylko po Polsku, wybac, Zegnaj!"/>
    </interact>
  </interaction>
</npc>

nastepnie przejdz do data/npc/scripts, i utworz plik o nazwie cityguard!
, i wklej do niego:

Kod:
local target = 0
local prevTarget = 0
local maxChaseDistance = 20
local origPos = 0
local lastAttack = 0
local followTimeout = 10
local function isSkulled(cid)
	if(getCreatureSkullType(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("We do not tolerate people like you here!")
							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, -700, -900, CONST_ME_BLOCKHIT)
		lastAttack = os.clock()
	end
end

Straznik bedzie atakowal kazdego gracza, ktory ma pk, (rs, bs - jesli ma pz)
 
Odp: Prosba o npc dam reputa

Ale tego guarda nie mozna atakowac ... chodzi mi o guarda ktory atakuje pk ale mozna go atakowac
 
Odp: Prosba o npc dam reputa

npc s? nieatakowalni

musisz zmieni? to w c++

a monsterem to si?chyba nie da tego rozwia?a? (?eby atakowa? pk) chyba, ?e te? w c++



pozatym ttaki npc ma broni? graczy a nie wejdzie jaki? 1000000 lvl i wszystkich pozabija ??cznie z guardami na hita
 
Odp: Prosba o npc dam reputa

hmm na pewnym otsie widzialem ze ludzie atakowali guardow :/ moze to byl monster no nie wiem w kazdym razie temat do zamkniecia
 
Status
Zamknięty.
Back
Do góry