Page 1 of 1

Q4 scripting question

Posted: Tue Aug 21, 2007 3:39 pm
by dnky
Hi, appologies if this is a dumb questions, but my knowledge of scripting is still at a basic level:
My set up is as follows...walk into an area and trigger the door closing behind you. Continue forward and trigger a camera that swings around the room in a circle looking towards the closed door then around to a pit from which a monster will rise. All of this I have managed. What I cant do is get the monster to rise out of the pit before the player returns to first person mode. I would really like the monster to be raised up (and another event I havent scripted yet) before returning to first person view.
My script for raising the boss:

Code: Select all

// Raise and move boss platform //
void move_boss_one()
{
	sys.threadname("move_boss_one");
	sys.wait(10);
	$boss_platform.time(8);
	$boss_platform.moveTo($boss_move_1);
	sys.waitFor($boss_platform);
	$boss_platform.time(6);
	$boss_platform.moveTo($boss_move_2);
	sys.waitFor($boss_platform);
	$boss_platform.remove();
	
}
My script for the camera event (taken for D3W tuts):

Code: Select all

void start_camera_spline()

{
        $anchor.time(20);
        $anchor.accelTime(.5);
        $anchor.decelTime(5);
        $anchor.disableSplineAngles(); //You need to add this when aiming a moving camera.
	$anchor.startSpline($camera_spline);
	
   
   
}

//This is the new aiming script:
void update_camera()
{
   sys.threadname("aim_loop");   // Gives this thread the name "aim_loop" so it can be killed later.
   while (1)
   {

//This triggers the target_setkeyvall which in turn adds a key/val pair to the func_cameraview:   
      sys.trigger($target_setkeyval_1);

      sys.waitFrame(); //This waits for the next frame before continuing
   }
}

void camera_script()
{
   thread   move_boss_one();//my attempt at calling boss platform
   sys.setCamera($func_cameraview_1);
   start_camera_spline();
   
   thread   update_camera();   // This calls the function update_camera as a thread so it
               // runs in the background.

   sys.waitFor($anchor);      // This halts execution until anchor finishes it's movement.
   sys.killthread("aim_loop");      // This kills the thread "aim_loop"
   sys.firstPerson();  //Turn off the camera and switch back to normal
}

Both these scripts work fine, but as I say, the platform only runs after the camera event is completed.
Many thanks fo any assistance.

Re: Q4 scripting question

Posted: Tue Aug 21, 2007 4:57 pm
by Castle
One thing I can see that looks a little strange is that you are setting the bosses platform time and telling it to move at the exact same time.
Its really possible this is unrelated though I have seen some wonky things happen when you do that..

I seem to recal that when you enter a cinematic mode the damn entities involved with the script need to have "cinematic" key pair on them or they would not function until after the cinematic script was completed..

I cant remember exactly what it was but it was like this
Cinematic 1

this right here could very well be the bane of existence for many people who have worked with the tech and wanted to do a cinematic lol...

Re: Q4 scripting question

Posted: Tue Aug 21, 2007 8:30 pm
by dnky
Thanks Castle....I just discovered the cinematic key! Should have realised having bound the camera to a target and had the same thing. heh
In between working I have been trying to do this all day....and one 9 letter word was all that was wrong!

Re: Q4 scripting question

Posted: Tue Aug 21, 2007 9:11 pm
by Castle
WOOT!

I remember levelord one time nearly lost it when he found out about that keypair lol..
I can say the same for myself too hehehe...

oh well !
good thing I remembered about it.. unlikely to forget I suppose.. :owned: