This spell is ONLY to monsters not to players.
When monster use this spell it teleport the target to monster position, or teleport monster to player position, good to kill shooters etc XD
First you need the function choose(...)
Add it on 050-function.lua:
Do the same to:
Add it on spells.xml
Now add this file on spells/scripts/monsters push.lua:
And to finish select a monster to use it.
Add it:
In this example i will add it on warlock.
When monster use this spell it teleport the target to monster position, or teleport monster to player position, good to kill shooters etc XD
First you need the function choose(...)
Add it on 050-function.lua:
LUA:
function choose(...) -- by mock
local arg = {...}
return arg[math.random(1,#arg)]
end
LUA:
function isWalkable(pos, creature, proj, pz)-- by Nord
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false, true end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end
Code:
<instant name="mock_push_monster" words="mock_push_monster" enabled="0" event="script" value="monsters/push.lua"></instant>
LUA:
function onCastSpell(cid, var) -- By Mock the bear
local c = getCreatureTarget(cid)
local cid2 = cid
if isCreature(c) then
if math.random(1,2) == 1 then
local p = getCreaturePosition(cid)
local n = 0
while true do
n = n+1
p.x = p.x+choose(-1,1)
p.y = p.y+choose(-1,1)
if isWalkable(p,true) or n > 15 then
doTeleportThing(c,p)
break
else
p = getCreaturePosition(cid)
end
end
else
local p = getCreaturePosition(c)
local n = 0
while true do
n = n+1
p.x = p.x+choose(-1,1)
p.y = p.y+choose(-1,1)
if isWalkable(p,true) or n > 15 then
doTeleportThing(cid,p)
break
else
p = getCreaturePosition(c)
end
end
end
doCreatureSay(cid2,'Muhuhaha!!',19)
end
return false
end
And to finish select a monster to use it.
Add it:
Code:
<attack name="mock_push_monster" interval="1000" chance="25"/>
Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="warlock" nameDescription="a warlock" race="blood" experience="4000" speed="220" manacost="0">
<health now="3200" max="3200"/>
<look type="130" head="19" body="71" legs="128" feet="128" addons="1" corpse="6080"/>
<targetchange interval="5000" chance="30"/>
<strategy attack="100" defense="0"/>
<flags>
<flag summonable="0"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="0"/>
<flag convinceable="0"/>
<flag pushable="0"/>
<flag canpushitems="1"/>
<flag canpushcreatures="1"/>
<flag targetdistance="4"/>
<flag staticattack="90"/>
<flag runonhealth="800"/>
</flags>
<attacks>
<attack name="mock_push_monster" interval="1000" chance="25"/> <!--Here is the tag ;D -->
<attack name="melee" interval="2000" min="-60" max="-180"/>
<attack name="physical" interval="1000" chance="35" range="7" min="-85" max="-185">
<attribute key="shootEffect" value="energy"/>
</attack>
<attack name="manadrain" interval="1000" chance="17" range="7" min="-35" max="-75"/>
<attack name="speed" interval="1000" chance="12" range="7" speedchange="-1" duration="40000">
<attribute key="areaEffect" value="redshimmer"/>
</attack>
<attack name="fire" interval="2000" chance="45" range="7" radius="3" target="1" min="-150" max="-220">
<attribute key="shootEffect" value="burstarrow"/>
<attribute key="areaEffect" value="firearea"/>
</attack>
<attack name="firefield" interval="1000" chance="20" range="7" radius="2" target="1">
<attribute key="shootEffect" value="fire"/>
</attack>
<attack name="energy" interval="2000" chance="25" length="8" spread="0" min="-165" max="-245">
<attribute key="areaEffect" value="energy"/>
</attack>
<attack name="speed" interval="6000" chance="10" range="5" speedchange="-600" duration="20000">
<attribute key="areaEffect" value="redshimmer"/>
</attack>
</attacks>
<defenses armor="25" defense="30">
<defense name="healing" interval="1000" chance="25" min="60" max="100">
<attribute key="areaEffect" value="blueshimmer"/>
</defense>
<defense name="invisible" interval="5000" chance="1" duration="5000"> --each 7 sec invi duration 5 sec
<attribute key="areaEffect" value="redshimmer"/>
</defense>
</defenses>
<immunities>
<immunity physical="0"/>
<immunity energy="1"/>
<immunity fire="1"/>
<immunity poison="1"/>
<immunity lifedrain="0"/>
<immunity paralyze="1"/>
<immunity outfit="1"/>
<immunity drunk="1"/>
<immunity invisible="1"/>
</immunities>
<voices interval="5000" chance="10">
<voice sentence="Learn the secret of our magic! YOUR death!"/>
<voice sentence="Even a rat is a better mage than you."/>
<voice sentence="We don't like intruders!"/>
</voices>
<loot>
<item id="2148" countmax="100" chance1="100000" chancemax="0"/>
<item id="1986" chance="400"/>
<item id="2600" chance="10000"/>
<item id="2124" chance="1000"/>
<item id="2689" countmax="1" chance="11000"/>
<item id="7368" countmax="4" chance="1200"/>
<item id="2167" chance="3000"/>
<item id="2114" chance="1400"/>
<item id="2151" countmax="2" chance="1100"/>
<item id="1987" chance="100000">
<inside>
<item id="2148" countmax="50" chance1="80000" chancemax="0"/>
<item id="2146" countmax="2" chance="1400"/>
<item id="2178" countmax="1" chance="2500"/>
<item id="2679" countmax="4" chance="20000"/>
<item id="2047" chance="15000"/>
<item id="2411" chance="5000"/>
<item id="2792" countmax="5" chance1="6666" chancemax="0"/>
<item id="2793" countmax="2" chance1="6666" chancemax="0"/>
<item id="2656" chance="2000"/>
<item id="2466" chance="588"/>
<item id="2436" chance="1428"/>
<item id="2123" chance="1000"/>
</inside>
</item>
</loot>
</monster>
Last edited: