• 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!

TD System pomocy!

A jak byś tak na co drugim sqm dał onStepOut zamiast onStepIn wtedy skrypt wykonywał by się podczas schodzenia z sqm.
 
no to problem rozwiązany, zamieniłem
Code:
if(not isPlayer(cid))
na
Code:
if(isPlayer(cid))

i zadziałało... nie wiem czemu tak sie stało ; d
Wielkie dzięki Kurczok, Chojrak ;D

teraz tylko problem z summonami...
jest ktoś w stanie pomóc?
 
Ja mam pomysł taki że masz w bp przedmioty które się nie kończą i możesz ich używać na podłodze o id xxxx i wtedy tworzy się npc który atakuje potwory w zasięgu xxx tak jak defender atakuje graczy ze skullami.
 
W sumie dobry pomysł Kurczok... tylko narazie poskładam wszystko do kupy, zrobię działającą wersje 'minigierki' (xD) a potem będę myślał o leprzych rozwiązaniach ;)
Napewno to z tymi stepin,out jest lepsze bo wydaje mi się że potworki będą mogły chodzić ze swoją 'ustawioną' prędkością.
 
ja raczej myślałem o zrobieniu nowych potworków (summonów) które tylko stoją (ew. można je posunąć) i atakują... tylko właśne nie wiem jak zrobić żeby atakowały bez rozkazu...

chociaż to z npc może być łatwiejszym rozwiązaniem ;d momencik...
 
ja raczej myślałem o zrobieniu nowych potworków (summonów) które tylko stoją (ew. można je posunąć) i atakują... tylko właśne nie wiem jak zrobić żeby atakowały bez rozkazu...

chociaż to z npc może być łatwiejszym rozwiązaniem ;d momencik...

co mówisz?
 
chyba nie dam rady ;d jak zrobić takiego npc co by stał w miejscu i na dystans bił potworki... proszę o jeden przykład, resztę postaram się przerobić tak aby mogły być jako inne 'wieżyczki'
 
wzoruj się na npc cityguard, nie mam pojęcia czy to tak działa ale można do monsterów dodać skulla wtedy npc by bił no chyba że jest ustawione że jedynie graczy bije.

/\ Domysły :>
 
hmm a jak dodać do potworka skulla? nigdy o czymś takim nie słyszałem, jedynie o skullu na npc ;d jednak i tak nie wiem jaki to ma sens...
 
Sherlok, już nie masz corobić tylko spamować?

#Topic

Tak jak kurczok pisał, próbuj na wżór Cityguarda. A co do pomysłu to bardzo fajny, chętnie bym sobie zagrał na takim TD.
 
Chyba Cię zawiodę ale nie mam zamiaru hostowac tego typu otsa ;/
Robię to dla przyjemności własnej oraz moich kolegów i ew. wystawie projekt tu na forum...

Tylko ze ja nadal nie wiem jak zrobic tego skulla u potworków xD
 
wiesz co do końca nie jestem pewien czy te skulle da się do monsterów wstawić, wydaje mi się że widziałem gdzieś takie monstery ale ręki nie dam sobie uciąć.

Wydaje mi się że łatwiej by było przerobić npc żeby sprawdzał czy cel jest potworem i nie jest graczem i wywalić ze skryptu to wszystko co sprawdza skulle.
 
Troszkę niefajnie... żaden cityguard z tych których znalazłem nie bije na dystans tylko idzie, bije solo a potem wraca... za nic, nie umiem znaleźć gdzie się to zmienia... jedynie sila ataku i typ ataku
pomoże ktoś to zedytować:

Code:
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
 
no jasne... nie musisz mnie uświadamiać że nic nie wiem ;D
co mam z tym zrobić i gdzie to wstawić? ;d i czy to pomoże żeby bił na dystans a nie w zwarciu?

#edit
mam tu coś lepszego:
Code:
local level = 1  ----- change this to make the npc hit more/less---------------------|damage_min = (5) * min_multiplier |
 local maglevel = 1  ----- change this to make the npc hit more/less -----------------|damage_max = (10) * max_multiplier |
 local min_multiplier = 1.0  ----- change this to make the npc hit more/less ----------|damage_formula = math.random(damage_min,damage_max)      |
 local max_multiplier = 1.0  ----- change this to make the npc hit more/less ---------------------------------------------------------------------
 local check_interval = 1  ----- 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 = "Die!!"  ----- 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 = FASLE  ----- set to TRUE for the npc to attack players that swear near him or FALSE if he doesnt 
 local Attack_pkers = FALSE  ----- set to TRUE for the npc to attack players with white and red skulls or FALSE if he doesnt 
 local health_left = 0  ----- 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_PHYSICALDAMAGE  ----- 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


Tylko znów są problemy ; d
Npc bije npc... oraz npc bije każdego naokoło... a chciałbym żeby bil max 2 potworki na raz, a najlepiej jak będzie to możliwe do ustawienia tak jak wszystko wyżej w local, dałoby radę?

#edit2
ten npc tez smierdzi ;/ lagi robi na pustym otsie -.-
jakies pomysly?
 
Last edited:
W .xmlu:
Code:
<flag skull="white"/>

A co do tego biegania potworow, zrob cos taka funkcje spawn potworkow, pobranie all cidow do tablicy + addEvent i w nim loop po tablicy i ich przesuwaj. :>

A co do jakiegos NPC nawalajacego, biegajacego czy cos zobacz sobie na kod:
http://otland.net/f83/hunting-assistance-39783/
Troche lame-coded, bo jakis noob pisal..., ale sciagawka jest. ;d
 
Źle mnie rozumiesz Chojrak...
Bieganie potworków narazie zostawmy w spokoju, bo ważne ze teraz coś jest i to "działa"
a co do npc to myślę że się nie przyda... wymaga ustawienia nicku danej postaci, a ja wolałbym żeby działało to na wszystkie. I chodziło mi właśnie o npc który nie chodzi i nawala, ale o takiego który stoi i bije na dystans.
 
Back
Top