Eduardo170
Well-Known Member
I've been fighting with this script that I've been doing all day. If you can help me it would be helpful.
My movement script its work, but when I kill the boss not show me any message.
After try 100 times, I added to thalas.xml and ashmunrah.xml and still.
How I get storage?. I used this script from @Znote here
did you added this script to data/scripts?
-Yes, I know that this is a revscript
Movement
My movement script its work, but when I kill the boss not show me any message.
After try 100 times, I added to thalas.xml and ashmunrah.xml and still.
Code:
<script>
<event name="BossHota"/>
</script>
did you added this script to data/scripts?
-Yes, I know that this is a revscript
Code:
-- Boss names(lowercase) and storage key values
local monsterList = {
['ashmunrah'] = Storage.Hota.Ashmunrah,
['thalas'] = Storage.Hota.Thalas,
['rahemos'] = Storage.Hota.Rahemos,
['omruc'] = Storage.Hota.Omruc,
['marhdis'] = Storage.Hota.Mahrdis,
['dipthrah'] = Storage.Hota.Dipthrah,
['vashresamun'] = Storage.Hota.Vashresamun,
['morguthis'] = Storage.Hota.Morguthis,
}
-- Code to be executed when a player kills something.
local event = CreatureEvent("BossHota")
function event.onKill(creature, target)
-- This script only cares about kills against configured creature names in above list
local storage = monsterList[target:getName():lower()]
if target:isPlayer() or target:getMaster() or not storage then
print('storage:'..storage)
return false
end
-- Increase killcount, and make player say it
local kills = creature:getStorageValue(storage)
if kills < 1 then
kills = 1
creature:say('You slayed ' .. target:getName() .. '.', TALKTYPE_MONSTER_SAY)
else
kills = kills + 1
creature:say('You have slayed ' .. target:getName() .. ' '.. kills ..' times!', TALKTYPE_MONSTER_SAY)
end
-- Store killcount for further reference
creature:setStorageValue(storage, kills)
return true
end
event:register()
-- Register above MonsterHunter creature events to players when they login
local login = CreatureEvent("BossHota")
function login.onLogin(player)
player:registerEvent("BossHota")
return true
end
login:register()
Movement
Code:
local teleports = {
[2060] = {newPos = Position(1493, 1829, 9), bossname ='Ashmunrah'},
[2061] = {newPos = Position(1468, 1821, 9), bossname ='Ashmunrah'},
[2062] = {newPos = Position(1491, 1862, 9), bossname ='Thalas'},
[2063] = {newPos = Position(1476, 1848, 9), bossname ='Thalas'},
}
function onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if not player then
return true
end
local teleport = teleports[item.uid]
--Asmunrah
if item.uid == 2060 then
if player:getStorageValue(Storage.Hota.Ashmunrah) < 1 then
player:teleportTo(teleport.newPos)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Entering to the '..teleport.bossname..' Room')
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
else
player:teleportTo(fromPosition)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You had this boss')
end
end
if item.uid == 2061 then
if player:getStorageValue(Storage.Hota.Ashmunrah) > 1 then
player:teleportTo(teleport.newPos)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Exit to the '..teleport.bossname..' Room')
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
else
player:teleportTo(fromPosition)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'First your need kill to '..teleport.bossname..'.')
end
end
--Thalas
if item.uid == 2062 then
if player:getStorageValue(Storage.Hota.Thalas) < 1 then
player:teleportTo(teleport.newPos)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Entering to the '..teleport.bossname..' Room')
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
else
player:teleportTo(fromPosition)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You had this boss')
end
end
if item.uid == 2063 then
if player:getStorageValue(Storage.Hota.Thalas) > 1 then
player:teleportTo(teleport.newPos)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Exit to the '..teleport.bossname..' Room')
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
else
player:teleportTo(fromPosition)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'First your need kill to '..teleport.bossname..'.')
end
end
return true
end
Last edited: