[DiscordArchive] hmm still doesn't work, how can I check if OnUpdate is called?
[DiscordArchive] hmm still doesn't work, how can I check if OnUpdate is called?
Archived author: -- • Posted: 2020-01-19T21:17:37.444000+00:00
Original source
we didn't add them to db2
Archived author: Auhgarn • Posted: 2020-01-19T21:18:34.622000+00:00
Original source
> ```cpp
> #include "GameObject.h"
> #include "Player.h"
> #include "ScriptMgr.h"
>
> class atal_dazar_entrance : public GameObjectScript
> {
> public:
> uint16 timer;
> atal_dazar_entrance() : GameObjectScript("atal_dazar_entrance")
> {
> timer = 5000;
> }
>
> void OnUpdate(GameObject* obj, uint32 diff) override
> {
> if (timer <= diff)
> {
> if (Player* player = obj->SelectNearestPlayer(5.0f))
> {
> player->TeleportTo(1763, -848.41f, 2060.18f, 725.14f, 0, 0);
> }
> }
> else
> {
> timer -= diff;
> }
> }
> };
>
> void AddSC_zuldazar()
> {
> new atal_dazar_entrance();
> }
> ```
<@!177134386263752705>
I thought this was the script that could be added to the gameobject
Archived author: Auhgarn • Posted: 2020-01-19T21:19:27.755000+00:00
Original source
I will give it a try with playerlist
Archived author: Auhgarn • Posted: 2020-01-19T21:19:30.180000+00:00
Original source
like you said
Archived author: -- • Posted: 2020-01-19T21:19:30.546000+00:00
Original source
`struct go_ataldazar_entrance : public GameObjectAI
{
go_ataldazar_entrance(GameObject* go) : GameObjectAI(go) { checkTimer = 2000; }
void UpdateAI(uint32 diff) override
{
if (checkTimer <= diff)
{
std::list<Player*> players;
go->GetPlayerListInGrid(players, 5.f);
for (Player* player : players)
player->TeleportTo(1763, -848.41f, 2060.18f, 725.14f, 0, 0);
}
else
checkTimer -= diff;
}
private:
uint32 checkTimer;
};`
Archived author: -- • Posted: 2020-01-19T21:19:47.206000+00:00
Original source
RegisterGameObjectAI(go_ataldazar_entrance );
Archived author: Auhgarn • Posted: 2020-01-19T21:31:47.428000+00:00
Original source
Can't get it to work, but will sit more with it tomorrow