• Vote in September Mapping Competition to select a winner!
  • 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!

Summon that explode

beliar34

Member
Joined
Feb 28, 2012
Messages
292
Best answers
7
Reaction score
9
I am wondering how to make spell that summon 4-5 monsters that go to "targeted enemy" and explode, damage based on level of player
 

pasiak12

Well-Known Member
Joined
Jun 7, 2009
Messages
259
Best answers
13
Reaction score
65
check distance between summon and target, kill itself if <=1 + ondeath script with explosion

@edit
hmm, can be done in 1 script, just put explosion before/after killing it
 
OP
beliar34

beliar34

Member
Joined
Feb 28, 2012
Messages
292
Best answers
7
Reaction score
9
@refresh tfs 0.3.5 !
 
OP
beliar34

beliar34

Member
Joined
Feb 28, 2012
Messages
292
Best answers
7
Reaction score
9
@refresh tfs 0.3.5 !
 

andu

Sold 649 scripts, 25 maps and 9 events!
Joined
Aug 7, 2009
Messages
958
Best answers
16
Reaction score
321
My scripts from 2012~

1.
data/monster/monsters.xml
XML:
<monster name="Plague Toad" file="Frogs/plague toad.xml"/>
2.
data/monster/Frogs/plague toad.xml
XML:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Plague Toad" nameDescription="a plague toad" race="venom" experience="80" speed="800" manacost="0">
  <health now="50" max="50"/>
  <look type="226" head="114" body="119" legs="119" feet="114" corpse="6079"/>
  <targetchange interval="5000" chance="8"/>
  <strategy attack="100" defense="0"/>
  <flags>
    <flag summonable="0"/>
    <flag attackable="1"/>
    <flag hostile="1"/>
    <flag illusionable="0"/>
    <flag convinceable="1"/>
    <flag pushable="1"/>
    <flag canpushitems="0"/>
    <flag canpushcreatures="0"/>
    <flag staticattack="90"/>
    <flag targetdistance="1"/>
    <flag runonhealth="0"/>
  </flags>
  <attacks>
    <attack type="instant" name="self destruct" range="1" interval="333" chance="100" min="-200" max="-296"/>
  </attacks>
  <defenses armor="12" defense="10">
    <defense type="instant" name="self destruct" interval="15000" chance="60" min="0" max="0"/>
  </defenses>
  <elements>
    <element earthPercent="100"/>
    <element physicalPercent="100"/>
    <element firePercent="-1000"/>
  </elements>
  <immunities>
    <immunity paralyze="1"/>
    <immunity invisible="1"/>
  </immunities>
  <!--<script>
   <event name="PlagueToad"/>
  </script>-->
</monster>
3.
data/spells/spells.xml
XML:
<instant name="Self Destruct" words="!se332uct" enabled="0" selftarget="1" script="monster/self destruct.lua"/>
4.
data/spells/scripts/monster/self destruct.lua
Lua:
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 6)
setCombatParam(combat1, COMBAT_PARAM_TARGETPLAYERSORSUMMONS, TRUE)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, 0, 0, 0, 0)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, 7)
setCombatParam(combat3, COMBAT_PARAM_TARGETPLAYERSORSUMMONS, FALSE)
setCombatFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, -0.5, 0, -1.1, 0)

arr1 = {
{0, 0, 0},
{0, 3, 0},
{0, 0, 0}
}

arr3 = {
{1, 1, 1},
{1, 3, 1},
{1, 1, 1}
}

local area1 = createCombatArea(arr1)
local area3 = createCombatArea(arr3)
setCombatArea(combat1, area1)
setCombatArea(combat3, area3)

local function onCastSpell1(parameters)
    doCombat(parameters.cid, combat1, parameters.var)
end

local function onCastSpell3(parameters)
     doCombat(parameters.cid, combat3, parameters.var)
     doCreatureAddHealth(parameters.cid, -getCreatureHealth(parameters.cid))
end


function onCastSpell(cid, var)
local parameters = { cid = cid, var = var}
addEvent(onCastSpell1, 1, parameters)
addEvent(onCastSpell3, 200, parameters)

end
5.
data/spells/spells.xml
XML:
<instant name="Mass Plague Toads" words="!Mass Plague Toads" lvl="136" selftarget="1" mana="1100" script="summon/Mass Plague Toads.lua">
    <vocation name="Druid"/>
</instant>
6.
data/spells/scripts/summon/Mass Plague Toads.lua
Lua:
function onCastSpell(cid, var)

local pos = getPlayerPosition(cid)

        doConvinceCreature(cid, doCreateMonster("Plague Toad", pos))
        doConvinceCreature(cid, doCreateMonster("Plague Toad", pos))
        doConvinceCreature(cid, doCreateMonster("Plague Toad", pos))
        doConvinceCreature(cid, doCreateMonster("Plague Toad", pos))
        doConvinceCreature(cid, doCreateMonster("Plague Toad", pos))

    return true

