Reset Moveable Items

Post » Wed Apr 27, 2011 1:07 am

I thought the game did this automatically, but after testing it out for quite a while it seems that items stay wherever you put them.

For my new mod I need to reset havock items some way. I could use a script for every single item, but that seems like overkill.

Anyone know a simple way that I can ensure everything in a worldspace returns to it's editor location when the player leaves the area?
User avatar
Rebecca Clare Smith
 
Posts: 3508
Joined: Fri Aug 04, 2006 4:13 pm

Post » Wed Apr 27, 2011 2:27 am

I remember a mod that does exactly what I'm trying to do, but I can't find it anywhere. The mod added a carnival game where you knock down bottles, and then you could set them back up. That's what I need to do.


Here's what I'm trying to accomplish:

1. I need to link any number of havok objects to a single reference that can effect each linked ref through a script.
[img]http://dl.dropbox.com/u/2961514/Help%20%26%20Tutorials/_01.jpg[/img]

2. The objects should work as normal, so the player can move them, or shoot them around the area.
[img]http://dl.dropbox.com/u/2961514/Help%20%26%20Tutorials/_02.jpg[/img]

3. Then, once the player has left the area (or an activator is triggered), they reset back to their editor locations.
[img]http://dl.dropbox.com/u/2961514/Help%20%26%20Tutorials/_01.jpg[/img]


I found a function "Reset3DState" that sounds like what I need, but I can't get it to work.
I've even tried attaching a script to each individual object (making them Activators - which I don't want to do), and it does nothing.
Since I can't get it to work on a single object, I haven't even tried writing a script that would send that command to every linked object yet.
I'm really stuck.

scn 000WGxHavokResetSCRIPTshort DoOnceref rMyselfBegin GameMode	If (DoOnce != 1)		set rMyself to GetSelf		set DoOnce to 1	EndIfEndBegin OnActivate	rMyself.Reset3DState;	Reset3DState rMyself    - tried it this way tooEnd


Also tried just this...
scn 000WGxHavokResetSCRIPTBegin OnActivate	Reset3DStateEnd


I've tried this so many ways, but I don't want to bombard you with an essay. I figured I'll put it out there, and I'm sure you can all understand what I'm trying to do here. I just hope someone can help.
User avatar
Richard
 
Posts: 3371
Joined: Sat Oct 13, 2007 2:50 pm

Post » Wed Apr 27, 2011 4:15 pm

I would wager you'll have to make a generic script to put in each object, then adjust the MoveTo coordinates for each object so it goes back to where it should be once the player has left the area.

Maybe something like:
ScriptName Whatevershort PlayerIsNearshort NearOnceBegin GameMode  if (NearOnce == 0) && (player.GetInCell Cellname == 1)    set PlayerIsNear to 1    set NearOnce to 1  endif  if (PlayerIsNear == 1) && (player.GetInCell Cellname == 0)    Reset3DState    Disable    MoveTo PlacementMarker x x x   ;***** where x's are the x, y, & z coords offset from your parent xmarker, different for each object    Enable    ;***** can also try using SetPos and SetRot commands to replace the object    set PlayerIsNear to 0    set NearOnce to 0  endifEnd


Only other thing I can think of, if you can't get their havok to reset and get them standing upright again, is to disable, mark for delete, and PlaceAtMe a new copy of the object each time.. though that's very dirty modding and will bloat the savegame over time if there's a lot of objects.
User avatar
lexy
 
Posts: 3439
Joined: Tue Jul 11, 2006 6:37 pm

Post » Wed Apr 27, 2011 4:59 pm

Does http://geck.gamesas.com/index.php/ResetInterior do the trick for this? The documentation is rather incomplete and I don't have Fallout 3 installed at the moment so I can't test it, but it sounds like it would be appropriate.

Cipscis
User avatar
Peter lopez
 
Posts: 3383
Joined: Mon Sep 10, 2007 5:55 pm

Post » Wed Apr 27, 2011 4:09 am

