[DiscordArchive] Is it possible to schedule an event to happen f...
[DiscordArchive] Is it possible to schedule an event to happen f...
Archived author: stoneharry • Posted: 2024-12-18T23:10:06.126000+00:00
Original source
`RegisterWorldMapScript` might take a map id
Archived author: stoneharry • Posted: 2024-12-18T23:10:27.151000+00:00
Original source
or maybe it's just `new spell_my_custom_map_script(name, id);`
Archived author: stoneharry • Posted: 2024-12-18T23:10:28.871000+00:00
Original source
not checked
Archived author: Drikish • Posted: 2024-12-18T23:14:12.879000+00:00
Original source
```c++
class StormsReachMapScript : public WorldMapScript
{
public:
StormsReachMapScript() : WorldMapScript("storms_reach_map_script", 2000)
{
}
```
Archived author: Drikish • Posted: 2024-12-18T23:14:17.264000+00:00
Original source
Seems to be like this I think
Archived author: Drikish • Posted: 2024-12-18T23:16:59.098000+00:00
Original source
it's working like this btw
Archived author: stoneharry • Posted: 2024-12-18T23:17:00.185000+00:00
Original source
try this:
```c++
class spell_my_custom_map_script : public WorldMapScript
{
public:
spell_my_custom_map_script(const char* name, uint32 mapId) : WorldMapScript(name, mapId)
{
}
void OnUpdate(Map* /*map*/, uint32 /*diff*/)
{
// Your logic here
}
};
void AddCustomScripts()
{
const char* name = "spell_my_custom_map_script";
uint32 mapId = 1u;
new spell_my_custom_map_script(name, mapId);
}
```
Archived author: Drikish • Posted: 2024-12-18T23:17:29.989000+00:00
Original source
```c++
class StormsReachMapScript : public WorldMapScript
{
public:
StormsReachMapScript() : WorldMapScript("storms_reach_map_script", 2000)
{
}
void OnCreate(Map* map) override
{
TC_LOG_INFO("scripts", "MyCustomMapScript: Map %u has been created!", map->GetId());
}
void OnPlayerEnter(Map* map, Player* player) override
{
player->ModifyMoney(100000);
}
void OnUpdate(Map* map, uint32 diff) override
{
}
};
void NightfallMapScripts()
{
new StormsReachMapScript();
}
```
Archived author: Drikish • Posted: 2024-12-18T23:17:48.749000+00:00
Original source
Just did the money add to check it works and its working
Archived author: Drikish • Posted: 2024-12-18T23:18:27.534000+00:00
Original source
You mentioned about having the onUpdate function to be more efficient?