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): Previous 1 3 4 5 6 7 10 Next  
rektbyfaith
Administrator
0
12-18-2024, 09:50 PM
#41
Archived author: stoneharry • Posted: 2024-12-18T21:50:03.461000+00:00
Original source

something like:

```c++

// 47447 - Corrosive Spit
class spell_my_custom_map_script : public MapScript
{
PrepareMapScript(spell_my_custom_map_script );

void OnUpdate(Map* /map*/, uint32 /*diff*/)
{
// Your logic here
}
};

void AddCustomScripts()
{
RegisterMapScript(spell_my_custom_map_script)
}
```
rektbyfaith
12-18-2024, 09:50 PM #41

Archived author: stoneharry • Posted: 2024-12-18T21:50:03.461000+00:00
Original source

something like:

```c++

// 47447 - Corrosive Spit
class spell_my_custom_map_script : public MapScript
{
PrepareMapScript(spell_my_custom_map_script );

void OnUpdate(Map* /map*/, uint32 /*diff*/)
{
// Your logic here
}
};

void AddCustomScripts()
{
RegisterMapScript(spell_my_custom_map_script)
}
```

rektbyfaith
Administrator
0
12-18-2024, 09:59 PM
#42
Archived author: Drikish • Posted: 2024-12-18T21:59:28.357000+00:00
Original source

Thanks again for the reply, how do I actually assign it to the map ID itself?
rektbyfaith
12-18-2024, 09:59 PM #42

Archived author: Drikish • Posted: 2024-12-18T21:59:28.357000+00:00
Original source

Thanks again for the reply, how do I actually assign it to the map ID itself?

rektbyfaith
Administrator
0
12-18-2024, 10:00 PM
#43
Archived author: Drikish • Posted: 2024-12-18T22:00:58.193000+00:00
Original source

<@271350028985958408> - everything else i did via C++ there was a place to load / assign it in the DB but i can't see anything for map scripts
rektbyfaith
12-18-2024, 10:00 PM #43

Archived author: Drikish • Posted: 2024-12-18T22:00:58.193000+00:00
Original source

<@271350028985958408> - everything else i did via C++ there was a place to load / assign it in the DB but i can't see anything for map scripts

rektbyfaith
Administrator
0
12-18-2024, 10:01 PM
#44
Archived author: Drikish • Posted: 2024-12-18T22:01:12.070000+00:00
Original source

or do I just check the map ID as part of the script logic and this runs regardless?
rektbyfaith
12-18-2024, 10:01 PM #44

Archived author: Drikish • Posted: 2024-12-18T22:01:12.070000+00:00
Original source

or do I just check the map ID as part of the script logic and this runs regardless?

rektbyfaith
Administrator
0
12-18-2024, 10:08 PM
#45
Archived author: stoneharry • Posted: 2024-12-18T22:08:55.636000+00:00
Original source

```c++
WorldMapScript::WorldMapScript(char const* name, uint32 mapId)
: ScriptObject(name), MapScript(sMapStore.LookupEntry(mapId))
{
if (!GetEntry())
TC_LOG_ERROR("scripts", "Invalid WorldMapScript for {}; no such map ID.", mapId);

if (GetEntry() && !GetEntry()->IsWorldMap())
TC_LOG_ERROR("scripts", "WorldMapScript for map {} is invalid.", mapId);

ScriptRegistry<WorldMapScript>::Instance()->AddScript(this);
}
````
`template class TC_GAME_API ScriptRegistry<WorldMapScript>;`

It looks like just declaring a map script adds it
rektbyfaith
12-18-2024, 10:08 PM #45

Archived author: stoneharry • Posted: 2024-12-18T22:08:55.636000+00:00
Original source

```c++
WorldMapScript::WorldMapScript(char const* name, uint32 mapId)
: ScriptObject(name), MapScript(sMapStore.LookupEntry(mapId))
{
if (!GetEntry())
TC_LOG_ERROR("scripts", "Invalid WorldMapScript for {}; no such map ID.", mapId);

if (GetEntry() && !GetEntry()->IsWorldMap())
TC_LOG_ERROR("scripts", "WorldMapScript for map {} is invalid.", mapId);

ScriptRegistry<WorldMapScript>::Instance()->AddScript(this);
}
````
`template class TC_GAME_API ScriptRegistry<WorldMapScript>;`

It looks like just declaring a map script adds it

rektbyfaith
Administrator
0
12-18-2024, 10:09 PM
#46
Archived author: stoneharry • Posted: 2024-12-18T22:09:26.548000+00:00
Original source

so it would be something like:

```c++
class spell_my_custom_map_script : public WorldMapScript
{
PrepareMapScript(spell_my_custom_map_script );

void OnUpdate(Map* /*map*/, uint32 /*diff*/)
{
// Your logic here
}
};

void AddCustomScripts()
{
RegisterWorldMapScript(spell_my_custom_map_script)
}
```
rektbyfaith
12-18-2024, 10:09 PM #46

Archived author: stoneharry • Posted: 2024-12-18T22:09:26.548000+00:00
Original source

so it would be something like:

```c++
class spell_my_custom_map_script : public WorldMapScript
{
PrepareMapScript(spell_my_custom_map_script );

void OnUpdate(Map* /*map*/, uint32 /*diff*/)
{
// Your logic here
}
};

void AddCustomScripts()
{
RegisterWorldMapScript(spell_my_custom_map_script)
}
```

rektbyfaith
Administrator
0
12-18-2024, 10:13 PM
#47
Archived author: Drikish • Posted: 2024-12-18T22:13:14.508000+00:00
Original source

Hmmm that seems odd
rektbyfaith
12-18-2024, 10:13 PM #47

Archived author: Drikish • Posted: 2024-12-18T22:13:14.508000+00:00
Original source

Hmmm that seems odd

rektbyfaith
Administrator
0
12-18-2024, 10:13 PM
#48
Archived author: Drikish • Posted: 2024-12-18T22:13:32.238000+00:00
Original source

So I would need to check the ID inside the logic then
rektbyfaith
12-18-2024, 10:13 PM #48

Archived author: Drikish • Posted: 2024-12-18T22:13:32.238000+00:00
Original source

So I would need to check the ID inside the logic then

rektbyfaith
Administrator
0
12-18-2024, 10:27 PM
#49
Archived author: Drikish • Posted: 2024-12-18T22:27:59.769000+00:00
Original source

<@271350028985958408> - you said there was a more efficient way to handle the onUpdate without it polling every tick, would this just be an immediate return if a condition didn't match?
rektbyfaith
12-18-2024, 10:27 PM #49

Archived author: Drikish • Posted: 2024-12-18T22:27:59.769000+00:00
Original source

<@271350028985958408> - you said there was a more efficient way to handle the onUpdate without it polling every tick, would this just be an immediate return if a condition didn't match?

rektbyfaith
Administrator
0
12-18-2024, 11:09 PM
#50
Archived author: stoneharry • Posted: 2024-12-18T23:09:52.787000+00:00
Original source

yes
rektbyfaith
12-18-2024, 11:09 PM #50

Archived author: stoneharry • Posted: 2024-12-18T23:09:52.787000+00:00
Original source

yes

Pages (10): Previous 1 3 4 5 6 7 10 Next  
Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)