Forums WoW Modding Support Archives TrinityCore Discord Archives [DiscordArchive] How do I get an NPC within a certain range to cast a spell on themselves? It's simple in SAI, but I'

[DiscordArchive] How do I get an NPC within a certain range to cast a spell on themselves? It's simple in SAI, but I'

[DiscordArchive] How do I get an NPC within a certain range to cast a spell on themselves? It's simple in SAI, but I'

rektbyfaith
Administrator
0
08-18-2025, 12:20 PM
#1
Archived author: Crane • Posted: 2025-08-18T12:20:46.271000+00:00
Original source

How do I get an NPC within a certain range to cast a spell on themselves? It's simple in SAI, but I've never done it in C++.
```c++
for (Creature* follower : followers)
{
if (follower && follower->IsAlive())
{
me->CastSpell(follower, 51347, false);
}
}```

Anyone have any ideas?
rektbyfaith
08-18-2025, 12:20 PM #1

Archived author: Crane • Posted: 2025-08-18T12:20:46.271000+00:00
Original source

How do I get an NPC within a certain range to cast a spell on themselves? It's simple in SAI, but I've never done it in C++.
```c++
for (Creature* follower : followers)
{
if (follower && follower->IsAlive())
{
me->CastSpell(follower, 51347, false);
}
}```

Anyone have any ideas?

rektbyfaith
Administrator
0
08-18-2025, 12:35 PM
#2
Archived author: Riztazz • Posted: 2025-08-18T12:35:29.362000+00:00
Original source

timer + GetCreatureList in grid or whatever the function was called
rektbyfaith
08-18-2025, 12:35 PM #2

Archived author: Riztazz • Posted: 2025-08-18T12:35:29.362000+00:00
Original source

timer + GetCreatureList in grid or whatever the function was called

rektbyfaith
Administrator
0
08-18-2025, 12:36 PM
#3
Archived author: Riztazz • Posted: 2025-08-18T12:36:18.326000+00:00
Original source

in ur case u have like 1 mob type ;p maybe u can cache their guids on event start
rektbyfaith
08-18-2025, 12:36 PM #3

Archived author: Riztazz • Posted: 2025-08-18T12:36:18.326000+00:00
Original source

in ur case u have like 1 mob type ;p maybe u can cache their guids on event start

Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)