What causes a script to crash the game?

Post » Fri Feb 18, 2011 8:48 pm

I've written a scripted spell that summons a mount to the player, and then forces the player to activate the mount, which in turn has a script on it. Not sure if that's important. It's got about a 1 in 5 chance of crashing the game when it's cast.

But it's peculiar. If I can successfully cast it once after loading, then it seems I can cast it a million times in a row after that without fail. It's just the initial cast after Oblivion is loaded that is the shaky territory. I don't know if this is a coincidence or what.

But I was hoping for tips on just some general things that would make my script crash the game.
User avatar
djimi
 
Posts: 3519
Joined: Mon Oct 23, 2006 6:44 am

Post » Sat Feb 19, 2011 5:03 am

Hmmm, it 'could' be the mount you are summoning then. Does it have rather large textures, or is it a 'custom' mount? If your computer is busy when its summoned, and thus loaded into memory, it might cause a crash. But once loaded, it would load again without problems. At least that is what I am thinking without seeing any of your scripts. Bad scripting can cause problems too.
User avatar
Laura Elizabeth
 
Posts: 3454
Joined: Wed Oct 11, 2006 7:34 pm

Post » Fri Feb 18, 2011 11:59 pm

Hmmm, it 'could' be the mount you are summoning then. Does it have rather large textures, or is it a 'custom' mount? If your computer is busy when its summoned, and thus loaded into memory, it might cause a crash. But once loaded, it would load again without problems. At least that is what I am thinking without seeing any of your scripts. Bad scripting can cause problems too.


Thanks! In my case I do believe it was bad scripting. Because my mount is just a regular ol' vanilla bear. I tweaked a couple things and I've successfully mounted-after-loading twenty times without a crash. I think I had my script fighting itself by two different If blocks trying to do the same thing at the same time.
User avatar
Brιonα Renae
 
Posts: 3430
Joined: Mon Oct 22, 2007 3:10 am

Post » Sat Feb 19, 2011 10:15 am

Hmmm, it 'could' be the mount you are summoning then. Does it have rather large textures, or is it a 'custom' mount? If your computer is busy when its summoned, and thus loaded into memory, it might cause a crash. But once loaded, it would load again without problems. At least that is what I am thinking without seeing any of your scripts. Bad scripting can cause problems too.


I spoke too soon. I did improve my script and reduced the crashes severely. But there was still a 100% crash probability for the following: You've booted the computer, loaded Oblivion for the first time since boot, and then cast the spell. Crash. But if you loaded up Oblivion again, you can cast it no problem. So you're right, it's got to do with it (and maybe Oblivion itself) not being in memory yet. Specifically, it's a polymorph bear spell. Everything appears to function beautifully, except for this crash issue.

I came up with a clunky solution. I used the OBSE GetGameRestarted function in the polymorph spell. If the function returns true, then instead of the typical casting, I make it load an invisible version of the bear 5000 clicks away from the player. That way the bear will load and not immediately be activated causing a crash. I've rebooted the computer and started Oblivion then cast it three times in a row. It works. But I hate that solution. It means that every first-cast of the polymorph spell will result in failure (on purpose). And it might not even be 100% because that first cast causes the game to pause for just a split second like it's trying to crash again.
User avatar
Bereket Fekadu
 
Posts: 3421
Joined: Thu Jul 12, 2007 10:41 pm


Return to IV - Oblivion