Detail:
Tested on TFS 1.2 - Works: 06/18/2016
Use this script as you like! If you convert it to any other distributions, share it with this thread.
How The Script Works:
You will have a normal spawn on your map, my case, a bug. On 50% chance when I kill a bug, a poisonous bug(white skull, skull will have to be set in monster file) will spawn on top of that bug. When that poisonous bug is killed, with 50% chance, it will summon a black widow(red skull) on top of the bugs corpse.
Install:
Create a new lua file within your CreatureScripts/Scripts. Copy and past code into lua and save. Register script file in creaturescripts.xml. You will then have to register the eventname within your creaturescript login.lua.
Script:
Here is the script version by tetra20, nothing different, just a clean structure. Thank you, tetra!
Tested on TFS 1.2 - Works: 06/18/2016
Use this script as you like! If you convert it to any other distributions, share it with this thread.
How The Script Works:
You will have a normal spawn on your map, my case, a bug. On 50% chance when I kill a bug, a poisonous bug(white skull, skull will have to be set in monster file) will spawn on top of that bug. When that poisonous bug is killed, with 50% chance, it will summon a black widow(red skull) on top of the bugs corpse.
Install:
Create a new lua file within your CreatureScripts/Scripts. Copy and past code into lua and save. Register script file in creaturescripts.xml. You will then have to register the eventname within your creaturescript login.lua.
Script:
Here is the script version by tetra20, nothing different, just a clean structure. Thank you, tetra!
Code:
local config = {
["bug"] = {chance = 50000, boss = "Poisonous Bug", msg = "Kreekkk!"}, --50k = 50%
["poisonous bug"] = {chance = 50000, boss = "Black Widow", msg = "Ribbbiitttt!"}, --25k = 25%
}
function onDeath(creature, target, player, corpse, mostDamage)
local random_chance = math.random(100000)
local targetPosition = target:getPosition()
if creature:isMonster() then
local Monster = config[creature:getName():lower()]
if Monster then
if Monster.chance >= random_chance then
target:getPosition():sendMagicEffect(CONST_ME_POFF)
Game.createMonster(Monster.boss:lower(), targetPosition)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, Monster.msg)
end
end
end
return true
end
Last edited: