gunslinger6792 Posted May 27, 2014 Share Posted May 27, 2014 I'm not getting much help yet in the general forums so I figured I'd come here seeing as any of us here are a tad more experienced so hopefully someone can help me. I'm trying to get a script to work that a friend gave me to sort ammo. I want my 5.56mm ammo to go into an ammo box that's ID name is houseammobox4. The geck gives me a warning saying its an invalid reference that only object references and reference variables are allowed in that context. Can anyone here help me out? I've set the ammo box to persistent but still no joy.Short PlayercountSet PlayerCount to (Player.GetItemCount Ammo556mm)Player.RemoveItem Ammo556mm PlayerCount 1houseammobox4.AddItem Ammo556mm PlayerCount 1 Link to comment Share on other sites More sharing options...
Belthan Posted May 28, 2014 Share Posted May 28, 2014 In addition to being persistent, the ref must have a unique name. By default, a REF's name is not unique, and is the same as the base form. Common practice is to add "REF" to the end of the base form name when the REF needs to be used in a script. So, if the base form is "houseammobox4", rename its REF in the Cell View to "houseammobox4REF", and then use that name in the script: houseammobox4REF.AddItem Ammo556mm PlayerCount 1 Link to comment Share on other sites More sharing options...
gunslinger6792 Posted June 20, 2014 Author Share Posted June 20, 2014 Ok so after a long hiatus I've come back to this and tried fixing it. I've set a unique ref name to my ammo box using the script above and it still won't work. I should have also mentioned that the script I'm using above is being attached to a terminal inside the text options edit page thingy. (I know I'm being super techincal here.) Anyway any help would be greatly appreciated. Link to comment Share on other sites More sharing options...
Belthan Posted June 21, 2014 Share Posted June 21, 2014 You need to rename it in the cell view too, not just in the script. If that's not the problem, there may be an error in the script that I'm missing. And here's where the fun starts... Script compiler warnings are disabled in the FNV GECK. If you edit a script in the script editor and you have an error, you at least get a warning that the script hasn't been saved when you try to close the window. Finding the bug is a matter of trial and error, but at least you know there's a bug. However, if you have a bug in a script that doesn't use the script editor (like terminals and dialog topics), it just fails silently. You can see the script code is still there in the text box, but it doesn't compile so it doesn't run in-game. I know, $#%@^!. What I do to debug result scripts for terminals is create a dummy script with the script editor that just has an empty GameMode block. When I want to check the terminal script for errors, I copy the terminal script to the dummy script, hit the save button, and try to close the window. If the window closes, it means the script compiled without errors. If I get a message saying "Do you want to save", then there is a bug in the script that the text box in the terminal window didn't tell me about. I know, BLOODY $#%@ &%&$*!!!! SCN DummySCRIPT BEGIN GameMode ; script you want to test goes here END Link to comment Share on other sites More sharing options...
Recommended Posts