The Exorcist101 Posted January 21, 2009 Share Posted January 21, 2009 Hello to everyone. I need some help from someone who is very knowledgable with scripting and what scripting methods can cause a game to crash. I am currently designing a new disguises mod for Oblivion. Before you say that there are already mods that add disguises in existence, this one is designed to not conflict with other mods. It uses a quest script to detect whether a disguise is equiped rather than a script directly attached to an existing piece of armour for example. This mod also doesn't add disguises for sale in a shop, like another disguise mod I know (I won't mention names). This mod also uses a more realistic method of detection and adding a bounty if discovered, unlike yet another disguise mod I know (no names again). The mod is well underway and the guards portion is nearly complete. There is just one problem. When the mod is installed, the game seems to experience an increase in the number of CTDs (crashes to desktop), mostly when sneaking, jumping or right after I equip or unequip an armour piece linked to the disguise script. The script used for the Anvil Guard Disguise quest is attached here: Can someone please examine this script and point out what may be causing these extra crashes? Maybe even suggest a solution? All the other guard quest scripts use this same script except with the relevant factions and armour requirements in place. Your help will be greatly appreciated. -The Exorcist101 BTW, on a side note, can anyone tell me the minimum version of OBSE required to run this script. Link to comment Share on other sites More sharing options...
Vagrant0 Posted January 22, 2009 Share Posted January 22, 2009 Your CTDs might be due to how your script is being run. You have the script constantly checking every loaded reference in the cell, it isn't a problem when you have this check being run rarely, or only when something is activated, but can be a fairly large problem when you have it being done every frame, with multiple checks within that single frame. You may want to take a step back for a moment, and considder an alternative method of doing what it is you want to do. It might be helpful to work without using any of the OBSE commands as a start, so that you know that the script is working, and then only using those OBSE commands when what you want cannot be accomplished otherwise. For instance, rather than having a script which checks every loaded reference in the cell until it comes actoss an actor who is not in the guard faction, who is alive, and who sees the player, considder using an activator which is occasionally moved to the player's location, casts an area based, scripted effect spell, which has no visuals, is not hostile, and performs this check on a seperate script which then changes a variable in the quest script to say that the disguise has been seen through. It's a little more setup work, but should prove to be a bit easier to manage, and a bit more stable. Just a simplebegin scripteffectstart set self to getself if self.isactor != 1 return else if self.getisdead == 1 return else if self.getinfaction AnvilGuards == 1 return else if getrandomprecent >= 90 <alarm on detection stuff you want run on the NPC> else return endif endif endif endif endYou can then have the quest script send out that pulse every 20-30 seconds when the player.getdetected == 1 and it should be a bit easier to control since you would only be checking all the actors within a specific radius around the player, rather than every object (statics, disabled objects, every NPC, tree, plant, container, door, and activator) within the 3x3 cell area normally active around the player. And, as you are only performing this action every 20-30 seconds, there would be only a brief and minor performance hit. And, you can simplify things by only having 1 script which casts a check based on what disguise is worn, rather than have multiple quest scripts for every disguise. Essentially, try to simplify your script so that less is running in a single frame, and so that you are taking advantage of vanilla systems, rather than relying on OBSE functions to do all your work. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.