Oskar
Forum friend
- Joined
- Jan 24, 2009
- Messages
- 2,256
- Reaction score
- 331
Otwieramy pliki slime.xml oraz defiler.xml i pod </flags> dodajemy:
Tworzymy potworka:
Nast?pnie folder creaturescripts:
Oraz:
Do creaturescripts.xml dodajemy:
Oczywi?cie potwory umie?ci? blisko du?ych skupisk bagien.
PHP:
<script>
<event name="Bagienne"/>
</script>
Tworzymy potworka:
PHP:
<?xml version="1.0" encoding="ISO-8859-1"?>
<monster name="Unhurried Acarid" nameDescription="Unhurried Acarid" monsterType="bio-elemental" race="venom" experience="22500" speed="100" manacost="0">
<health now="55000" max="55000"/>
<look type="238" corpse="6532"/>
<targetchange interval="1166" chance="10"/>
<strategy attack="100" defense="0"/>
<flags>
<flag attackable="1"/>
<flag hostile="1"/>
<flag convinceable="1"/>
<flag canpushitems="1"/>
<flag canpushcreatures="1"/>
<flag staticattack="90"/>
<flag targetdistance="1"/>
<flag runonhealth="4000"/>
</flags>
<script>
<event name="Unhurried_Acarid"/>
<event name="Bagienne"/>
</script>
<attacks>
<attack name="melee" interval="2000" skill="150" attack="100" poison="-320"/>
<attack name="poison" interval="986" chance="10" range="1" min="-265" max="-313">
<attribute key="areaEffect" value="plantattack"/>
</attack>
<attack name="manadrain" interval="1053" chance="12" radius="4" target="0" min="-453" max="-855">
<attribute key="areaEffect" value="greenshimmer"/>
</attack>
<attack name="earth" interval="1002" chance="11" length="3" spread="0" min="-764" max="-1142">
<attribute key="areaEffect" value="carniphila"/>
</attack>
<attack name="poison" interval="1110" chance="12" radius="3" target="1" min="-324" max="-412">
<attribute key="areaEffect" value="poison"/>
<attribute key="shootEffect" value="poison"/>
</attack>
<attack name="poisoncondition" interval="1193" chance="12" radius="3" target="0" min="-560" max="-600">
<attribute key="areaEffect" value="greenbubble"/>
</attack>
<attack name="earth" interval="901" chance="13" target="1" min="-188" max="-222">
<attribute key="areaEffect" value="greenpaw"/>
<attribute key="shootEffect" value="earth"/>
</attack>
</attacks>
<defenses armor="35" defense="40">
<defense name="speed" interval="953" chance="13" speedchange="315" duration="4000">
<attribute key="areaEffect" value="poff"/>
</defense>
<defense name="healing" interval="1010" chance="13" min="164" max="202">
<attribute key="areaEffect" value="greenspark"/>
</defense>
<defense name="healing" interval="987" chance="11" min="76" max="99">
<attribute key="areaEffect" value="greenspark"/>
</defense>
</defenses>
<elements>
<element energyPercent="10"/>
<element icePercent="20"/>
<element deathPercent="25"/>
<element holyPercent="40"/>
<element firePercent="-10"/>
</elements>
<immunities>
<immunity earth="1"/>
<immunity drunk="1"/>
<immunity lifedrain="1"/>
<immunity paralyze="1"/>
<immunity invisible="1"/>
</immunities>
<voices interval="5000" chance="10">
<voice sentence="Blubb"/>
</voices>
<summons maxSummons="2">
<summon name="slime" interval="1953" chance="25" max="2"/>
<summon name="plaguesmith" interval="1953" chance="15" max="1"/>
</summons>
<loot>
<item id="7405" chance="1730"/> --havoc blade
<item id="8880" chance="1880"/> --swamplair armor
<item id="8901" chance="2240"/> --SB of warding
<item id="2466" chance="5450"/> --golden armor
<item id="8912" chance="6520"/> --springsprout rod
<item id="8857" chance="6540"/> --silkweaver bow
<item id="8849" chance="6540"/> --modified crossbow
<item id="7885" chance="6910"/> --terra legs
<item id="7886" chance="8530"/> --terra boots
<item id="9967" chance="11530"/> --glob of acid slime
<item id="2155" chance="12140"/> --green gem
<item id="2440" chance="12530"/> --daramanian waraxe
<item id="7590" countmax="3" chance="12580"/> --GMP
<item id="9968" chance="12730"/> --glob of tar
<item id="2475" chance="14840"/> --warrior helmet
<item id="2409" chance="18250"/> --serpent sword
<item id="2490" chance="18250"/> --dark helmet
<item id="2515" chance="18530"/> --guardian shield
<item id="5944" countmax="4" chance="19470"/> --soul orb
<item id="2152" chance="22730"/> --silver coin
<item id="2509" chance="23210"/> --steel shield
<item id="2149" countmax="29" chance="28600"/> --small emerald
<item id="2381" chance="32210"/> --halberd
<item id="2148" countmax="46" chance="43140"/> --copper coin
<item id="2148" countmax="33" chance="43140"/> --copper coin
</loot>
</monster>
Nast?pnie folder creaturescripts:
PHP:
local invisible, haste, paralyze = {}, {}, {}
for i = 1000, 5000, 100 do
invisible[i] = createConditionObject(CONDITION_INVISIBLE)
setConditionParam(invisible[i], CONDITION_PARAM_TICKS, i)
haste[i] = createConditionObject(CONDITION_HASTE)
setConditionParam(haste[i], CONDITION_PARAM_TICKS, i)
setConditionFormula(haste[i], 2.00, 50, 4.00, 100)
paralyze[i] = createConditionObject(CONDITION_HASTE)
setConditionParam(paralyze[i], CONDITION_PARAM_TICKS, i)
setConditionFormula(paralyze[i], -0.75, 0, -0.80, 0)
end
local fields = {
[1] = {itemId = {1497,1499}, effect = CONST_ME_TELEPORT},
[2] = {itemId = {1492,1493,1494}, effect = CONST_ME_MAGIC_RED},
[3] = {itemId = {1495}, effect = CONST_ME_MAGIC_BLUE},
[4] = {itemId = {1496}, effect = CONST_ME_MAGIC_GREEN},
}
local function doTryKillCreature(cid, position)
doSendMagicEffect(position, CONST_ME_PLANTATTACK)
local creatureFound = getTopCreature(position).uid
if isCreature(creatureFound) and creatureFound ~= cid then
local targetHealth = getCreatureHealth(creatureFound)
doCreatureAddHealth(cid, targetHealth)
doSendAnimatedText(getThingPos(cid), targetHealth, COLOR_LIGHTGREEN)
return doTargetCombatHealth(cid, creatureFound, COMBAT_EARTHDAMAGE, -targetHealth, -targetHealth, CONST_ME_CARNIPHILA)
end
return false
end
local function doSendEffect(cid, position, n)
if isCreature(cid) then
doSendMagicEffect(position, CONST_ME_HITBYPOISON)
doSendMagicEffect(position, CONST_ME_GREEN_RINGS)
return n < 6 and addEvent(doSendEffect, 250, cid, position, n + 1) or addEvent(doTryKillCreature, 1000, cid, position)
end
return false
end
local function doCreateNatureWall(cid)
if isCreature(cid) then
local position = getThingPos(cid)
for nx = position.x - 1, position.x + 1 do
for ny = position.y - 1, position.y + 1 do
local newPosition = {x=nx,y=ny,z=position.z}
doSendMagicEffect(newPosition, CONST_ME_BIGPLANTS)
doSendMagicEffect(newPosition, CONST_ME_SMALLPLANTS)
local creatureFound = getTopCreature(newPosition).uid
if isPlayer(creatureFound) or (isCreature(creatureFound) and getCreatureMaster(creatureFound) and isPlayer(getCreatureMaster(creatureFound)) and creatureFound ~= cid) then
local targetHealth = getCreatureHealth(creatureFound)
doCreatureAddHealth(cid, targetHealth)
doSendAnimatedText(position, targetHealth, COLOR_LIGHTGREEN)
doTargetCombatHealth(cid, creatureFound, COMBAT_EARTHDAMAGE, -targetHealth, -targetHealth, CONST_ME_SMALLPLANTS)
end
end
end
return true
end
return false
end
local function doSendWallEffect(cid, n)
if isCreature(cid) then
local position = getThingPos(cid)
for nx = position.x - 1, position.x + 1 do
for ny = position.y - 1, position.y + 1 do
doSendMagicEffect({x=nx,y=ny,z=position.z}, CONST_ME_SMALLPLANTS)
end
end
return n >= 5 and addEvent(doCreateNatureWall, 1000, cid, n+1) or addEvent(doSendWallEffect, 500, cid, n+1)
end
return false
end
function onThink(cid)
if isMonster(cid) then
local position = getThingPos(cid)
if math.random(1, 100) <= 2 then
doSendWallEffect(cid, math.random(-2,2))
end
if math.random(100) <= 10 then
for nx = position.x - 1, position.x + 1 do
for ny = position.y - 1, position.y + 1 do
for _, v in pairs(fields) do
local newPosition = {x=nx,y=ny,z=position.z}
local fieldFound = getTileItemById(newPosition, v.itemId)
if fieldFound.uid > 0 then
if fieldFound.itemid == 1496 and math.random(100) <= 25 then
doCreateMonster('slime', newPosition, false)
effect = CONST_ME_GREEN_RINGS
end
doSendMagicEffect(newPosition, effect or v.effect)
doRemoveItem(fieldFound.uid)
end
end
end
end
end
if math.random(100) <= 8 and getCreatureHealth(cid) > getCreatureMaxHealth(cid)*0.15 then
local target = getCreatureTarget(cid)
local pos = isCreature(target) and getThingPos(target)
if isCreature(target) and getDistanceBetween(position, pos) <= 5 and isSightClear(position, pos, true) then
doTeleportThingEffect(cid, {x=pos.x+math.random(-1,1),y=pos.y+math.random(-1,1),z=pos.z}, CONST_ME_PLANTATTACK, true)
end
end
if math.random(100) <= 12 and getCreatureHealth(cid) <= getCreatureMaxHealth(cid)*0.15 then
if math.random(100) <= 25 then
doAddCondition(cid, haste[math.random(10,50)*100])
doSendMagicEffect(position, CONST_ME_MAGIC_GREEN)
end
if math.random(100) <= 25 then
doAddCondition(cid, invisible[math.random(10,50)*100])
end
if math.random(100) <= 25 then
local newSpectators = getSpectators(position, 7, 7)
if newSpectators then
for _, pid in ipairs(newSpectators) do
local pos = getThingPos(pid)
if isPlayer(pid) and pid ~= cid and isSightClear(position, pos, true) then
doAddCondition(pid, paralyze[math.random(10,50)*100])
doSendMagicEffect(pos, CONST_ME_CARNIPHILA)
doSendDistanceShoot(position, pos, CONST_ANI_POISON)
end
end
end
end
end
if math.random(1, 100) <= 8 then
local target = getCreatureTarget(cid)
local pos = isCreature(target) and getThingPos(target)
if isCreature(target) and getDistanceBetween(position, pos) <= 5 and isSightClear(position, pos, true) then
if math.random(3) == 1 and not(getTilePzInfo(pos) or getTileHouseInfo(pos)) then
doSendDistanceShoot(position, pos, CONST_ANI_EARTH)
doSendMagicEffect(pos, CONST_ME_HITBYPOISON)
doSendMagicEffect(pos, CONST_ME_GREEN_RINGS)
doAddCondition(target, paralyze[math.random(10,50)*100])
addEvent(doSendEffect, 250, cid, pos, math.random(-2,2))
end
end
end
end
return true
end
Oraz:
PHP:
local normalSwamp = {4691,4692,4693,4694,4695,4696,4697,4698,4699,4700,4701,4702,4703,4704,4705,4706,4707,4708,4709,4710,4711,4712,4749,4750,4751,4752,4753,4754,4755}
local walkableSwamp = 6353
local config = {
['slime'] = {rand = {10,25}, chance = 10, min = 0.01, max = 0.05},
['defiler'] = {rand = {25,35}, chance = 20, min = 0.2, max = 0.35},
['unhurried acarid'] = {rand = {50,50}, chance = 40, min = 0.4, max = 0.55}
}
local function doTryKillCreature(cid, position, min, max)
doSendMagicEffect(position, CONST_ME_LEAF_EXPLOSION)
local creatureFound = getTopCreature(position).uid
if isCreature(creatureFound) and creatureFound ~= cid then
local targetHealth = getCreatureHealth(creatureFound)
return doTargetCombatHealth(cid, creatureFound, COMBAT_EARTHDAMAGE, -targetHealth*min, -targetHealth*max, CONST_ME_CARNIPHILA)
end
return false
end
local function doSendEffect(cid, position, n, min, max)
if isCreature(cid) then
doSendMagicEffect(position, CONST_ME_HITBYPOISON)
doSendMagicEffect(position, CONST_ME_GREEN_RINGS)
return n < 6 and addEvent(doSendEffect, 250, cid, position, n + 1, min, max) or addEvent(doTryKillCreature, 1000, cid, position, min, max)
end
return false
end
function onThink(cid)
local swampMonster, target = config[getCreatureName(cid):lower()], getCreatureTarget(cid)
if isMonster(cid) and isCreature(target) and swampMonster and math.random(100) <= swampMonster.chance then
local position, tableWithPositions = getThingPos(cid), {}
for nx = position.x - 5, position.x + 5 do
for ny = position.y - 5, position.y + 5 do
local newPosition = {x=nx, y=ny, z=position.z}
local itemFound = getTileThingByPos(newPosition)
if itemFound.uid > 0 and isInArray(normalSwamp, itemFound.itemid) then
table.insert(tableWithPositions, newPosition.x)
table.insert(tableWithPositions, newPosition.y)
table.insert(tableWithPositions, newPosition.z)
end
end
end
if #tableWithPositions ~= 0 then
local tableRandomValue = math.random(#tableWithPositions/3)
local normalSwampPosition = {x=tableWithPositions[tableRandomValue*3-2], y=tableWithPositions[tableRandomValue*3-1], z=tableWithPositions[tableRandomValue*3]}
local swampUid = getTileThingByPos(normalSwampPosition)
if swampUid.uid > 0 and isInArray(normalSwamp, swampUid.itemid) then
local oldSwampId = swampUid.itemid
if math.random(100) <= swampMonster.rand[2] and getCreatureHealth(cid) <= getCreatureMaxHealth(cid)*0.75 then
if isSightClear(normalSwampPosition, position, true) then
doTransformItem(swampUid.uid, walkableSwamp)
if not isWalkable(normalSwampPosition, true, true, true) then
return doTransformItem(swampUid.uid, oldSwampId)
end
local creatureMonster = doCreateMonster('boggy silt', normalSwampPosition, false)
addEvent(function() return isCreature(creatureMonster) and doSendMagicEffect(normalSwampPosition, CONST_ME_YELLOW_RINGS) and doRemoveThing(creatureMonster) end, 1000, normalSwampPosition, creatureMonster)
doSendMagicEffect(normalSwampPosition, CONST_ME_YELLOW_RINGS)
doTransformItem(swampUid.uid, oldSwampId)
local targetHealth = getCreatureHealth(cid)
local monsterHealth = math.random(targetHealth*swampMonster.min, targetHealth*swampMonster.max)
doSendDistanceShoot(normalSwampPosition, position, CONST_ANI_EARTH)
doSendMagicEffect(position, CONST_ME_SMALLPLANTS)
doCreatureAddHealth(cid, monsterHealth)
return doSendAnimatedText(position, monsterHealth, COLOR_LIGHTGREEN)
end
elseif math.random(100) <= swampMonster.rand[1] then
local pos = getThingPos(target)
if getDistanceBetween(position, pos) <= 5 and isSightClear(normalSwampPosition, pos, true) then
doTransformItem(swampUid.uid, walkableSwamp)
if not isWalkable(normalSwampPosition, true, true, true) then
return doTransformItem(swampUid.uid, oldSwampId)
end
local creatureMonster = doCreateMonster('boggy silt', normalSwampPosition, false)
addEvent(function() return isCreature(creatureMonster) and doSendMagicEffect(normalSwampPosition, CONST_ME_YELLOW_RINGS) and doRemoveThing(creatureMonster) end, 1000, normalSwampPosition, creatureMonster)
doSendMagicEffect(normalSwampPosition, CONST_ME_YELLOW_RINGS)
doTransformItem(swampUid.uid, oldSwampId)
doSendDistanceShoot(normalSwampPosition, pos, CONST_ANI_EARTH)
doSendMagicEffect(pos, CONST_ME_HITBYPOISON)
doSendMagicEffect(pos, CONST_ME_YELLOW_RINGS)
return addEvent(doSendEffect, 250, cid, pos, math.random(-2,2), swampMonster.min, swampMonster.max)
end
end
end
end
end
return true
end
Do creaturescripts.xml dodajemy:
PHP:
<event type="think" name="Bagienne" event="script" value="Bagienne.lua"/>
<event type="think" name="Unhurried_Acarid" event="script" value="Unhurried Acarid.lua"/>
Oczywi?cie potwory umie?ci? blisko du?ych skupisk bagien.