EDIT : Ok well, I'm a idiot, I just forgot to change the script in my helmet, so I had the previous one. I still have problems relative to the script logic to solve, but it in fact works. I let the topic up because some modders could be interested in my scripts, so I gladfully let anyone take them without restrictions. Feel free to suggest some improvements also if you think of any.
EDIT 2 : Scripts fixed, don't need anymore. Topic left for history purpose. Files attached not updated though. If you want it send a PM and I will send it to you.
So I wanted to script my very own Ranger Helmets Nightvision mod, then I followed this tutorial by cipscis : http://www.cipscis.c...keypresses.aspx which is awesome.
BUT. In fact I went in some sort of a wall concerning the detection of a held hotkey.
The part for which the key is just pressed works wonderfully (I'm gladfully sharing it for those who wants to learn/use it for their own mods - attached files : DurielNormalRangerNightVision.txt).
But the part for the held key in this tutorial doesn't work, or at least I can't make it work. My idea is to make a single tap on N give the player a red night vision mode, and with a prolonged pressure on the same key, give the player a orange powered night vision mode for the very dark places or in case they use Darker Nights (like me).
Here is the entire code of my script - and in attached files also : DurielPoweredRangerNightVision.txt) :
So globally, when a helmet is equipped, it sets a control variable to 1, which allows the game to display a message in case the player do not have their helmet equipped, or when equipped to activates all the functions in the middle GameMode code block. Then when unequipped, the control variable is reset to 0, as are the other control variables and the ISFX/actor value.
Is my logic here correct ?
I may have done a mistake using cipscis' code, but I'm sure I rewrite it correctly. I have a question about one part though :
I see the timer control variable is reset to 0 each time it passes over 0, so in my mind, it's never over 0 and it can never activate the function under the prolonged pressure code part. Maybe I just don't quite understand the logic here. I'm somewhat used to scripting, but this time after having corrected all my mistakes, this one is stiil there and this is killing me.
Where could lie my mistake here ?
I thank all modders who pass here and give me a helping hand, in advance.
Edited by Duriel7, 23 February 2021 - 04:51 PM.