• 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!

RevScripts HELP TFS 1.4 SPELL MONSTER

VagosClubTM

Active Member
Joined
Aug 16, 2019
Messages
219
Reaction score
32
Location
Chile
Hello friends I wanted to know if it is possible to make this rune work for the monsters to use on themselves, I want to create a creature called "transformer" which will change shape with this magic. Is it possible to use this same script to make the rune auto drop? or if you have any spells that will replace it much better from now on thank you very much I will leave the code here below.

ps the code was given to me by xinit

Lua:
local outfitIds = {230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254}

local randomOutfit = Condition(CONDITION_OUTFIT)
randomOutfit:setTicks(60000)

local action = Action()

function action.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not target:isPlayer() then
        return false
    end
    randomOutfit:setOutfit({lookType = outfitIds[math.random(#outfitIds)]})
    target:addCondition(randomOutfit)
    item:remove(1)
    return true
end

action:id(2295)
action:register()
 
Solution
Hello friends I wanted to know if it is possible to make this rune work for the monsters to use on themselves, I want to create a creature called "transformer" which will change shape with this magic. Is it possible to use this same script to make the rune auto drop? or if you have any spells that will replace it much better from now on thank you very much I will leave the code here below.

ps the code was given to me by xinit

Lua:
local outfitIds = {230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254}

local randomOutfit = Condition(CONDITION_OUTFIT)
randomOutfit:setTicks(60000)

local action = Action()

function action.onUse(player, item, fromPosition, target...
Hello friends I wanted to know if it is possible to make this rune work for the monsters to use on themselves, I want to create a creature called "transformer" which will change shape with this magic. Is it possible to use this same script to make the rune auto drop? or if you have any spells that will replace it much better from now on thank you very much I will leave the code here below.

ps the code was given to me by xinit

Lua:
local outfitIds = {230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254}

local randomOutfit = Condition(CONDITION_OUTFIT)
randomOutfit:setTicks(60000)

local action = Action()

function action.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not target:isPlayer() then
        return false
    end
    randomOutfit:setOutfit({lookType = outfitIds[math.random(#outfitIds)]})
    target:addCondition(randomOutfit)
    item:remove(1)
    return true
end

action:id(2295)
action:register()
Not really, no.

You have to create a custom monster that utilizes the functionality.

ezgif.com-gif-maker (8).gif

data/monster/lua/transformer.lua
Lua:
local outfitIds = {230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254}

local randomOutfit = Condition(CONDITION_OUTFIT)
randomOutfit:setTicks(60000) -- (millseconds) how long the outfit lasts

local chance = 50 -- (percentage/100) chance to change outfit
local changeInterval = 5000 -- (millseconds) how long inbetween attempts at using a random outfit (monsters think at 1000 millisecond intevals, only when players (not gods) are nearby)
local intervalCounter = changeInterval -- don't touch


local mType = Game.createMonsterType("transformer")
local monster = {}
monster.description = "a transformer"
monster.experience = 1
monster.outfit = {
    lookType = 92
}

monster.health = 1
monster.maxHealth = monster.health
monster.race = "undead"
monster.corpse = 1740
monster.speed = 170
monster.maxSummons = 0

monster.changeTarget = {
    interval = 4*1000,
    chance = 20
}

monster.flags = {
    summonable = false,
    attackable = true,
    hostile = false,
    challengeable = true,
    convinceable = false,
    ignoreSpawnBlock = false,
    illusionable = false,
    canPushItems = false,
    canPushCreatures = false,
    targetDistance = 1,
    staticAttackChance = 70
}

mType.onThink = function(monster, interval)
    intervalCounter = intervalCounter + interval
    if intervalCounter >= changeInterval then
        if math.random(100) <= chance then
            randomOutfit:setOutfit({lookType = outfitIds[math.random(#outfitIds)]})
            monster:addCondition(randomOutfit)
        end
        intervalCounter = 0
    end
end

mType:register(monster)
 
Solution
Not really, no.

You have to create a custom monster that utilizes the functionality.

View attachment 64499

data/monster/lua/transformer.lua
Lua:
local outfitIds = {230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254}

local randomOutfit = Condition(CONDITION_OUTFIT)
randomOutfit:setTicks(60000) -- (millseconds) how long the outfit lasts

local chance = 50 -- (percentage/100) chance to change outfit
local changeInterval = 5000 -- (millseconds) how long inbetween attempts at using a random outfit (monsters think at 1000 millisecond intevals, only when players (not gods) are nearby)
local intervalCounter = changeInterval -- don't touch


local mType = Game.createMonsterType("transformer")
local monster = {}
monster.description = "a transformer"
monster.experience = 1
monster.outfit = {
    lookType = 92
}

monster.health = 1
monster.maxHealth = monster.health
monster.race = "undead"
monster.corpse = 1740
monster.speed = 170
monster.maxSummons = 0

monster.changeTarget = {
    interval = 4*1000,
    chance = 20
}

monster.flags = {
    summonable = false,
    attackable = true,
    hostile = false,
    challengeable = true,
    convinceable = false,
    ignoreSpawnBlock = false,
    illusionable = false,
    canPushItems = false,
    canPushCreatures = false,
    targetDistance = 1,
    staticAttackChance = 70
}

mType.onThink = function(monster, interval)
    intervalCounter = intervalCounter + interval
    if intervalCounter >= changeInterval then
        if math.random(100) <= chance then
            randomOutfit:setOutfit({lookType = outfitIds[math.random(#outfitIds)]})
            monster:addCondition(randomOutfit)
        end
        intervalCounter = 0
    end
end

mType:register(monster)
Thanks bro, it worked perfect, the other thing I need is for the creatures to be locked in portals. I'll leave you a video of how it should. What happens is that they come out when you lock them up.



ezgif-5-173df385b9.gif

By this I mean that if the player locks them up they cannot escape, what should I do so that this can work?
 
Back
Top