Jump to content

BKnight49

Supporter
  • Posts

    4
  • Joined

  • Last visited

Everything posted by BKnight49

  1. I appreciate all the replies but Reddit sorted me out in about 5 minutes. As someone said, I did forget to pass the arguments when calling the functions but I actually didn't need them in the first place since making the array a Property is global from the start unlike other programming languages that I'm used to: Also, thanks for pointing out the fact that I hadn't changed the state. The way I work with scripts is to do it in chunks rather than all at once so I got to this problem and tested before actually finishing the rest of the script. I've now got it working completely fine and as intended though! Here's the full script for anyone who needs it in the future: Scriptname activateLightsScript extends ObjectReference ObjectReference[] Property lightReference Auto Const ObjectReference[] Property lightReferenceOFF Auto Const Sound Property soundReference Auto Const Sound Property soundReferenceOFF Auto Const ObjectReference Property activateMusic Auto Const int currentState Event OnActivate(ObjectReference akActionRef) activateMusic.Enable() if currentState == 0 EnableAll() else DisableAll() endIf EndEvent Function EnableAll() int currentElement = 0 while (currentElement < lightReference.Length) lightReference[currentElement].Enable() currentElement += 1 Utility.Wait(0.4) soundReference.Play(self) endWhile currentState = 1 EndFunction Function DisableAll() int currentElement = 0 while (currentElement < lightReference.Length) lightReference[currentElement].Disable() currentElement += 1 Utility.Wait(0.4) soundReferenceOFF.Play(self) endWhile currentState = 0 EndFunction
  2. So, I'm trying to make a VERY simple script which toggles lights by getting the ObjectReference from an array and then enabling/disabling said light before waiting for 1 second and then repeating until all items in the array have been processed. I've added 7 objects to the array(s) via the Properties window inside of the CK > Select reference in render window. However, trying to pass my array to the function throws the error "Argument 'lightReference' / 'lightReferenceOFF' is not specified and has no default value". Also, yes I'm aware that there are easier ways to do this but I'd like to experiment with the code and implement it in my way since I'd like the lights to have a delay before turning on/off and also for me to not have to blatantly copy some code since that wont help me get better. You could probably say I'm a near-beginner since I'm used to other coding languages and understand the basics too. Anyway here's my code: Scriptname activateLightsScript extends ObjectReference ObjectReference[] Property lightReference Auto Const ObjectReference[] Property lightReferenceOFF Auto Const int currentState Event OnActivate(ObjectReference akActionRef) if currentState == 0 EnableAll() else DisableAll() endIf EndEvent Function EnableAll(ObjectReference[] lightReference) // Offending lines int currentElement = 0 while (currentElement < lightReference.Length) lightReference[currentElement].Enable() currentElement += 1 Utility.Wait(1) endWhile EndFunction Function DisableAll(ObjectReference[] lightReferenceOFF) // Offending lines int currentElement = 0 while (currentElement < lightReferenceOFF.Length) lightReferenceOFF[currentElement].Disable() currentElement += 1 Utility.Wait(1) endWhile EndFunction Any help would be greatly appreciated! Thanks :smile: EDIT: I noticed that both functions were enabling lights. That was just a minor typo.
  3. So, I've spent ages trying to make and upload my mod. It installs fine when I download it manually, and install it using the NMM but I can't go onto the mod page, press Download through NMM as it just brings up a black box with nothing on it. I've tried everything and it still says that. What am I doing wrong? This is what shows up (sorry for the large photo, 4K monitor): EDIT: So, apparently you can't download it through the manager until you publish the file. This should really be something that is made a lot more clear for noobs. http://i.imgur.com/SjQncvn.png
×
×
  • Create New...