How about a quest script that has a DoOnce that gets the starting x,y,z POS and X, Y, Z angles of each of the objects, then just resets them when the Player leaves?
User avatar
jess hughes
 
Posts: 3382
Joined: Tue Oct 24, 2006 8:10 pm

Post » Wed Apr 27, 2011 2:13 am

How about a quest script that has a DoOnce that gets the starting x,y,z POS and X, Y, Z angles of each of the objects, then just resets them when the Player leaves?


That is what I used in my scripts to reset target objects. I don't have Fallout 3 installe don this laptop, so I don't have the code, but basically in your GameMode block the first thing is a DoOnce flag that stores the objects coordinates/angles into variables.

Then you can use an OnLoad block or some other trigger to reset them back to the stored location.
User avatar
Hannah Whitlock
 
Posts: 3485
Joined: Sat Oct 07, 2006 12:21 am

Post » Wed Apr 27, 2011 10:41 am

Thanks for all the suggestions! These are some really great solutions.

So, since there is no way to attach a script to a havok object, and there's no way (that I know) to run one script that would do this for every object, what I'll have to do is use a "Custodian" x-marker for every single object...

PRO: It will work
CON: I might have to link over 100 objects to over 100 scripted Xmarkers - all persistent references. :shakehead:

Here's the script so far:

scn HavokCustodian		; The Linked ObjectRef	rObject		; Starting Postionfloat	iPosXfloat	iPosYfloat	iPosZ		; Starting Rotationfloat	iRotXfloat	iRotYfloat	iRotZshort	bDoOnceshort 	bResetOk	; 0=nil / 1=Reset / 2=DoneBEGIN GameMode	IF (bDoOnce != 1)		Set rObject GetLinkedRef		Set iPosX to rObject.GetPos X		Set iPosY to rObject.GetPos Y		Set iPosZ to rObject.GetPos Z		Set iRotX to rObject.GetAngle X		Set iRotY to rObject.GetAngle Y		Set iRotZ to rObject.GetAngle Z		Set bDoOnce to 1	EndIf	; This next part I have a question about...	; Can objects be moved while the player is in a different cell?	IF (QuestID.bReload == 1) && (GetInSameCell player != 1)		Set bResetOk to 1		IF (bResetOk == 1)			rObject.Disable			rObject.SetPos X iPosX			rObject.SetPos Y iPosY			rObject.SetPos Z iPosZ			rObject.SetAngle X iRotX			rObject.SetAngle Y iRotY			rObject.SetAngle Z iRotZ			rObject.Enable			Set bReset to 2		EndIf		IF (bResetOk == 2)			;Tell the Quest We're done with the reset			;Set QuestID.iTotalObjects to QuestID.iTotalObjects + 1			Set bReset to 0			; I'm doing this because I will detain player in a dummy cell 			; until the whole Cell is reset. That way they can't see all			; stuff dissappearing and reappearing. It will just be done.		EndIf	EndIfEND


Also, King Selby @ Fo3Underground has been very helpful as well, and one of the things he suggested was putting this all in a quest script so that I could utilize the processing delay. Since the above method would be used on individual objects, I cam up with this possible alternative to a script processing delay...

	;This would be in the DoOnce section or OnLoad if I decide to use that instead.	Set fRand to GetRandomPercent		; Then the value would be used to determine the delay	IF fRand <= 20		Set Timer to 10	ElseIf (fRand > 20) && (fRand <=40)		Set Timer to 15	ElseIf (fRand > 40) && (fRand <=60)		Set Timer to 20	ElseIf (fRand > 60) && (fRand <=80)		Set Timer to 25	ElseIf (fRand > 80) && (fRand <=100)		Set Timer to 30	EndIf	If (bResetOk ==1) && (Timer ==1)		;Do stuff	EndIf


How does this all look? Any red flags going off? My biggest concern is the massive amount of persistent references this is going to be.
User avatar
Jeff Tingler
 
Posts: 3609
Joined: Sat Oct 13, 2007 7:55 pm


Return to Fallout 3