Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] can someone enlighten me how to read the call? i know a bit of lua, how to pass arguments, but that

[DiscordArchive] can someone enlighten me how to read the call? i know a bit of lua, how to pass arguments, but that

[DiscordArchive] can someone enlighten me how to read the call? i know a bit of lua, how to pass arguments, but that

rektbyfaith
Administrator
0
12-30-2020, 09:55 AM
#1
Archived author: Honey • Posted: 2020-12-30T09:55:54.884000+00:00
Original source

can someone enlighten me how to read the call? i know a bit of lua, how to pass arguments, but that one doesnt make sense to me at all?
rektbyfaith
12-30-2020, 09:55 AM #1

Archived author: Honey • Posted: 2020-12-30T09:55:54.884000+00:00
Original source

can someone enlighten me how to read the call? i know a bit of lua, how to pass arguments, but that one doesnt make sense to me at all?

rektbyfaith
Administrator
0
12-30-2020, 09:58 AM
#2
Archived author: Honey • Posted: 2020-12-30T09:58:46.030000+00:00
Original source

if it helps, the files are
https://github.com/azerothcore/azerothco...tAI.h#L215
and
https://github.com/azerothcore/azerothco...l.cpp#L114
rektbyfaith
12-30-2020, 09:58 AM #2

Archived author: Honey • Posted: 2020-12-30T09:58:46.030000+00:00
Original source

if it helps, the files are
https://github.com/azerothcore/azerothco...tAI.h#L215
and
https://github.com/azerothcore/azerothco...l.cpp#L114

rektbyfaith
Administrator
0
12-30-2020, 10:51 AM
#3
Archived author: MaloW • Posted: 2020-12-30T10:51:25.914000+00:00
Original source

In the Gruul script:
Calls SelectTarget in order to get a target: https://github.com/azerothcore/azerothco...AI.cpp#L82 using SELECT_TARGET_TOPAGGRO mode for finding meaning it searches through the threat-table from top-down. "1" is which position (position 0 would be the tank I think) and 5.0f is the distance (so it only looks for players within 5 yards). This in turn calls the function you linked with some modified parameters. The SelectTarget function basically just pulls the the ThreatList from the ThreatManager, a list of units ordered by their current threat. For the SELECT_TARGET_TOPAGGRO case we begin iterating through the list, and do 1 "advance" which means we move 1 step into the list (skipping the first element basically) and then we return that unit.
This returns a unit, the person to cast Hurtful Strike on, or null if no unit can be found that satisfy these requirements. If null then it skips casting it.
rektbyfaith
12-30-2020, 10:51 AM #3

Archived author: MaloW • Posted: 2020-12-30T10:51:25.914000+00:00
Original source

In the Gruul script:
Calls SelectTarget in order to get a target: https://github.com/azerothcore/azerothco...AI.cpp#L82 using SELECT_TARGET_TOPAGGRO mode for finding meaning it searches through the threat-table from top-down. "1" is which position (position 0 would be the tank I think) and 5.0f is the distance (so it only looks for players within 5 yards). This in turn calls the function you linked with some modified parameters. The SelectTarget function basically just pulls the the ThreatList from the ThreatManager, a list of units ordered by their current threat. For the SELECT_TARGET_TOPAGGRO case we begin iterating through the list, and do 1 "advance" which means we move 1 step into the list (skipping the first element basically) and then we return that unit.
This returns a unit, the person to cast Hurtful Strike on, or null if no unit can be found that satisfy these requirements. If null then it skips casting it.

rektbyfaith
Administrator
0
12-30-2020, 10:52 AM
#4
Archived author: MaloW • Posted: 2020-12-30T10:52:30.195000+00:00
Original source

Hopefully that answers your question
rektbyfaith
12-30-2020, 10:52 AM #4

Archived author: MaloW • Posted: 2020-12-30T10:52:30.195000+00:00
Original source

Hopefully that answers your question

rektbyfaith
Administrator
0
12-30-2020, 11:01 AM
#5
Archived author: Honey • Posted: 2020-12-30T11:01:26.131000+00:00
Original source

yeah that link to UnitAI.cpp indeed clarifies how the arguments are passed on, thx!
looks like the bossscript needs a handler for "no one except mt in range" so the hurtful strikes cant be avoided.
rektbyfaith
12-30-2020, 11:01 AM #5

Archived author: Honey • Posted: 2020-12-30T11:01:26.131000+00:00
Original source

yeah that link to UnitAI.cpp indeed clarifies how the arguments are passed on, thx!
looks like the bossscript needs a handler for "no one except mt in range" so the hurtful strikes cant be avoided.

rektbyfaith
Administrator
0
12-30-2020, 11:02 AM
#6
Archived author: MaloW • Posted: 2020-12-30T11:02:53.535000+00:00
Original source

Yeah, I would just add an else to that if, so if the unit returned is null the else runs and just casts hurtful strike on GetVictim()
rektbyfaith
12-30-2020, 11:02 AM #6

Archived author: MaloW • Posted: 2020-12-30T11:02:53.535000+00:00
Original source

Yeah, I would just add an else to that if, so if the unit returned is null the else runs and just casts hurtful strike on GetVictim()

rektbyfaith
Administrator
0
12-30-2020, 11:03 AM
#7
Archived author: MaloW • Posted: 2020-12-30T11:03:23.121000+00:00
Original source

(I think GetVictim() returns the current target of melee attacks, aka the top threat guy)
rektbyfaith
12-30-2020, 11:03 AM #7

Archived author: MaloW • Posted: 2020-12-30T11:03:23.121000+00:00
Original source

(I think GetVictim() returns the current target of melee attacks, aka the top threat guy)

rektbyfaith
Administrator
0
12-30-2020, 11:32 AM
#8
Archived author: Honey • Posted: 2020-12-30T11:32:05.962000+00:00
Original source

```C
case EVENT_HURTFUL_STRIKE:
if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 5.0f))
me->CastSpell(target, SPELL_HURTFUL_STRIKE, false);
else if (Unit* target = GetVictim())
me->CastSpell(target, SPELL_HURTFUL_STRIKE, false);
events.ScheduleEvent(EVENT_HURTFUL_STRIKE, 15000);
break;
```
like this?
rektbyfaith
12-30-2020, 11:32 AM #8

Archived author: Honey • Posted: 2020-12-30T11:32:05.962000+00:00
Original source

```C
case EVENT_HURTFUL_STRIKE:
if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 5.0f))
me->CastSpell(target, SPELL_HURTFUL_STRIKE, false);
else if (Unit* target = GetVictim())
me->CastSpell(target, SPELL_HURTFUL_STRIKE, false);
events.ScheduleEvent(EVENT_HURTFUL_STRIKE, 15000);
break;
```
like this?

rektbyfaith
Administrator
0
12-30-2020, 12:04 PM
#9
Archived author: MaloW • Posted: 2020-12-30T12:04:35.814000+00:00
Original source

pretty much
rektbyfaith
12-30-2020, 12:04 PM #9

Archived author: MaloW • Posted: 2020-12-30T12:04:35.814000+00:00
Original source

pretty much

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