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

TEN/LUA - Hub data / OnEnd issues #890

Closed
AkyV opened this issue Aug 30, 2024 · 3 comments
Closed

TEN/LUA - Hub data / OnEnd issues #890

AkyV opened this issue Aug 30, 2024 · 3 comments

Comments

@AkyV
Copy link

AkyV commented Aug 30, 2024

Hello!
I’ve made some tests with GameVars variables value to understand that how OnEnd works exactly.
I’ve got numerous awful test results…

ENDREASON TEST

Test1.lua:

  • GameVars.testVar value set in an OnLoop moment. (Moment is defined as „a” value, based on a = a + 1 loop operation.)
  • Another GameVars.testVar value set in OnEnd, also using TEN.Logic.EndReason constants (if… then) to change OnLoop variable value.

Test2.lua:

  • ShowString (in loop callback) to print GameVars.testVar value.

Title.lua:

  • ShowString (in loop „ControlPhase” callback) to print GameVars.testVar value.

Tested situations, on Test1:

  • Finish trigger to Test2
  • Savegame load to Test2
  • Finish trigger to title
  • From Pause menu to title
  • Lara’s death to title

Results:

  • EndReason.LEVELCOMPLETE: After Finish trigger, Test1 OnEnd value is printed in Test2. (Passed.)
  • EndReason.LOADGAME: After Finish trigger, Test1 OnLoop value is printed in Test2. (Passed.) Now I save SaveX. Then Finish of Test2 loads back to Test 1. Now I load Save X, back to Test2, still Test1 OnLoop value is printed. (If I understand LOADGAME exactly, then it is a failed test then. I mean, under any other circumstances, it seems logical that the saved Test1 OnLoop value is loaded – except now, Test1 OnEnd value should be printed. Which means if LOADGAME would work well, then I shouldn’t run OnEnd without an EndReason constant, otherwise I may ruin saved values unintentionally.)
    Maybe it also connected to HUB DATA TEST (see below).
  • EndReason.EXITTOTITLE: After Finish trigger/Pause menu, there is no value printed in title. Log says: „[error] Could not execute function: ../../Scripts\Levels\title.lua:21: attempt to call a nil value (global 'toString')” (Failed.)
  • EndReason.DEATH: After Lara’s death and loading title, there is no value printed in title. Log says: „[error] Could not execute function: ../../Scripts\Levels\title.lua:21: attempt to call a nil value (global 'toString')” (Failed.)
  • EndReason.OTHER: it must be a custom value, I cannot get it now.

HUB DATA TEST
Test1.lua:

  • GameVars.testVar value set at a=1 OnLoop moment. (Moment is defined as „a” value, based on a = a + 1 loop operation.)
  • Another GameVars.testVar value set at a=100 OnLoop moment. (Moment is defined as „a” value, based on a = a + 1 loop operation.) 100 is random now.

Test2.lua:

  • ShowString (in loop callback) to print GameVars.testVar value.

Tested situation, from Test1:
Some moments after starting Test1 (so when a=100 value is just set) a Finish trigger loads to Test2. This a=100 value is printed now. (Passed.) Then a Finish of this level loads back to Test1. OnLoop a=1 moment changes the value. Very fast (so when the value is still at a=1 value) I load back to Test2, with the same Finish as before. I expect that a=1 value will be printed, but still a=100 value printed instead. (Failed.) (I tried with both Lara and Lara_Start_Pos, when loading back to Test1.)

Conclusion (I think):
You can't take over a GameVars variable value from Level A to Level B if Level B already has a value for that variable from a previous visit of Lara there. However, you can still change that variable value on Level B.
(And, as you see above, I can't take a GameVars variable value into the title, at all. Or, vice verse, anyway, from title to level.)


Maybe it is all connected to this issue:
#855

@Nickelony
Copy link
Collaborator

I think all issues specifically TEN related (not Tomb Editor, WadTool or TIDE related), should really be posted on the Tomb Engine repo: https://github.com/MontyTRC89/TombEngine

@AkyV
Copy link
Author

AkyV commented Sep 1, 2024

Okay, thanks, I (also) post it there.

@Lwmte
Copy link
Collaborator

Lwmte commented Sep 23, 2024

Closed, as the issue is now in TEN project issue list.

@Lwmte Lwmte closed this as completed Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants