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