Difference between revisions of "Crashes"
→MessageBox on a Terminating Script: examples
imported>Dev akm (→Activating a Container (including NPC): add MessageBox CTD) |
imported>Dev akm (→MessageBox on a Terminating Script: examples) |
||
Line 87: | Line 87: | ||
== MessageBox on a Terminating Script == | == MessageBox on a Terminating Script == | ||
You will very likely get a CTD if you open a MessageBox just before a script terminates. | You will very likely get a CTD if you open a MessageBox just before a script terminates. For example, if you have some scripted condition on an item that will force the player to drop the item, don't use a MessageBox in that condition. | ||
If PCVampire | |||
MessageBox "You can't use this item while you're a vampire." | |||
Player.UnEquip ItemID | |||
Player.Drop ItemID 1 | |||
EndIf | |||
It seems that the script terminates after the drop, but the MessageBox is still active so you get a CTD. | |||
You can avoid this particular case by using Message instead of MessageBox: | |||
If PCVampire | |||
Message "You can't use this item while you're a vampire." | |||
Player.UnEquip ItemID | |||
Player.Drop ItemID 1 | |||
EndIf | |||
Which doesn't cause a CTD. | |||
[[Category:Troubleshooting]] | [[Category:Troubleshooting]] |