Jump to content

Using setav on Confidence in an object script causes crashes.


CountFuzzball

Recommended Posts

The section highlighted in bold above seems the most probable cause. I took a look at the '101 The Collector' mod again that I drew my inspiration for the cleanup code from and the way the author had it set up. They used 'removeme' at the end of the script to remove the object as opposed to 'target.removeitem', as well as disabling the object, doing the business, then enabling the object again. I tried implementing a similiar such thing in my script and voila, no more crashes when enslaving raiders.

 

The phrase 'Standing on the shoulders of giants' comes to mind. Many thanks, pklelss and rickerhk, for the helpful comments, they certainly got me thinking differently!

 

Question is, what is the difference between calling 'disable' in an object script and target.disable? I tried target.disable.. no dice, the raider didn't appear at the marker I had set up using target.enable, yet using 'disable' made the raider disappear, and the 'enable' at the end of the block ran fine.

Link to comment
Share on other sites

Calling a function in an object script, without a reference specified, implies the reference to be itself - the object that the script is running on.
if a ref variable 'target' points to the same object, then target.disable should perform the same thing. Assuming the object is loaded in the cell with the player.

If not, something odd is going on and one of the things I would do is start prefixing my variables so there's no chance they might be used somewhere in the scripting engine. Instead of 'target', I would use 'rTargetREF'. Just helps to self document the script since I automatically know it's a REF variable.

Yeah - removing scripted items can cause CTD, depending on what it does. I must have missed the part where you mentioned doing that. 'removeme' is better - you just have to make sure the 'removeme' function is guarded so there is no chance that it can be called again in the event the script runs another frame.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...