Jump to content

Quick Script/Quest question


Noggog

Recommended Posts

Just a quick question.

 

If I've got quest that's running a script, and it's in the middle of the script when I call stopquest on its quest, will it stop immediately where it is? or finish to the end and not start again?

Edited by Leviathan1753
Link to comment
Share on other sites

The script will keep running until the end unless you craft it not to. Eg.

 

 


If xxx == 1
	StopQuest myquest
	Return
Else
DoSomethingElse
Endif

 

Link to comment
Share on other sites

I have a related question concerning OBSE arrays. If I create an array and fill it in a script, and then the script stops, will the array be erased? I've been looking at a few different documentations and I didn't see much information one way or the other.

 

If it is deleted on script termination, how do I get a global array set up that will remain once that function ends?

 

As of now I'm using Pluggy arrays that are set to a global long variable, but OBSE arrays are their own type, and so I can't easily make them global.

Link to comment
Share on other sites

Generally, quest scripts are used to create globals as they are not attached to any references and can be checked and modified by anything. The quest script doesn't even have to have anything else in it, you could just make it a bunch of variable declarations if you wanted to.
Link to comment
Share on other sites

Quest variables will keep their values, no matter if the quest is running, has been stopped with StopQuest or has never started running in the first place.

 

Variables in Object scripts will also keep their values as long as the object exists. Enable / Disable do not affect the variables here either, btw.

 

Function scripts will destroy their Array_vars on exit, as they (function scripts) are designed to be single-use. Be careful here: function scripts do not destroy their String_vars automatically. You have to destroy them with sv_destruct. I suppose the same is true for Pluggy vars in function scripts.

Link to comment
Share on other sites

Quest variables will keep their values, no matter if the quest is running, has been stopped with StopQuest or has never started running in the first place.

 

Variables in Object scripts will also keep their values as long as the object exists. Enable / Disable do not affect the variables here either, btw.

 

Function scripts will destroy their Array_vars on exit, as they (function scripts) are designed to be single-use. Be careful here: function scripts do not destroy their String_vars automatically. You have to destroy them with sv_destruct. I suppose the same is true for Pluggy vars in function scripts.

 

Unfortunate, as I would like an array that's persistent. I don't want my arrays to be scrapped when my script ends. Is there any way to stop the destruction of the Array_vars on script exit?

Edited by Leviathan1753
Link to comment
Share on other sites

As whalecakes said, put your arrays in a quest script and have the functions use them instead of local arrays.

 

Scn MyQuestSCRIPT
Array_var MyArray01
Array_var MyArray02

 

Scn MyFunction
Begin Function {}  
Let MyQuest.MyArray01 := ar_construct array
Let MyQuest.MyArray01[0] := Apple
Let MyQuest.MyArray01[1] := MyQuest.MyArray02[99] ;;; whatever MyQuest.MyArray02[99] may be
end

Link to comment
Share on other sites

  • Recently Browsing   0 members

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