Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: eventcallbacks which returns a ReturnValue #2532

Merged

Conversation

lamonato29
Copy link
Contributor

@lamonato29 lamonato29 commented Apr 8, 2024

Description

This PR fixes eventcallbacks whose returns were in type conflict (creatureOnAreaCombat and creatureOnTargetCombat)

Behaviour

Actual

The eventcallback does not start.

Expected

Now, we can use ReturnValue, instead of true or false, to stop an attack execution, for example.
The old events system (data/events/scripts/creature.lua for example) runs first, then, if it succeed, the new eventcallback system runs too.

image

Tibia.-.Palaum.2024-04-08.16-31-58.mp4

Be Careful with custom scripts returning true or false. It may fail.

Fixes #2529

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

@lamonato29 lamonato29 requested a review from dudantas April 9, 2024 15:39
@luanluciano93
Copy link
Contributor

Tested with the proposed changes and it's working fine! Just change the README to the new operation.
https://github.com/opentibiabr/canary/blob/main/data/scripts/eventcallbacks/README.md?plain=1

lamonato29 and others added 3 commits April 12, 2024 08:40
as suggested by luanluciano93. Thank you, Luan!

Co-authored-by: Luan Luciano <[email protected]>
@jbracovich

This comment was marked as outdated.

@lamonato29
Copy link
Contributor Author

image

add the changes but it gives me an error when trying to compile in event_callback_functions.cpp

Hello. I think you made something wrong. I didn't touched this file event_callback_functions.cpp.

@luanluciano93
Copy link
Contributor

in the README file the example of a callback with Boolean return is creatureOnAreaCombat

@lamonato29
Copy link
Contributor Author

in the README file the example of a callback with Boolean return is creatureOnAreaCombat

Fixed! Thank you, Luan.

@luanluciano93
Copy link
Contributor

@lamonato29
Copy link
Contributor Author

@majestyotbr majestyotbr merged commit 3f6ac9a into opentibiabr:main Jun 23, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

creatureOnTargetCombat eventcallback does not work
6 participants