Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] Any reason why you don't just have a timed event tied to the creatures on spawn that checks for thei

[DiscordArchive] Any reason why you don't just have a timed event tied to the creatures on spawn that checks for thei

[DiscordArchive] Any reason why you don't just have a timed event tied to the creatures on spawn that checks for thei

Pages (6): 1 2 3 4 5 6 Next
rektbyfaith
Administrator
0
04-24-2022, 10:26 AM
#1
Archived author: Foe • Posted: 2022-04-24T10:26:13.116000+00:00
Original source

Any reason why you don't just have a timed event tied to the creatures on spawn that checks for their health?
rektbyfaith
04-24-2022, 10:26 AM #1

Archived author: Foe • Posted: 2022-04-24T10:26:13.116000+00:00
Original source

Any reason why you don't just have a timed event tied to the creatures on spawn that checks for their health?

rektbyfaith
Administrator
0
04-24-2022, 10:26 AM
#2
Archived author: Foe • Posted: 2022-04-24T10:26:47.414000+00:00
Original source

That way you wouldn't have to deal with trying to find the objects at all
rektbyfaith
04-24-2022, 10:26 AM #2

Archived author: Foe • Posted: 2022-04-24T10:26:47.414000+00:00
Original source

That way you wouldn't have to deal with trying to find the objects at all

rektbyfaith
Administrator
0
04-24-2022, 10:27 AM
#3
Archived author: Foe • Posted: 2022-04-24T10:27:40.389000+00:00
Original source

Then you just have a table with their status, and on your event end, you just check if the status reported by the creatures is correct
rektbyfaith
04-24-2022, 10:27 AM #3

Archived author: Foe • Posted: 2022-04-24T10:27:40.389000+00:00
Original source

Then you just have a table with their status, and on your event end, you just check if the status reported by the creatures is correct

rektbyfaith
Administrator
0
04-24-2022, 10:28 AM
#4
Archived author: Honey • Posted: 2022-04-24T10:28:05.167000+00:00
Original source

They could potentially die and their corpses despawn, depending on the server's settings. From what i understand, their events would be removed.
rektbyfaith
04-24-2022, 10:28 AM #4

Archived author: Honey • Posted: 2022-04-24T10:28:05.167000+00:00
Original source

They could potentially die and their corpses despawn, depending on the server's settings. From what i understand, their events would be removed.

rektbyfaith
Administrator
0
04-24-2022, 10:28 AM
#5
Archived author: Foe • Posted: 2022-04-24T10:28:36.670000+00:00
Original source

Their timed event, yes, but their status would then reflect in the status table as not successful still or whatever
rektbyfaith
04-24-2022, 10:28 AM #5

Archived author: Foe • Posted: 2022-04-24T10:28:36.670000+00:00
Original source

Their timed event, yes, but their status would then reflect in the status table as not successful still or whatever

rektbyfaith
Administrator
0
04-24-2022, 10:28 AM
#6
Archived author: Foe • Posted: 2022-04-24T10:28:45.348000+00:00
Original source

And the event would fail
rektbyfaith
04-24-2022, 10:28 AM #6

Archived author: Foe • Posted: 2022-04-24T10:28:45.348000+00:00
Original source

And the event would fail

rektbyfaith
Administrator
0
04-24-2022, 10:28 AM
#7
Archived author: Foe • Posted: 2022-04-24T10:28:56.462000+00:00
Original source

So it would serve the same purpose but a lot less complex
rektbyfaith
04-24-2022, 10:28 AM #7

Archived author: Foe • Posted: 2022-04-24T10:28:56.462000+00:00
Original source

So it would serve the same purpose but a lot less complex

rektbyfaith
Administrator
0
04-24-2022, 10:29 AM
#8
Archived author: Foe • Posted: 2022-04-24T10:29:55.011000+00:00
Original source

It would also not limit you to a hard coded amount of creatures, as the status table would be expanded dynamically on spawn
rektbyfaith
04-24-2022, 10:29 AM #8

Archived author: Foe • Posted: 2022-04-24T10:29:55.011000+00:00
Original source

It would also not limit you to a hard coded amount of creatures, as the status table would be expanded dynamically on spawn

rektbyfaith
Administrator
0
04-24-2022, 10:30 AM
#9
Archived author: Honey • Posted: 2022-04-24T10:30:31.887000+00:00
Original source

I'll try to think that over when i'm Back from my shopping trip. Appreciate the suggestions!
rektbyfaith
04-24-2022, 10:30 AM #9

Archived author: Honey • Posted: 2022-04-24T10:30:31.887000+00:00
Original source

I'll try to think that over when i'm Back from my shopping trip. Appreciate the suggestions!

rektbyfaith
Administrator
0
04-24-2022, 11:47 AM
#10
Archived author: Foe • Posted: 2022-04-24T11:47:24.505000+00:00
Original source

```Lua
local statusStore = {}
local eventActive = false

local function OnSpawn(event, creature)
-- initial status on spawn
statusStore[creature:GetGUIDLow()] = 0

-- register checking of health event every second
creature:RegisterEvent(OnTimedEvent, 1000, 0)
end

local function OnTimedEvent(eventid, delay, repeats, creature)
if(eventActive) then
if(creature:IsFullHealth())
statusStore[creature:GetGUIDLow()] = 1
end
else
creature:RemoveEvents()
-- add other despawn and deinit per creature stuff here
end
end

local function OnEventEnd()
eventActive = false
local eventCompleted = false

for _, creatureStatus in pairs(statusStore) do
if(creatureStatus == 0) then
eventCompleted = false
break
else
eventCompleted = true
end
end

-- Reset the creature status table
creatureStatus = {}

if(eventCompleted) then
-- do save event
else
-- do failure event
end
end```
rektbyfaith
04-24-2022, 11:47 AM #10

Archived author: Foe • Posted: 2022-04-24T11:47:24.505000+00:00
Original source

```Lua
local statusStore = {}
local eventActive = false

local function OnSpawn(event, creature)
-- initial status on spawn
statusStore[creature:GetGUIDLow()] = 0

-- register checking of health event every second
creature:RegisterEvent(OnTimedEvent, 1000, 0)
end

local function OnTimedEvent(eventid, delay, repeats, creature)
if(eventActive) then
if(creature:IsFullHealth())
statusStore[creature:GetGUIDLow()] = 1
end
else
creature:RemoveEvents()
-- add other despawn and deinit per creature stuff here
end
end

local function OnEventEnd()
eventActive = false
local eventCompleted = false

for _, creatureStatus in pairs(statusStore) do
if(creatureStatus == 0) then
eventCompleted = false
break
else
eventCompleted = true
end
end

-- Reset the creature status table
creatureStatus = {}

if(eventCompleted) then
-- do save event
else
-- do failure event
end
end```

Pages (6): 1 2 3 4 5 6 Next
Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)