|Kenny Je (kenny456)||09.10.2020 13:20|
|Hi, is there any way how to execute my function just right before game will quit by player? Something like this:
FSBaseMission.onExitGame = Utils.prependedFunction(FSBaseMission.onExitGame, mySpec.myExitGame);
|Bilbo Beutlin (BBeutlin)||09.10.2020 17:56|
|I don't know about a dedicated exit function.
Usually finishing code is appended after saving game or deleting map.
Since users tend to exit with Alt-F4 (task kill) it would be difficult to implement safely.
What is your intention?
|Kenny Je (kenny456)||09.10.2020 20:19|
I am working on update of this mod. It creates little cultivated field (as tracks) where you drive with vehicle. I already done function which delete those tracks after time you set. So tracks are being erased from older one. Problem is when user save game and then exit (not all tracks deleted). Those tracks (fields) are ofcourse saved by game engine itself but after reloading savegame i am not able to delete them. So i am looking for function which delete those tracks before exit while i have all positions in script. I know it will be not possible with alt+f4 but implement my code to click yes in exit menu would be great.
|Bilbo Beutlin (BBeutlin)||09.10.2020 23:25|
|Doesn't it work if you delete the tracks BEFORE saving?
Utils.prependedFunction( SavegameController.onSaveComplete , .. ) or ( SavegameController.onSave, .. )
Else you could investigate the 'SavegameController' table for further suitable functions.
|Kenny Je (kenny456)||10.10.2020 01:25|
|Yes, ican delete all tracks when savegame executes. Problem is when user save game and then continue play. All tracks will dissapear even if them have some time to dissapear.
|Bilbo Beutlin (BBeutlin)||10.10.2020 18:20|
|Then you must store the tracks temporarily before deleting and restore after saving.
|Kenny Je (kenny456)||12.10.2020 11:22|
|Yes, that's the only solution I've come up with too. I will try it.
Note: Log in to post. Create a new account here.