Jump to content
Sign in to follow this  
HateDread

Help with Cutscene-like Script Commands

Recommended Posts

Hey guys,

How do I force the player to walk slowly to a certain spot, from anyway nearby, say on a street corner, and then force the camera to track each military vehicle as it comes past? It's kind of like a cutscene that you're playing, but you're stuck on the spot so you can't move. It's a bit like a scene from say, Half-Life 2?

This is so the player is forced to stand and watch each military vehicle from a convoy pass, and maybe even watch the helicopter fly overhead - it's to make it all seem more dramatic. I can accompany it with music, etc, to increase this effect.

Any ideas?

Share this post


Link to post
Share on other sites

I'm wondering the same thing. I'd like to force to player to move toards an officer a few meters away once the cutscene starts playing. I can get the AI officer to move to the spot that he's supposed to be but I can't get the player to move. He just stands there. I'm guessing this has to do with the fact it's the player's unit that I'm trying to move.

Here's the code I got in the cutscene.sqf


cutText [" ","BLACK IN"];

_camera camPrepareTarget [-79436.47,-54367.41,-58.95];
_camera camPreparePos [2136.82,3481.83,1.28];
_camera camPrepareFOV 0.90;
_camera camCommitPrepared 0;
waitUntil {camCommitted _camera};

s1 dowatch testman1;

testman1 doMove (getmarkerPos "moveto1");

testman1 dowatch s1;

sleep 2;

s1 doMove (position testman1);

sleep 7;

s1 is the player, testman1 the officer. moveto1 is the marker position that the officer(testman1) moves to perfectly. But the player will not move. He's stuck in the last position he was in before the cut scene was triggered. I've also tried:

s1 doMove (getmarkerPos "moveto1");

but the same effect with the player in the cut scene. Is there something more I need to do to get the player(s1) to move?

Share this post


Link to post
Share on other sites

If you wanna "animate" the players unit for a cutscene, you need to temporarily turn that unit into AI with selectNoPlayer for example. You may study this repro for a handgun-bug I've made, for it does exactly this: it leaves the player unit, makes that unit walk a bit, while the cam is following... and then it switches back to the unit.. you may ignore the bit about the pistol-animation bug altogether...

_trigger = createTrigger["EmptyDetector", (position player)];
_trigger setTriggerActivation["JULIET", "PRESENT", true];
_trigger setTriggerText "run demo";
_trigger setTriggerStatements["true", "_nul = true spawn DEMO_HANDGUN;", ""];

_trigger = createTrigger["EmptyDetector", (position player)];
_trigger setTriggerActivation["INDIA", "PRESENT", true];
_trigger setTriggerText "run demo (no forceSpeed)";
_trigger setTriggerStatements["true", "_nul = false spawn DEMO_HANDGUN;", ""];

DEMO_HANDGUN = 
{
  private ["_unit", "_grp", "_cam"];
  _unit = player;
  _grp = group _unit;

  // create camera
  _cam = "camera" camCreate (position _unit); 
  _cam cameraEffect ["internal","back"];
  _cam camSetFOV 0.78;

  // turn player into AI
  selectNoPlayer;

  _grp setBehaviour "CARELESS";
  _grp setCombatMode "WHITE";
  _grp setSpeedMode "LIMITED";

  if (_this) then
  {
     _unit forceSpeed 1;
     diag_log "forceSpeed";
  };

  _unit doMove (_unit modelToWorld [(20 - (random 40)), 10, 0]);
  // simple cam script
  [_unit, _cam, _this] spawn 
  {
     private ["_unit", "_cam", "_forceSpeed", "_t"];
     _unit = _this select 0;
     _cam = _this select 1;
     _forceSpeed = _this select 2;

     while {!(unitReady _unit)} do
     {
        _t = 1 + (random 2);

        _cam camSetPos (_unit modelToWorld [(random 0.3), -3, 1.6]);
        _cam camSetTarget _unit;
        _cam camCommit _t;      
        sleep _t;
     };

     selectPlayer _unit;
     if (_forceSpeed) then
     {
        _unit forceSpeed -1;
        diag_log "forceSpeed (2)";
     };

     player cameraEffect ["terminate","back"];
     camDestroy _cam;

     hint format["DONE: %1", _cam];
  };
};

hint "1. just stand there with your main weapon selected\n2. radio 0-0-0 to run the demo script\n3. The player turns into AI, walks a little and returns the control to the player. Fine.\n\nNow:\n4. select your handgun and repeat.\n\nWTF :/";

Share this post


Link to post
Share on other sites

Aye, using selectnoplayer throws up a ton of errors with ACE2 and other mods. I'm making an SP mission, not sure if that makes a difference.

Share this post


Link to post
Share on other sites
Aye, using selectnoplayer throws up a ton of errors with ACE2 and other mods. I'm making an SP mission, not sure if that makes a difference.

Really? Well, maybe you might wanna drop them a note, for I'm sure this could be handled/catched.

But anyway, you don't have to select no player at all. That's just for convenience. Just switch to a dummy character then and you should be fine I guess.

Share this post


Link to post
Share on other sites

That's what I'm planning, dummy unit was my plan to begin with.

Thanks for the help!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×