[DiscordArchive] Still got magic numbers but is this going to be an issue in spell script to check quest objective da
[DiscordArchive] Still got magic numbers but is this going to be an issue in spell script to check quest objective da
Archived author: Northstrider • Posted: 2024-01-14T22:38:12.808000+00:00
Original source
GetCaster() must be a valid ptr before using ToPlayer()
Archived author: Northstrider • Posted: 2024-01-14T22:44:04.148000+00:00
Original source
(this applies to aura scripts only because auras can continue to exist without their caster
Archived author: funjoker • Posted: 2024-01-14T22:45:18.297000+00:00
Original source
```cpp
if (GetCaster() && GetCaster()->ToPlayer())
```
<:kek:868839618898960414>
![[Image: image.png?ex=690c7d3b&is=690b2bbb&hm=334...16c60b732&]](https://cdn.discordapp.com/attachments/376457124726702080/1196224607838015599/image.png?ex=690c7d3b&is=690b2bbb&hm=33406304d1b6e5b6ac5909fb25a6a3de24a57cd6225ce777d1ec28716c60b732&)
Archived author: Malcrom • Posted: 2024-01-14T22:49:31.335000+00:00
Original source
![[Image: image.png?ex=690c7d3b&is=690b2bbb&hm=334...16c60b732&]](https://cdn.discordapp.com/attachments/376457124726702080/1196224607838015599/image.png?ex=690c7d3b&is=690b2bbb&hm=33406304d1b6e5b6ac5909fb25a6a3de24a57cd6225ce777d1ec28716c60b732&)
Archived author: Northstrider • Posted: 2024-01-14T22:50:36.693000+00:00
Original source
Player* player = Object::ToPlayer(GetCaster()); is the quick and safe route
Archived author: Malcrom • Posted: 2024-01-14T22:50:50.403000+00:00
Original source
where?
Archived author: Northstrider • Posted: 2024-01-14T22:51:27.674000+00:00
Original source
remove Unit* caster completely and just do what I wrote above. Object::ToPlayer(GetCaster()) has a builtin nullptr check so if the caster returns nullptr, the player is also nullptr
![[Image: image.png?ex=690c7dbd&is=690b2c3d&hm=739...5bff069b5&]](https://cdn.discordapp.com/attachments/376457124726702080/1196225154230005800/image.png?ex=690c7dbd&is=690b2c3d&hm=739a48c13a98a17b6438afba095482b4d3f8bd944d8e6a572fc54045bff069b5&)
Archived author: Malcrom • Posted: 2024-01-14T22:51:41.616000+00:00
Original source
![[Image: image.png?ex=690c7dbd&is=690b2c3d&hm=739...5bff069b5&]](https://cdn.discordapp.com/attachments/376457124726702080/1196225154230005800/image.png?ex=690c7dbd&is=690b2c3d&hm=739a48c13a98a17b6438afba095482b4d3f8bd944d8e6a572fc54045bff069b5&)
Archived author: Northstrider • Posted: 2024-01-14T22:51:45.130000+00:00
Original source
Yes
Archived author: Malcrom • Posted: 2024-01-14T22:51:49.840000+00:00
Original source
ok, ty