How to modify quest variables from an object script

Post » Tue Nov 20, 2012 2:11 am

I have an object script who need to read and modify an quest variable.
I will replace one object with another and thought an quest variable would be an nice way to transfer an needed value as I could also use other quest variables for some property values.

Think this is easy but not seen any good examples.

Also how do I delete unneeded scripts?
User avatar
Mrs. Patton
 
Posts: 3418
Joined: Fri Jan 26, 2007 8:00 am

Post » Mon Nov 19, 2012 11:09 am

What do you mean by "quest variable"? An alias or a papyrus variable belonging to the script attached to your quest? Variables are only visible from the script itself.

Anyway, the procedure is the same: in your object script, declare a Quest property (if you want to modify the stage for example, or call a function you have defined on this quest script) or a ReferenceAlias property (if you want to modify an alias). Then, in the CK, attach your quest/alias to this new property.

Finally, to delete scripts, just delete their files (both the .psc source file and the compiled .pex) in the windows explorer. Then in CK, right-click the scripts windows and click "refresh all".
User avatar
Lisa Robb
 
Posts: 3542
Joined: Mon Nov 27, 2006 9:13 pm

Post » Mon Nov 19, 2012 10:50 pm

Thanks for the the info that you can just delete the filenames, was not sure if it was correct.

the variables are three properties in an quest script. one int and two float.
I can naturally use functions to return the variable as in

Scriptname plantscript extends Quest float Property growtime = 24 Auto float function getgrowtime ()return growtimeendfunction


However I'm not able to get this from the object script
Has tried
plantscript.growtime
plantscript.growtime.getvalue()
plantscript.getgrowtime()

has also tried to set the quest as an quest property and link it
quest property plantquest1 auto

however I can not find how to link this however I know it's simple
User avatar
Rachel Hall
 
Posts: 3396
Joined: Thu Jun 22, 2006 3:41 pm

Post » Mon Nov 19, 2012 10:43 am

What you did would work for global functions. But here those properties and functions are instance members. SO you first need to get an instance of this script. Here is how to do this:
* First of all you need a quest with this script attached to it.
* Your object script itself must also be attached to some object (magic effect, weapon, key, quest, etc).
* Add a new property on your object script whose type will be "plantscript".
* Open the object where you attached your script and click the "properties. Assign your quest to this new property.
* VoilĂ  !
User avatar
Mark Churchman
 
Posts: 3363
Joined: Sun Aug 05, 2007 5:58 am

Post » Mon Nov 19, 2012 11:06 pm

it works :)
Thanks
User avatar
NEGRO
 
Posts: 3398
Joined: Sat Sep 01, 2007 12:14 am


Return to V - Skyrim