Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
StevenC21

ACS Control Locking?

Question

Is there a way that I can lock down a player's movement, so that a cinematic can play out? This is using ACS, of course.

Share this post


Link to post

6 answers to this question

Recommended Posts

  • 0

StevenC21, just in case you're wondering which function to use to restrict player movement:

 

PROP_FROZEN allows the player to turn in place, look up or down, and attack, but not move forward/backward/sideways.

PROP_TOTALLYFROZEN completely freezes the player

 

Also, consider that while the player is frozen and the cinematic plays out, the player can continue to take damage if attacked. This may be handled by ensuring that the player is in a location where s/he cannot be attacked when the cinematic starts and ends. Alternatively, the player can be set to be invulnerable during the cut-scene. [The disadvantage of this is that when the cut-scene is over and invulnerability is removed, the player is immediately susceptible to attacks that may have begun while the player was immobilized.]

Share this post


Link to post
  • 0
Posted (edited)

Here's a script I wrote that gives the player invulnerability while viewing a camera and for 3 seconds after. It checks if the player is already invulnerable, and doesn't take it away. Also, if the already-existing invul runs out, then the script gives invul to the player.
 

Spoiler

script "EmpViewCamera" (int CamID)
{
    If(CheckInventory("EmpCameraIsInUse"))
    {
        Terminate;
    }
    GiveInventory("EmpCameraisInUse",1);
    Thing_Stop (0);
    ChangeCamera (CamID,0,0);
    SetPlayerProperty (0,ON,PROP_TOTALLYFROZEN);
    if (CheckInventory("EmpCameraInvul"))
    {
        if (!CheckActorProperty(0,APROP_Invulnerable,TRUE))
        {
            SetActorProperty (0, APROP_Invulnerable,TRUE);
        }
    }
    else if (!CheckActorProperty(0,APROP_Invulnerable,TRUE))
    {
        SetActorProperty (0, APROP_Invulnerable,TRUE);
        GiveInventory("EmpCameraInvul",1);
    }
    HudMessage (s:"Press Use to return to your own view.";HUDMSG_PLAIN,1,CR_YELLOW,1.5,0.5,0.0);
    While (GetPlayerInput(-1,INPUT_BUTTONS) & BT_USE)
    {
        Delay(4);
        if (CheckInventory("EmpCameraInvul"))
        {
            if (!CheckActorProperty(0,APROP_Invulnerable,TRUE))
            {
                SetActorProperty (0, APROP_Invulnerable,TRUE);
            }
        }
        else if (!CheckActorProperty(0,APROP_Invulnerable,TRUE))
        {
            SetActorProperty (0, APROP_Invulnerable,TRUE);
            GiveInventory("EmpCameraInvul",1);
        }
    }
    While (!(GetPlayerInput(-1,INPUT_BUTTONS) & BT_USE))
    {
        Delay(4);
        if (CheckInventory("EmpCameraInvul"))
        {
            if (!CheckActorProperty(0,APROP_Invulnerable,TRUE))
            {
                SetActorProperty (0, APROP_Invulnerable,TRUE);
            }
        }
        else if (!CheckActorProperty(0,APROP_Invulnerable,TRUE))
        {
            SetActorProperty (0, APROP_Invulnerable,TRUE);
            GiveInventory("EmpCameraInvul",1);
        }
    }
    Hudmessage (s:" ";HUDMSG_PLAIN,1,CR_YELLOW,1.5,0.5,1.0/35+1);
    ChangeCamera (0,0,0);
    SetPlayerProperty (0,OFF,PROP_TOTALLYFROZEN);
    TakeInventory("EmpCameraIsInUse",1);
    for (int I = 1; I <= 21; I++)//21 times 5 tics = 105 tics or 3 seconds
    {
        Delay (5);
        if (CheckInventory("EmpCameraInvul"))
        {
            if (!CheckActorProperty(0,APROP_Invulnerable,TRUE))
            {
                SetActorProperty (0, APROP_Invulnerable,TRUE);
            }
        }
        else if (!CheckActorProperty(0,APROP_Invulnerable,TRUE))
        {
            SetActorProperty (0, APROP_Invulnerable,TRUE);
            GiveInventory("EmpCameraInvul",1);
        }
    }
//    Delay (105); //replaced by the above for loop
    If(!CheckInventory("EmpCamersIsInUse"))
    {
        If (CheckInventory("EmpCameraInvul"))
        {
            TakeInventory("EmpCameraInvul",1);
            SetActorProperty (0, APROP_Invulnerable,FALSE);
        }
    }
}

 

Share this post


Link to post
  • 0

I forgot to mention that for the script I posted above, you need these two actors declared in DECORATE:

Spoiler

ACTOR EmpCameraIsInUse : Inventory
{
Inventory.Amount 1
Inventory.MaxAmount 1
-INVBAR
}

 

ACTOR EmpCameraInvul : Inventory
{
Inventory.Amount 1
Inventory.MaxAmount 1
-INVBAR
}

 

Of course, feel free to edit the script to fit your needs.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×