Home   Help Search Login Register  

Author Topic: [SOLVED] disableUserInput true and retry option (help needed for "The Carrier")  (Read 2405 times)

0 Members and 1 Guest are viewing this topic.

Hello people,
as some of you may already know, I am actually working to "The Carrier" mission that, some time ago, has already been posted for beta testing and now it has been deleted by me because it was getting old and it needed major update thanks to the useful hints provided by kind OFPEC users who made me realize update was necessary.
   Allthough almost everything is running fine, I am having problem with disableUserInput true before cutscenes and before certain gameplay part which needs to be disableUserInput'ed for a while and then can turn false thus allowing player to move again. Exactly it happens that, both in "Editor environment" and in "OFP environment", sometime disableUserInput true works and some other time it doesn't; when disableUserInput true works, it happens that, if I die or if I press "Retry" button because I need to, disableUserInput true stops working again.
   I already checked, of course, that every single script, which has disableUserInput true, has also disableUserInput false and between disableUserInput true and disableUserInput false there are no other running scripts with any of disableUserInput command.
   I use OFP G.O.T.Y. 1.96 with no mod and I am going mad because my mission needs disableUserInput true to promptly work every time it should be working. Mission is very near completion but this tedious thing keeps me 10 meters away from the goal.
Thank in advance to whoever is willing to help me.
« Last Edit: 29 Oct 2011, 12:19:44 by Guido89 »
? (this == thinkable) : this = scriptable

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
You have encountered the OFP "load bug". This bug causes unit states to reset to the default after a game is loaded. Examples include, "setface" units reverting to their default face after a reload, Scud launchers having missiles even though they were launched before the game was saved then reloaded and many others. Fortunately, I found a work around that takes advantage of "time" also reverting to zero after a game is loaded. I made a script called "code_at_load.sqs" that will reset parameters as soon as a game is reloaded. Attached is the script and instructions on using it. If you need any help implementing it, let me know on this thread or via PM.
« Last Edit: 07 Oct 2011, 18:38:17 by Raptorsaurus »

Hello, Raptorsaurus!
   At first glance, this script seems to be what I may need to fix my issue but I will give you further details later, after implementing and testing it in my mission because it looks a bit complex and, at the moment I am writing to you, I can't give it any further attention inside OFP.
   Anyway, no matter whether this script will work or not, I would like to thank you since now for providing me your help.
? (this == thinkable) : this = scriptable

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Guido, If you upload the camera script during which you need to disable the user input, I could figure out from that how to implement the code_at_load script to best work with that script. I tried to download "The Carrier" mission to see if I could figure out how to implement it, but the link to download it no longer works.

Quote
Guido, If you upload the camera script during which you need to disable the user input, I could figure out from that how to implement the code_at_load script to best work with that script.

Hello Raptorsaurus, thank you again for giving me further assistance. I tried to implement your code by myself but it didn't work (probably I run it from wrong place and/or at wrong time). I am going to send to you custom script via PM with temp mission.sqm file. I hope you can help me because it is very annoying that the mission's making process is stuck at 99% without any chance to go further!

Quote
I tried to download "The Carrier" mission to see if I could figure out how to implement it, but the link to download it no longer works.

Yes, you are right! I deleted it because it became old and now I updated my mission. Anyway, the feature that is giving me problem with disableUserInput true, it was not present in the earlier version of "The Carrier" because it is something I added in the upcoming version.
? (this == thinkable) : this = scriptable

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Guido,

I made a new script based on the "code_at_load" principle called "disableUser.sqs". It is simplified to only handle disableUserInput. Attached is the demo mission modified to use this script. I modified all your scripts that used the command <disableUserInput true> and <disableUserInput false> to use this script instead. To disable user input using this script you now use <[] exec "disableUser.sqs">. To re-enable the user input you now use <RPT_userDisabled = false>. That will tell the script to re-enable the user input and end. See the attached updated version of your demo.

OK, now that I actually tested it, I found some bugs; OFP has issues with "diableUserInput" other than just the loading a saved game bug. The version I left for you to download fixes it some, but still there are some other problems. I will work on this more this weekend.
« Last Edit: 26 Oct 2011, 10:17:29 by Raptorsaurus »

Thank you for your efforts!
I downloaded script before you tested it and I found error about missing " " in [] exec disableUser.sqs but it was easy to fix and I fixed by adding " " and having [] exec "disableUser.sqs" as command.

First time I tried your script, it didn't worked as expected because, allthough disableUserInput was set to true, there was no reversing command and game was frozen. So I added "disableUserInput false" line before "Exit" line in "disableUser.sqs" script and it worked flawlessly.

So, after a bit of tweaking (which now I see it is the same tweak you did after testing script by yourself and finding bugs), your script worked flawlessly at beginning and I ran many test (autosaving and retrying over and over) but after, about some minutes of continuous testing, it stopped working. So I quitted down OFP and tried to execute script again but it didn't want to work again... This is very weird bug!

Thank you very much for dedicating this issue some time of your weekend!


#EDIT: Don't quote the whole previous post you're replying to...     h-
« Last Edit: 26 Oct 2011, 16:53:56 by h- »
? (this == thinkable) : this = scriptable

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Guido,

Yes, I forgot to put the quotes in the <exec "disableUser.sqs"> and I forgot to put <disableUserInput false> before the exit. But there are still some issues with this command. When I first run the mission in the editor it works, but then after running it and then ending it, the second time I select "preview" in the editor, it does not work. Then If I end the mission again, and run it in the editor, it works again.  ???

I even tested a version where I used triggers to do the <disableUserInput true/false>. That version still sometimes refuses to disable or re-enable the user input. This bug is beyond the "load savegame bug". Maybe this is an editor bug. Perhaps a PBO'ed version will work OK, I will test a PBO'ed version later.
« Last Edit: 26 Oct 2011, 10:29:28 by Raptorsaurus »

Problem solved!!!  6/6 attemps at testing were all succesful! :D

   In my script, I just add a little delay time (~0.5) between "saveGame" command and "[] exec "disableUser.sqs" command.
   Then, when it is needed to reload savegame, player is forced to end mission ("Loose" trigger + "forceEnd"  command) and game takes the player back to OFP main menu.
   This way player has to press "retry" from mission selection menu and it will load from where "saveGame" command has been executed and it will also run "[] exec "disableUser.sqs" because of the little delay I put and because Raptorsaurus's script works 100% fine under said circumstance.

Thank you so much Raptorsaurus :clap: I owe you a script for your next mission!  ;)
? (this == thinkable) : this = scriptable

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Guido,

I'm glad you got it working and I'm glad I was able to help. You don't owe me anything, though inclusion in your mission acknowledgements would be nice. :D

Quote
though inclusion in your mission acknowledgements would be nice.  :D

Sure!!!
? (this == thinkable) : this = scriptable