Look this script:
My script is based in a creaturescript and a globalevent. Each 1 hour, only a player in the server can kill a creature and gain a storage. The globalevent check if the monster is alive, if the monster is dead, check for the player that have the storage. If the globalevent do not found the player (If player die, or log out [i have a creature script that when you log out it remove the storage from the player]), it will summon the creature again.
Problem: The global event works if in the server is only a player online (player that kill the monster) nut.. if are more than 1 player online, it does not work. I think it happens because the globalevent check storage for ALL players, and not for one player.
SORRY IF I WRITE IN BAD ENGLISH.
Lua:
function onThink(interval, lastExecution)
local ENCHANTEDMONSTER_POSITION = {x=95, y=126, z=7, stackpos=253}
local enchantedMonster = getThingFromPos(ENCHANTEDMONSTER_POSITION)
for _, name in ipairs(getOnlinePlayers()) do
local player = getPlayerByName(name)
if enchantedMonster.itemid > 0 then
doSendMagicEffect(ENCHANTEDMONSTER_POSITION, CONST_ME_MAGIC_GREEN)
else
if getPlayerStorageValue(player, 15230) == 0 then
doCreateMonster("Enchanted Monster", ENCHANTEDMONSTER_POSITION)
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Enchanted Monster is alive again.")
end
end
end
return TRUE
end
My script is based in a creaturescript and a globalevent. Each 1 hour, only a player in the server can kill a creature and gain a storage. The globalevent check if the monster is alive, if the monster is dead, check for the player that have the storage. If the globalevent do not found the player (If player die, or log out [i have a creature script that when you log out it remove the storage from the player]), it will summon the creature again.
Problem: The global event works if in the server is only a player online (player that kill the monster) nut.. if are more than 1 player online, it does not work. I think it happens because the globalevent check storage for ALL players, and not for one player.
SORRY IF I WRITE IN BAD ENGLISH.
Last edited: