Difference between revisions of "Category:Troubleshooting"

1,137 bytes added ,  09:36, 15 June 2007
Activating a Container
imported>Haama
(Activate Self)
imported>Haama
(Activating a Container)
Line 51: Line 51:


==Activate Self==
==Activate Self==
When you script an object
When you script an object
#to [[Activate]] itself
#to [[Activate]] itself
Line 70: Line 71:
Activate player, 1
Activate player, 1
end</pre>
end</pre>
==Activating a Container==
If you meet all of these conditions:
#[[Activate]] a [[Container]], so that you run it's [[OnActivate]] block, that is:
<pre>YourContainer.Activate player, 1</pre>
#from an [[Object scripts|Object Script]] (and maybe a [[Magic effect scripts|Magic Effect Script]], but a [[Quest scripts|Quest Script]] or direct activation would be safe)
#when a scripted item is in it (even a [[Scriptname]] declaration is too much)
you will get a CTD upon activation. The easiest way around it is to place the script on another object (an [[Activator]], etc.) and activate it instead of the container. You can also use a [[Quest scripts|Quest Script]] to activate the container, as such:
<pre>scn YourOpenerQuest
ref  rContainerToOpen
float fQuestDelayTime
begin GameMode
  if (fQuestDelayTime != .01) ;to activate the container quicker
    set fQuestDelayTime to .01
  endif
  rContainerToOpen.Activate player, 1
  StopQuest YourOpenerQuest
end</pre>
and use this whenever you want to activate a container:
<pre>scn ActivatingScript
set YourOpenerQuest.rContainerToOpen to YourContainer
StartQuest YourOpenQuest</pre>


= Common Mistakes =
= Common Mistakes =
Anonymous user