[DiscordArchive] So in this case of creature and target, what class would target be?
[DiscordArchive] So in this case of creature and target, what class would target be?
Archived author: Honey • Posted: 2023-10-16T09:33:36.730000+00:00
Original source
You can always use
```lua
if attacker:IsPlayer())
```
And send the message only if it's a player. So it doesn't error out.
Archived author: Honey • Posted: 2023-10-16T09:34:25.178000+00:00
Original source
Which reminds me I wanted to add more such helpers for creatures and pets, but never got around doing it
Archived author: Orion • Posted: 2023-10-16T09:38:41.913000+00:00
Original source
Oh, I see. Damn feels like I'm learning some alternate universe version of javascript XD
Archived author: Rymercyble • Posted: 2023-10-16T09:41:06.102000+00:00
Original source
actually lua is older than js so
Archived author: Orion • Posted: 2023-10-16T09:45:23.473000+00:00
Original source
ohno.jpg
Archived author: Foe • Posted: 2023-10-16T10:48:49.538000+00:00
Original source
Just use the To* methods
Archived author: Foe • Posted: 2023-10-16T10:49:11.909000+00:00
Original source
If attacker:ToPlayer() then
Archived author: Orion • Posted: 2023-10-16T10:53:11.299000+00:00
Original source
I see. Thanks!
Archived author: Honey • Posted: 2023-10-16T10:57:45.986000+00:00
Original source
Thanks for the reminder, i know these. You showed me the other day. I just hate to read that syntax.
Archived author: Foe • Posted: 2023-10-16T12:49:36.880000+00:00
Original source
That's because it actively tries to convert the object to the requested object, it's not a boolean return