Setting a property within a script?

Post » Tue Jun 19, 2012 2:56 am

What I have currently.
;set from the CK property editorcell property Destination auto;set (currently) from the CK property editor but would prefer to do it in the scriptfaction factPlayer property auto;elsewhere in the scriptif (Destination.GetFactionOwner() == factPlayer)   ;do stuff hereendif
Is it possible to get at the PlayerFaction without having to set it in a property in the Property Editor?

What I'm after is something like this
cell property Destination autofaction factPlayer property auto hiddenfactPlayer = (what goes here?)if (Destination.GetFactionOwner() == factPlayer)   ;do stuff hereendif

Does it even need to be a Property or would a variable suffice? Or even better, inline code to get the PlayerFaction and dispense with the need for a property/variable altogether?
User avatar
Jessica Colville
 
Posts: 3349
Joined: Wed Oct 18, 2006 6:53 pm

Post » Tue Jun 19, 2012 5:09 am

Properties can be written out in the script without having to add it from the property window, yes. All you have to do is just set the value afterwards from the property window.

Example

scriptname examplehere extends Objectreference;==========/;Properties;==========/Effect Shader property GhostFX auto;Property type → Property name you've chosen → auto

That's all there is to it.

factPlayer is the name of your Property.

You still need to choose what faction factPlayer will represent in the property window.

(I hope I got that right)
User avatar
Sarah Kim
 
Posts: 3407
Joined: Tue Aug 29, 2006 2:24 pm

Post » Tue Jun 19, 2012 4:05 am

Not quite - I know I can create the property within (by manually editing) the script, it's the setting of its value (through the property editor) I'm trying to avoid. I don't know if it's possible - maybe not :(
User avatar
sharon
 
Posts: 3449
Joined: Wed Nov 22, 2006 4:59 am

Post » Tue Jun 19, 2012 8:37 am

You can't fill the property from within the script itself.
User avatar
Jeneene Hunte
 
Posts: 3478
Joined: Mon Sep 11, 2006 3:18 pm

Post » Tue Jun 19, 2012 4:01 am

That's a shame - would make scripting a whole lot easier (less cumbersome) and a lot more powerful to boot.

Thx for the info.
User avatar
Gaelle Courant
 
Posts: 3465
Joined: Fri Apr 06, 2007 11:06 pm

Post » Tue Jun 19, 2012 4:06 am

The only propertys you can set for default are Integers, Booleans, Floats

Float Property MyFloat = 0.65 Auto
User avatar
Kate Norris
 
Posts: 3373
Joined: Mon Nov 27, 2006 6:12 pm

Post » Tue Jun 19, 2012 10:22 am

Faction SomeFaction = Game.GetForm(0x000000FF) as Faction;where 0x000000FF is the formid of the faction you want
http://www.creationkit.com/GetForm_-_Game
User avatar
Rachel Eloise Getoutofmyface
 
Posts: 3445
Joined: Mon Oct 09, 2006 5:20 pm

Post » Tue Jun 19, 2012 12:04 pm

That would work for "built-in" content (where the FormID is unlikely to change), but for mods the ID is based on the load order and will likely be different for each player.

Also, the PlayerFaction was just an example as the same could apply to anything - a cell, an object, an activator...

Seems that using the Property Editor is the only "safe" way to do it so I'll stick with that for now.
User avatar
Glu Glu
 
Posts: 3352
Joined: Sun Apr 01, 2007 5:39 am

Post » Tue Jun 19, 2012 8:17 am

I can't really think of any good reason to ever use http://www.creationkit.com/GetForm_-_Game, this included. It violates the principle that scripts shouldn't contain anything that is specific to any data files. At most, your scripts should only provide an interface that the Creation Kit can use to inject data file-specific information into your script, and that's what properties are for.

If you want to make assigning values to your properties easier, then use the editorIDs of the objects to which you want them to point as their names. That will allow the Creation Kit to "Auto-Fill" them all at the press of a button.

Cipscis
User avatar
Bethany Short
 
Posts: 3450
Joined: Fri Jul 14, 2006 11:47 am


Return to V - Skyrim