Maro222225
Active User
ehh...mam pytanie w moim ots-ie potwory sie atakuj? !!!!! Oto 1 przyk?ad
Dla czego tak sie dziaje ??? Zna kto? odpowiedz??? 







@ edit
daje tu minor.lua
Kod:
<?xml version="1.0"?>
<npc name="a Troll" script="data/npc/scripts/minor.lua" access="0" moveable="0" speed="210" npc="3" respawn="1" monster="1" givenxp="200" level="30" maglevel="80">
<mana now="800" max="800"/>
<health now="150" max="150"/>
<respawn x="263" y="234" z="7"/>
<respawn2 x="263" y="234" z="7"/>
<experience experience="15000"/>
<look type="15" head="2" body="2" legs="2" feet="2" corpse="2018"/>
<attack type="melee" damage="50"/>
<loot>
<lootitem loot="0" lootid="1890" chance="5"/>
<lootitem loot="1" lootid="1746" chance="10"/>
<lootitem loot="2" lootid="1737" chance="5"/>
<lootitem loot="3" lootid="1741" chance="10"/>
<lootitem loot="4" lootid="1793" chance="5"/>
</loot>
</npc>
@ edit
daje tu minor.lua
Kod:
meta = 0
target = 0
following = false
attacking = false
kret = 0
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(id, stackpos)
end
function onCreatureTurn(creature, stackpos)
end
function onCreatureSay(cid, type, msg)
end
function onCreatureChangeOutfit(creature)
end
function onThink()
-- find random target 9 tiles away check if he is not in friendlist
if attacking == false then
target = FindTarget(8)
dist = getDistanceToCreature(target)
if dist ~= nil and not checkattackable(target) then
attacking = true
end
end
-- target found starting attack
if attacking == true then
-- starting random switch code
rand = math.random(1, 1000)
-- change 985 to lower for monsters to switch more oftern or viceverse
if (rand > 985) then
meta = FindTarget(8)
dist = getDistanceToCreature(meta)
if dist ~= nil and not checkattackable(meta) then
target = meta
attacking = true
end
end
dosomething()
dist = getDistanceToCreature(target)
if dist == nil then
selfGotoIdle()
return
end
if dist >= 8 then
attacking = false
end
if dist <= 1 then
selfAttackCreature(target)
jiggle(target,5)
return
else
-- slow down code (to speed them up put kret = kret - 2 or more and increase their level too :P)
if (kret <= 1) then
kret = kret + 1
moveToCreature(target)
return
else
kret = kret - 1
return
end
end
-- check if target managed to escape us...
dist = getDistanceToCreature(target)
if (dist ~= nil or dist > 9) then
attacking = false
target = 0
end
end
end
-- casting spells at random
function dosomething()
rand = math.random(1, 1000)
if attacking == true then
dist = getDistanceToCreature(target)
selfAttackCreature(target)
return
end
end