end
If you want to make dmg based on player you have to edit self_destruct.lua. You can use getCreatureMaster(cid) for it.
 
Last edited:

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,653
Best answers
13
Reaction score
254
Location
Poland
🤔 PRO TIP 2020 IDEA MLG NO-SCOPE:
- Put range ="0", chance 100, interval 1000, in monster.xml in spell + make spell that do that thing like "explode" creature when cast.
 
OP
beliar34

beliar34

Member
Joined
Feb 28, 2012
Messages
292
Best answers
7
Reaction score
9
My scripts from 2012~

1.
data/monster/monsters.xml
XML:
<monster name="Plague Toad" file="Frogs/plague toad.xml"/>
2.
data/monster/Frogs/plague toad.xml
XML:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Plague Toad" nameDescription="a plague toad" race="venom" experience="80" speed="800" manacost="0">
  <health now="50" max="50"/>
  <look type="226" head="114" body="119" legs="119" feet="114" corpse="6079"/>
  <targetchange interval="5000" chance="8"/>
  <strategy attack="100" defense="0"/>
  <flags>
    <flag summonable="0"/>
    <flag attackable="1"/>
    <flag hostile="1"/>
    <flag illusionable="0"/>
    <flag convinceable="1"/>
    <flag pushable="1"/>
    <flag canpushitems="0"/>
    <flag canpushcreatures="0"/>
    <flag staticattack="90"/>
    <flag targetdistance="1"/>
    <flag runonhealth="0"/>
  </flags>
  <attacks>
    <attack type="instant" name="self destruct" range="1" interval="333" chance="100" min="-200" max="-296"/>
  </attacks>
  <defenses armor="12" defense="10">
    <defense type="instant" name="self destruct" interval="15000" chance="60" min="0" max="0"/>
  </defenses>
  <elements>
    <element earthPercent="100"/>
    <element physicalPercent="100"/>
    <element firePercent="-1000"/>
  </elements>
  <immunities>
    <immunity paralyze="1"/>
    <immunity invisible="1"/>
  </immunities>
  <!--<script>
   <event name="PlagueToad"/>
  </script>-->
</monster>
3.
data/spells/spells.xml
XML:
<instant name="Self Destruct" words="!se332uct" enabled="0" selftarget="1" script="monster/self destruct.lua"/>
4.
data/spells/scripts/monster/self destruct.lua
Lua:
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 6)
setCombatParam(combat1, COMBAT_PARAM_TARGETPLAYERSORSUMMONS, TRUE)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, 0, 0, 0, 0)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, 7)
setCombatParam(combat3, COMBAT_PARAM_TARGETPLAYERSORSUMMONS, FALSE)
setCombatFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, -0.5, 0, -1.1, 0)

arr1 = {
{0, 0, 0},
{0, 3, 0},
{0, 0, 0}
}

arr3 = {
{1, 1, 1},
{1, 3, 1},
{1, 1, 1}
}

local area1 = createCombatArea(arr1)
local area3 = createCombatArea(arr3)
setCombatArea(combat1, area1)
setCombatArea(combat3, area3)

local function onCastSpell1(parameters)
    doCombat(parameters.cid, combat1, parameters.var)
end

local function onCastSpell3(parameters)
     doCombat(parameters.cid, combat3, parameters.var)
     doCreatureAddHealth(parameters.cid, -getCreatureHealth(parameters.cid))
end


function onCastSpell(cid, var)
local parameters = { cid = cid, var = var}
addEvent(onCastSpell1, 1, parameters)
addEvent(onCastSpell3, 200, parameters)

end
5.
data/spells/spells.xml
XML:
<instant name="Mass Plague Toads" words="!Mass Plague Toads" lvl="136" selftarget="1" mana="1100" script="summon/Mass Plague Toads.lua">
    <vocation name="Druid"/>
</instant>
6.
data/spells/scripts/summon/Mass Plague Toads.lua
Lua:
function onCastSpell(cid, var)

local pos = getPlayerPosition(cid)

        doConvinceCreature(cid, doCreateMonster("Plague Toad", pos))
        doConvinceCreature(cid, doCreateMonster("Plague Toad", pos))
        doConvinceCreature(cid, doCreateMonster("Plague Toad", pos))
        doConvinceCreature(cid, doCreateMonster("Plague Toad", pos))
        doConvinceCreature(cid, doCreateMonster("Plague Toad", pos))

    return true

end
If you want to make dmg based on player you have to edit self_destruct.lua. You can use getCreatureMaster(cid) for it.
Script seems to be workin on but i need to rework that, i need to change damage calculation :)
i am going to made something that would calculate dmg based on player mlvl and lvl
 

Xikini

I whore myself out for likes
Premium User
Joined
Nov 17, 2010
Messages
4,589
Best answers
245
Reaction score
2,678
Lua:
local function calculate_summon_damage(cid)
    local master = getCreatureMaster(cid)
    local magic_level, level = getPlayerMagLevel(master), getPlayerLevel(master)
    local damage = magic_level + level
    return damage
end
 
Top