[DiscordArchive] Hi guys is there any existing script for worldboss announce when someone kills it and when he respaw
[DiscordArchive] Hi guys is there any existing script for worldboss announce when someone kills it and when he respaw
Archived author: iThorgrim • Posted: 2024-02-02T20:24:11.680000+00:00
Original source
```lua
local Constant = {
creature_entry = 13245,
creature_timer = 300, -- 5 minutes in seconds
messages = {
on_death = "Yes WorldBoss is down!",
on_respawn = "OMG ! The Worldboss is ready to fight!"
}
}
local function handleEvent(_, _, _, is_died)
local msg = is_died and Constant.messages.on_death or Constant.messages.on_respawn
SendWorldMessage(msg)
end
local function OnPlayerKillCreature(event, player, creature)
local entry = creature:GetEntry()
if ( entry == Constant.creature_entry) then
handleEvent(_, _, _, true)
CreateLuaEvent(handleRespawn, Constant.creature_timer * 1000)
end
end
RegisterPlayerEvent(6, OnPlayerKillCreature)
```
Archived author: cyberpro98 • Posted: 2024-02-02T20:26:24.997000+00:00
Original source
So here is RegisterPlayerEvent(6, OnPlayerKillCreature) So that is an event ?
Archived author: iThorgrim • Posted: 2024-02-02T20:26:40.847000+00:00
Original source
Yes and no but yes
Archived author: cyberpro98 • Posted: 2024-02-02T20:26:50.755000+00:00
Original source
haha okay
Archived author: Honey • Posted: 2024-02-02T20:27:06.307000+00:00
Original source
<https://www.azerothcore.org/pages/eluna/Global/RegisterPlayerEvent.html>
Here's the list.
Archived author: cyberpro98 • Posted: 2024-02-02T20:28:42.296000+00:00
Original source
hmmm ok
Archived author: iThorgrim • Posted: 2024-02-02T20:29:33.396000+00:00
Original source
To function, Eluna needs to listen to the events taking place in the game, and the RegisterPlayerEvent(6, ...) listens when the player kills a creature. Every time you or your players kill a creature, the Lua script will check whether the one you want.
If so, it will simply send your message and then create an event that will be launched 5 minutes later to say that your creature has respawned.
Archived author: cyberpro98 • Posted: 2024-02-02T20:32:32.882000+00:00
Original source
okay
Archived author: cyberpro98 • Posted: 2024-02-02T20:32:36.551000+00:00
Original source
i will try it
Archived author: iThorgrim • Posted: 2024-02-02T20:33:50.757000+00:00
Original source
Beware: this is just a different way of doing what you want to do, and can involve a lot of calculation for nothing, as it will make the comparison whether your player kills a Rabbit, a Wolf, a Kobold or your WorldBoss. In any case, the script will have to compare the id of the creature killed with the one you're waiting for.