Hey guys, I made a simple boss system (as said in title).... xd
Well with the help of you guys ofc!
Well after a couple of hours of trail and error I came up with this.
CreatureScript: (This script was inspired like 100% by someone, I cant remember who. If you recognise this script. Please hmu and tell me who it is so I can cred him/her).
Movements(Cant find the exact post but I remember that @Xikini really inspired this script! Thanks a lot pal! <3 :
So as you might have noticed, I posted this in the support thread. This is not by accident. I was actually wondering how I would make the movement script a little more dynamic, more like the creatuescript. In the creaturescript, I can just easily add another monster/boss to the config and it would work, but for the movement I would have to create an entirely new script for every monster/boss. So yea, is it possible to do something similar to what I did for creaturescript for the movement?
Well with the help of you guys ofc!
Well after a couple of hours of trail and error I came up with this.
CreatureScript: (This script was inspired like 100% by someone, I cant remember who. If you recognise this script. Please hmu and tell me who it is so I can cred him/her).
Lua:
bossConfig = {
["Burr the Mighty"] = {
bossMessage = "WHY?! HOW?!! THIS CAN'T BE TRUE!!!! A MAN CANNOT KILL A GOD!.....",
playerMessage = "You can feel the evil presence of Burr's spirit leaving the island.",
obstacle = 1449,
obstaclePos = {
x = 1456,
y = 1105,
z = 4
},
rewardRoomPos = {
x = 1438,
y = 1087,
z = 4
}
}
}
function onKill(player, target)
if player:isPlayer() and target:isMonster() then
local playerName = player
local bossName = bossConfig[Creature(target):getName()]
local bossObstacle = Tile(bossName.obstaclePos):getItemById(bossName.obstacle)
if bossName then
for uid, _ in pairs(target:getDamageMap()) do
local attacker = Player(uid)
if attacker then
attacker:sendTextMessage(18, bossName.bossMessage)
attacker:sendTextMessage(22, bossName.playerMessage)
attacker:teleportTo(bossName.rewardRoomPos)
bossObstacle:remove()
end
end
end
end
return true
end
Movements(Cant find the exact post but I remember that @Xikini really inspired this script! Thanks a lot pal! <3 :
Lua:
local fromPos = {
x = 1431,
y = 1101,
z = 4
}
local toPos = {
x = 1470,
y = 1126,
z = 4
}
local entrance = {
x = 1456,
y = 1105,
z = 4
}
local obstacle = 1449
function onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if not player then
return false
end
if not Tile(entrance):getItemById(obstacle) then
doCreateItem(obstacle, 1, entrance)
end
local search = false
player:teleportTo(fromPosition, true)
for x = fromPos.x, toPos.x do
for y = fromPos.y, toPos.y do
for z = fromPos.z, toPos.z do
local bossRoomArea = {
x = x,
y = y,
z = z
}
local searchCreature = getTopCreature(bossRoomArea).uid
local bossName = "Burr the Mighty"
if isMonster(searchCreature) and getCreatureName(searchCreature) == bossName then
search = true
end
end
end
end
if search == true then
player:sendTextMessage(18, "There is an invisible force blocking the way.")
else
player:sendTextMessage(18, "YOU HAVE AWOKE THE CURSE OF BURR THE MIGHTY!")
doSummonCreature("Burr the Mighty", position)
end
end