I have a bit of a strange question. I would like to spawn snake, but i want to get random snake, for example cobra, grass snake or viper
but when i spawn snake it's spawn also cobra or rat. But i just want spawn Cobra or Rat
im looking something like "self:setMonster"
how to "on spawn" spawn Cobra" or "Rat" or "Viper" instead snake from local?
Lua:
function Monster:onSpawn(position, startup, artificial)
if (artificial or startup == true or false) and (self:getName() == "Snake") then
local monstersName = {"Cobra", "Rat", "Viper"}
local spawnMonster = Game.createMonster(math.random(#monstersName), position, true, true)
if spawnMonster then
spawnMonster:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
end
end
return true
end
im looking something like "self:setMonster"
how to "on spawn" spawn Cobra" or "Rat" or "Viper" instead snake from local?