Sythivo / AIEngine

A Roblox module
MIT License
8 stars 1 forks source link

OnChaseEnded doesn't return the last targeted player. #1

Closed GalladeR475 closed 1 year ago

GalladeR475 commented 1 year ago

FIX

On line 65 of the Chase mechanism/module, you'll see a declaration of OnStateChange to be something like this: image As you can see, OnChaseEnded doesn't fire with the last targeted player. Just a little above, on line 56 you can see that OnChaseEnded will be fired with the last targeted player, but only happens if there is another player in sight. image But for single-player games, this is not that handy. Here's my fix: image

GalladeR475 commented 1 year ago

Let me know if you're having any issues!

Sythivo commented 1 year ago

This is on purpose.

When there is no player passed into OnChaseEnded event, it signifies that the AI has completely ended, chasing no one. When a player is passed, it represents that it is chasing a new player, so it would pass the previous player that it chased.

Also note this is part of the examples, which should be viewed as examples I created, and you can improve on or modify.

GalladeR475 commented 1 year ago

+Reminder: AIEngine can be modified to whatever you like, just as Sythivo said. image As you can see, the ? indicates that the Signal would either return a player or nil. This was done by design. I hope you understand!

S7vie commented 1 year ago

Interesting I didn't know about that, thanks!

Sythivo commented 1 year ago

Modifying the AIEngine source isn't suggested but you are free to do so. You can copy the Examples template to design your own system.

Sythivo commented 1 year ago

I would close this issue as it appears to be solved. 😅