• 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 script request summon trainer

matthew123456

New Member
Joined
Aug 24, 2013
Messages
121
Reaction score
3
Lua:
local config = {
    [6579] = {levelRequired = 10, creature = "Training Machine", isSummon = false},
}

local actions_createCreature = Action()

function actions_createCreature.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local index = config[item:getId()]
    if player:getLevel() < index.levelRequired then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "Your level is too low.")
        return true
    end
        
    local position = player:getPosition()
    if Tile(position):hasFlag(TILESTATE_PROTECTIONZONE) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "This item cannot be activated by a player standing in a protection zone.")
        return true
    end
    local creature = Game.createMonster(index.creature, position, true)
    if not creature then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "No available space to spawn creature.")
        return true
    end
    if index.isSummon then
        creature:setMaster(player)
    end
    return true
end

for v, k in pairs(config) do
    actions_createCreature:id(v)
end
actions_createCreature:register()


I'm attempting to make a trainer script i would like it to on use summon on use again remove summon with a 1 hour cooldown to summon it again kind of like the Medevia trainer scroll and only have a max of 2 summons using revscripts canery engine thanks in advance
 
Back
Top