Variable definitions and "Started disabled" activato

Post » Sun Jan 24, 2010 7:11 am

Three quick questions that I'm not in a position to test myself right now:

- I know "onLoad" won't run on a "start disabled" activator until it's enabled (either directly or through an enableParent). But can I define variables in a disabled object, set those variables to values remotely, then enable the object and have its onLoad use those values to do something (in this case reposition the object)?

- Will an object "disabled" and then later re-"enable'd" run its onLoad function again?

- Can I setPos and getPos a disabled object?

I'm trying to build a roomful of activators that will not only appear when their enableParent is enabled, but will also move with their enableParent.

Thanks in advance for any answers you can provide.
User avatar
Alessandra Botham
 
Posts: 3440
Joined: Mon Nov 13, 2006 6:27 pm

Post » Sun Jan 24, 2010 3:48 am


- Can I setPos and getPos a disabled object?


I believe this one is yes (itll be clear if it fails tho), but on the others, you're touching just slightly into the realm of things which I have not tried.
User avatar
tegan fiamengo
 
Posts: 3455
Joined: Mon Jan 29, 2007 9:53 am

Post » Sun Jan 24, 2010 8:27 am

Three quick questions that I'm not in a position to test myself right now:

- I know "onLoad" won't run on a "start disabled" activator until it's enabled (either directly or through an enableParent). But can I define variables in a disabled object, set those variables to values remotely, then enable the object and have its onLoad use those values to do something (in this case reposition the object)?

- Will an object "disabled" and then later re-"enable'd" run its onLoad function again?


OnLoad blocks run EVERY time the 3D object is loaded into memory so your scripts need to reflect the possibility of getting run multiple times.

- Can I setPos and getPos a disabled object?


Yes.

I'm trying to build a roomful of activators that will not only appear when their enableParent is enabled, but will also move with their enableParent.


You would need to collect every reference and move all of them, moving just their parent will not move all of the children -> but since this is a pre-set up situation you already know who all of the children are just reference them and move them with the parent.
User avatar
Trish
 
Posts: 3332
Joined: Fri Feb 23, 2007 9:00 am

Post » Sun Jan 24, 2010 8:07 am

To confirm, though: does it "load the 3d object into memory" again if I disable and re-enable it? Is it likely to do this within a single interior cell if I don't change zones?

My current thinking for the move-a-group code is that every object has the same script. When I want to move the enableParent to position X, Y, Z, I first run a script to determine its position relative to said coordinates - i.e. "I'm at X position 500 and I've been told to move to position 750, so store 250 in xRel" - and store it in variables in the enableParent. Then I switch on the enableParent and each child triggers its onLoad, thereby running the same script, which essentially checks getEnableParent->xRel/yRel/zRel and moves itself relatively, too. I'll of course need a few state variables and some fancy footwork to make sure this doesn't occur again when the player leaves the area and returns or other unwanted onLoad calls, but I think this will do a decent job of allowing me to pick from a large number of premade object clutter sets and place them in a room of my choosing with scripts.

I have 5 rooms this stuff can go in and 96 possible groups of items. Just having them sit still and duplicated five times in each room would kill me and kill the engine, I'd wager. Being able to spread out my groups all over the map will make things much nicer.
User avatar
Liii BLATES
 
Posts: 3423
Joined: Tue Aug 22, 2006 10:41 am

Post » Sat Jan 23, 2010 10:07 pm

To confirm, though: does it "load the 3d object into memory" again if I disable and re-enable it? Is it likely to do this within a single interior cell if I don't change zones?


tbh it sounds like you should be scripting at this point and seeing what works vs what doesn't. Some things - - when they fail - - you see it. And some things fail for different reasons.
User avatar
Bek Rideout
 
Posts: 3401
Joined: Fri Mar 02, 2007 7:00 pm


Return to Fallout: New Vegas