AlexxEG Posted August 24, 2010 Share Posted August 24, 2010 I'm having problems with script preforming it's final steps. It's a movement script which uses num pad keys to move the object. (rotating will come when I figured this problem out)It's suppose to disable & enable the object so the object's collison updates (and maybe other things, but mainly collison), but it's like it just ignore it, since it does the step before and after. So everything works except the disable/enabling. Also the message box buttons is like this:0. Place object.1. Reset scale to normal.2. Done Any other messages just states if something is started or stopped. Here is the Quest script: scn TTTestingScriptQ float Xp float Yp float Zp float Xa float Ya float Za float fScale int iEnable int iKey int iSnap int iMenu int Button ref rObject ;Cooldown int iStage float fTimer Begin GameMode if ( iMenu == 0 ) if ( iStage == 0 ) if ( iKey == 0 ) set iKey to gkp 0 Return elseif ( iKey == 65535 ) set iKey to gkp 0 Return elseif ( iKey == 75 ) set Xp to ( Xp - 1 ) if ( iSnap == 1 ) set iStage to 1 endif elseif ( iKey == 77 ) set Xp to ( Xp + 1 ) if ( iSnap == 1 ) set iStage to 1 endif elseif ( iKey == 72 ) set Yp to ( Yp + 1 ) if ( iSnap == 1 ) set iStage to 1 endif elseif ( iKey == 80 ) set Yp to ( Yp - 1 ) if ( iSnap == 1 ) set iStage to 1 endif elseif ( iKey == 73 ) set Zp to ( Zp + 1 ) if ( iSnap == 1 ) set iStage to 1 endif elseif ( iKey == 71 ) set Zp to ( Zp - 1 ) if ( iSnap == 1 ) set iStage to 1 endif elseif ( iKey == 74 ) set fScale to ( fScale - 0.1 ) if ( iSnap == 1 ) set iStage to 1 endif elseif ( iKey == 78 ) set fScale to ( fScale + 0.1 ) if ( iSnap == 1 ) set iStage to 1 endif elseif ( iKey == 81 ) if ( iSnap == 0 ) set iSnap to 1 ShowMessage TTTesting03MESG else set iSnap to 0 ShowMessage TTTesting04MESG endif set iStage to 1 elseif ( iKey == 22 ) ShowMessage TTTestingConfigMESG set iMenu to 1 else set iKey to gkp 0 Return endif endif rObject.SetPos X Xp rObject.SetPos Y Yp rObject.SetPos Z Zp rObject.SetScale fScale set iKey to 0 else set Button to GetButtonPressed ;This is where the problem is: ;========================================================== if ( Button == 0 ) rObject.Disable EnablePlayerControls set iEnable to 1 set iMenu to 0 ;========================================================== elseif ( Button == 1 ) set fScale to 1 rObject.SetScale fScale set iMenu to 0 elseif ( Button == 2 ) ;Do nothing set iMenu to 0 endif endif if ( fTimer > 0 ) Set fTimer to fTimer - GetSecondsPassed elseif ( iStage == 1 ) Set iStage to 2 Set fTimer to 0.3 elseif ( iStage == 2 ) Set iStage to 0 endif ;This is where the problem is: ;========================================================== if ( iEnable == 1 ) rObject.Enable set iEnable to 0 StopQuest TTTestingQ endif ;========================================================== End And this is what going to be on the objects that uses the placement feature: scn TTTestingScript Begin OnActivate if ( IsKeyPressed 22 == 1 ) ShowMessage TTTesting01MESG DisablePlayerControls 0 1 1 0 0 0 set TTTestingQ.Xp to GetPos X set TTTestingQ.Yp to GetPos Y set TTTestingQ.Zp to GetPos Z set TTTestingQ.fScale to GetScale set TTTestingQ.iStage to 1 set TTTestingQ.rObject to GetSelf StartQuest TTTestingQ endif End Thanks in advance^^ Link to comment Share on other sites More sharing options...
rickerhk Posted August 24, 2010 Share Posted August 24, 2010 You could try adding a delay so that the disable/enable does not occur in the same frame. Set the delay for like 2 seconds at first so you can see if it is really happening. Link to comment Share on other sites More sharing options...
AlexxEG Posted August 25, 2010 Author Share Posted August 25, 2010 I think I did something similar, but I used message boxes instead. And I placed one last at the enable section, then another one last at the disable section, and they both showed. Link to comment Share on other sites More sharing options...
rickerhk Posted August 26, 2010 Share Posted August 26, 2010 I think I did something similar, but I used message boxes instead. And I placed one last at the enable section, then another one last at the disable section, and they both showed. So both the disable and enable are being done - but in the same frame. If you set a timer after the disable and let a few frames go by before doing the enable so that the world art is updated might solve your problem. Link to comment Share on other sites More sharing options...
AlexxEG Posted August 26, 2010 Author Share Posted August 26, 2010 ahh, I get it. But even if they are in the same frame, shouldn't the object atleast get disabled? Link to comment Share on other sites More sharing options...
AlexxEG Posted August 26, 2010 Author Share Posted August 26, 2010 Okey, I fixed it!^^ Thanks, and kudos :) I didn't have to use a timer though, I just moved the enable section ABOVE the disable section. (On top to be exact) Link to comment Share on other sites More sharing options...
Recommended Posts