Need help enabling/disabling an object

Post » Wed Jan 05, 2011 12:46 am

Ok so, I have been attempting to make a bed move via a script when a secret activator is activated. Once the bed is moved it will reveal that there was a hidden hatch to another room. The only problem that I am having is getting the bed collision to reset properly after being moved so I can actually use said door.

I have googled the topic and searched the forums for the better part of the last 6+ hours looking for my answer and all I can find is rather vague. I have found other scripts using the command I have tried to use in mine, but it just doesn't want to work no matter where I put the commands. Here is my script that is functioning rather excellently besides the reactivation of the bed:
Scn MovingBedFloat FinalPosShort ActiveShort YmoveBegin OnActivate	Set ymove to 2	HideABed.disable		If Active==1				Message "The bed moved back to where it was, covering the secret hatch."				Set Active to 2			Else			Message "The bed moved, revealing a secret hatch."			Set Active to 1		EndifEndBegin Gamemode	If Active == 1		If FinalPos > -750			Set FinalPos to HideABed.getpos y - Ymove			HideABed.Setpos y FinalPos			HideABed.Enable		EndIf	ElseIf Active ==2		If FinalPos < -625			Set FinalPos to HideABed.getpos y + Ymove			HideABed.Setpos y FinalPos			HideABed.Enable		EndIf	EndIfEnd


I have a hunch that I will feel rather dumb at how simple the fix may be. Any suggestions or leads as to fix my problem is MUCH appreciated.
User avatar
Hope Greenhaw
 
Posts: 3368
Joined: Fri Aug 17, 2007 8:44 pm

Post » Tue Jan 04, 2011 2:13 pm

The most reliable method of resetting collision of moved meshes is Disable + Reset3Dstate + Enable. But you have to do it on different frames.

Something like:


Short iFrame;=== After you move the bed ===	Set iFrame to 3;=== at the end of the gamemode block ===	if iFrame		set iFrame to iFrame - 1		if iFrame == 2			refBed.disable		elseif iFrame == 1			refBed.reset3Dstate		elseif iFrame == 0			refBed.enable		endif	endif 

User avatar
YO MAma
 
Posts: 3321
Joined: Thu Dec 21, 2006 8:24 am

Post » Tue Jan 04, 2011 9:36 pm

You sir/ma'am are my savior. works like a charm :D :D :D
User avatar
suzan
 
Posts: 3329
Joined: Mon Jul 17, 2006 5:32 pm

Post » Wed Jan 05, 2011 1:33 am

I remember when he saved my life, too. It happened just this way. :wub:
User avatar
saxon
 
Posts: 3376
Joined: Wed Sep 19, 2007 2:45 am


Return to IV - Oblivion