Forums WoW Modding Support Archives WoWModding Threads [DiscordArchive] Is it possible to schedule an event to happen f...

[DiscordArchive] Is it possible to schedule an event to happen f...

[DiscordArchive] Is it possible to schedule an event to happen f...

Pages (10): 1 2 3 4 5 10 Next  
rektbyfaith
Administrator
0
12-18-2024, 06:41 PM
#1
Archived author: Needle • Posted: 2024-12-18T18:41:59.412000+00:00
Original source

rektbyfaith
12-18-2024, 06:41 PM #1

Archived author: Needle • Posted: 2024-12-18T18:41:59.412000+00:00
Original source

rektbyfaith
Administrator
0
12-18-2024, 06:42 PM
#2
Archived author: Needle • Posted: 2024-12-18T18:42:00.294000+00:00
Original source

Thread automatically created by Drikish in <#415944535718494208>
rektbyfaith
12-18-2024, 06:42 PM #2

Archived author: Needle • Posted: 2024-12-18T18:42:00.294000+00:00
Original source

Thread automatically created by Drikish in <#415944535718494208>

rektbyfaith
Administrator
0
12-18-2024, 06:43 PM
#3
Archived author: stoneharry • Posted: 2024-12-18T18:43:59.508000+00:00
Original source

not with anything that exists today

It can be set up in DB with the game events system

Or you can write a new command to do it
rektbyfaith
12-18-2024, 06:43 PM #3

Archived author: stoneharry • Posted: 2024-12-18T18:43:59.508000+00:00
Original source

not with anything that exists today

It can be set up in DB with the game events system

Or you can write a new command to do it

rektbyfaith
Administrator
0
12-18-2024, 07:17 PM
#4
Archived author: Drikish • Posted: 2024-12-18T19:17:31.908000+00:00
Original source

```c++
static bool HandleNightfallTrigger(ChatHandler* handler, char const* /*args*/)
{
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
return false;
}

// check online security
if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;

WorldPackets::Misc::LoginSetTimeSpeed loginSetTimeSpeed;
loginSetTimeSpeed.NewSpeed = 2.0f;
loginSetTimeSpeed.GameTime = GameTime::GetGameTime();
loginSetTimeSpeed.ServerTime = GameTime::GetGameTime();
handler->GetSession()->GetPlayer()->SendDirectMessage(loginSetTimeSpeed.Write());

// Time out here
target->AddDelayedEvent(5000, [handler]() {
handler->SendSysMessage("Hello world!");
});

return true;
}
```
rektbyfaith
12-18-2024, 07:17 PM #4

Archived author: Drikish • Posted: 2024-12-18T19:17:31.908000+00:00
Original source

```c++
static bool HandleNightfallTrigger(ChatHandler* handler, char const* /*args*/)
{
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
return false;
}

// check online security
if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;

WorldPackets::Misc::LoginSetTimeSpeed loginSetTimeSpeed;
loginSetTimeSpeed.NewSpeed = 2.0f;
loginSetTimeSpeed.GameTime = GameTime::GetGameTime();
loginSetTimeSpeed.ServerTime = GameTime::GetGameTime();
handler->GetSession()->GetPlayer()->SendDirectMessage(loginSetTimeSpeed.Write());

// Time out here
target->AddDelayedEvent(5000, [handler]() {
handler->SendSysMessage("Hello world!");
});

return true;
}
```

rektbyfaith
Administrator
0
12-18-2024, 07:17 PM
#5
Archived author: Drikish • Posted: 2024-12-18T19:17:57.821000+00:00
Original source

I mean like this basically trying to schedule after X Seconds something else happens <@271350028985958408>
rektbyfaith
12-18-2024, 07:17 PM #5

Archived author: Drikish • Posted: 2024-12-18T19:17:57.821000+00:00
Original source

I mean like this basically trying to schedule after X Seconds something else happens <@271350028985958408>

rektbyfaith
Administrator
0
12-18-2024, 07:18 PM
#6
Archived author: Drikish • Posted: 2024-12-18T19:18:34.434000+00:00
Original source

This is wrong and crashes server as i think the context is long deleted before the event can be fired but it kind of illustrates what im trying to do
rektbyfaith
12-18-2024, 07:18 PM #6

Archived author: Drikish • Posted: 2024-12-18T19:18:34.434000+00:00
Original source

This is wrong and crashes server as i think the context is long deleted before the event can be fired but it kind of illustrates what im trying to do

rektbyfaith
Administrator
0
12-18-2024, 07:18 PM
#7
Archived author: Drikish • Posted: 2024-12-18T19:18:54.078000+00:00
Original source

I was hoping there was a World events scheduler that I could hook into that's basically the world server itself
rektbyfaith
12-18-2024, 07:18 PM #7

Archived author: Drikish • Posted: 2024-12-18T19:18:54.078000+00:00
Original source

I was hoping there was a World events scheduler that I could hook into that's basically the world server itself

rektbyfaith
Administrator
0
12-18-2024, 07:22 PM
#8
Archived author: stoneharry • Posted: 2024-12-18T19:22:07.994000+00:00
Original source

I'm not familiar with the scheduling API (I can dig into it if you are really stuck) but that pointer `handler` might have been invalidated, and when you try to access it, it crashes.

You should store the player GUID and fetch the player reference again by GUID, checking if you get a value back
rektbyfaith
12-18-2024, 07:22 PM #8

Archived author: stoneharry • Posted: 2024-12-18T19:22:07.994000+00:00
Original source

I'm not familiar with the scheduling API (I can dig into it if you are really stuck) but that pointer `handler` might have been invalidated, and when you try to access it, it crashes.

You should store the player GUID and fetch the player reference again by GUID, checking if you get a value back

rektbyfaith
Administrator
0
12-18-2024, 07:22 PM
#9
Archived author: Drikish • Posted: 2024-12-18T19:22:55.041000+00:00
Original source

Well to be honest I need to do this server side, i did it as a GM command just as a test.
rektbyfaith
12-18-2024, 07:22 PM #9

Archived author: Drikish • Posted: 2024-12-18T19:22:55.041000+00:00
Original source

Well to be honest I need to do this server side, i did it as a GM command just as a test.

rektbyfaith
Administrator
0
12-18-2024, 07:23 PM
#10
Archived author: Drikish • Posted: 2024-12-18T19:23:03.916000+00:00
Original source

I think the Events system is maybe the best way like you said
rektbyfaith
12-18-2024, 07:23 PM #10

Archived author: Drikish • Posted: 2024-12-18T19:23:03.916000+00:00
Original source

I think the Events system is maybe the best way like you said

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