[DiscordArchive] they have "override", do you know what that means in this case and in C++ in general ?
[DiscordArchive] they have "override", do you know what that means in this case and in C++ in general ?
Archived author: jackpoz • Posted: 2025-07-31T10:52:51.871000+00:00
Original source
they have "override", do you know what that means in this case and in C++ in general ?
Archived author: Crane • Posted: 2025-07-31T10:54:51.963000+00:00
Original source
I'm still practicing, so I'll look for examples and put something together. I've got half the battle. The only thing missing is that it runs through the waypoint, and that's the only thing that doesn't work.
Override means overwriting functions or something like that.
Archived author: Crane • Posted: 2025-07-31T10:56:38.337000+00:00
Original source
https://github.com/search?q=repo%3Atrick...&type=code I've looked at examples where they also use override etc.
Archived author: jackpoz • Posted: 2025-07-31T10:59:02.951000+00:00
Original source
it means the base class already has an implementation that you don't want to use and want to provide your own
Archived author: Crane • Posted: 2025-07-31T10:59:05.489000+00:00
Original source
All I see in the console is EscortAI::Start: (script: npc_frosthound) is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn (GUID Full: 0xF1500073ED000380 Type: Vehicle Entry: 29677 Low: 896)
The escortAI appears to start, but the NPC isn't running.
Archived author: jackpoz • Posted: 2025-07-31T10:59:28.228000+00:00
Original source
so ideally you should check what you are removing from that AI with every override
Archived author: jackpoz • Posted: 2025-07-31T11:00:00.697000+00:00
Original source
like how does this affect the ai ? void EnterEvadeMode(EvadeReason /*why*/) override {}
Archived author: Crane • Posted: 2025-07-31T11:01:28.764000+00:00
Original source
```c++
struct npc_frosthound : public EscortAI
{
npc_frosthound(Creature* creature) : EscortAI(creature) {}
void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
{
if (apply)
Start(true, false, who->GetGUID());
me->CastSpell(me, SPELL_SUMMON_PURSUERS_PERIODIC, true);
}
}
void Reset() override
{
me->SetReactState(REACT_PASSIVE);
}
void UpdateAI(uint32 diff) override
{
EscortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
}
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
return;
switch (waypointId)
{
case 1:
me->TextEmote("You've been seen! Use the net and Freezing elixir to keep the dwarves away!", nullptr, true);
break;
case 33:
me->TextEmote("The frosthound has located the thief's hiding place. Confront him!", 0, true);
player->KilledMonsterCredit(29677);
break;
}
}
void JustSummoned(Creature* summon) override
{
summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT);
summon->ToTempSummon()->InitStats(20000);
if (urand(0, 1))
summon->GetMotionMaster()->MoveFollow(me, 0.0f, 0.0f);
else if (summon->AI())
summon->AI()->AttackStart(me);
}
};```
I have removed everything I don't need but it still doesn't work.
Archived author: jackpoz • Posted: 2025-07-31T11:04:23.135000+00:00
Original source
it's more about understanding what you add/remove than trying different random things
Archived author: Crane • Posted: 2025-07-31T11:04:41.340000+00:00
Original source
It's hard to learn something when you don't know where the error lies. If someone tells me the solution I'm struggling with, then I can learn from it for the future, but as it is, it's a 50/50 chance that it will work.