Frictional Games Forum (read-only)
[SCRIPT] Simulate the player being dragged ? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Simulate the player being dragged ? (/thread-24783.html)

Pages: 1 2


Simulate the player being dragged ? - lothabread - 03-08-2014

Well as you can all probably tell by the title of the thread. I'm in need of a script that would make it look and sound as if the player was being dragged by an enemy, but I've not the slightest clue of how to go about this or if its even really possible. Any input would be greatly appreciated ^^


RE: Simulate the player being dragged ? - Neelke - 03-08-2014

This might be something to start off with.

Code:
void OnStart()
{
     MovePlayerHeadPos(0, -0.9f, 0, 10.0f, 0.1f);
     SetPlayerActive(false);
     AddTimer("drag", 3.0f, "PlayerDrag");
}

void PlayerDrag(string &in asTimer)
{
    AddPlayerBodyForce(8000, 0, -8000, false);
    AddTimer(asTimer, 1.5f, "PlayerDrag");
}

But sometimes, try checking through all the scripts yourselves. You learn quicker Smile


RE: Simulate the player being dragged ? - Deadon - 03-08-2014

Also, for a better sense of being dragged (that most don't seem to get/notice) is that it's better to pulse (listen to the drag noise) than to keep the same speed.


RE: Simulate the player being dragged ? - Neelke - 03-08-2014

Well Deadon, I used a sound which fitted this perfectly, but I'm certain he doesn't have it. Unless he got the conversion mod The Fugitive 2.

PlayGuiSound("31_drag.snt", 1.0f);


RE: Simulate the player being dragged ? - lothabread - 03-23-2014

whats the best configuration to have the players head on the floor ?

this is what i have

FadePlayerRollTo(-45, 0.8, 8);


RE: Simulate the player being dragged ? - Romulator - 03-23-2014

Didn't test this (rather stole it from the wiki's wake up tutorial), but it might also help:
Code:
FadePlayerRollTo(50, 220, 220); // Simulate being on the floor

Since you have FadePlayerRollTo, you are heading in the right direction (no pun intended)


RE: Simulate the player being dragged ? - lothabread - 03-24-2014

Well i want the player to start off in a cage, have an engineer come "open" it and then "drag" the player around a corner, but im at a standstill

Spoiler below!
PHP Code:
////////////////////////////
// Run when starting game
void OnStart()
{
///////////////////////
//Debug
    
if(ScriptDebugOn())
          {
               
GiveItemFromFile("lantern""lantern.ent");
               
SetPlayerLampOil(100.0f);
 
               for(
int i 0;10;i++)
               {
                    
GiveItemFromFile("tinderbox""tinderbox.ent");
               }
          }
///////////////////////

///////////////////////
//Start Scene
    
SetSanityDrainDisabled(true);
    
SetPlayerCrouching(true);
    
SetPlayerActive(false);
    
FadeOut(0);
    
AddTimer("StartGame"6.0f"IntroSequence");
    
AddTimer("drag"3.0f"Drag");
////////////////////////
}

////////////////////////
//Start Scene
void IntroSequence(string &in asTimer)
{
    
AddLocalVarInt("iIntroPart"1);
    
float partSpeed 0.5f;
    switch(
GetLocalVarInt("iIntroPart")) {
        case 
1:
            
MovePlayerHeadPos(0, -0.9f010.0f0.1f);
            
PlayGuiSound(""1.0f);
            
StartPlayerLookAt("AreaIntroLook_1"10.0f10.0f"");
            
FadePlayerRollTo(-50200200);
            
partSpeed 0.5f;
        break;
        
        case 
2:
            
StartPlayerLookAt("AreaIntroLook_1"1.0f1.0f"");
            
FadeIn(2.0f);
            
Manpig01();
            
partSpeed 3.0f;  
        break;
        
        case 
3:
            
StartPlayerLookAt("AreaIntroLook_2"1.0f1.0f"");
            
partSpeed 5.0f;
        break;
        
        case 
4:
            
StartPlayerLookAt("AreaIntroLook_3"1.0f1.0f"");
            
PlayGuiSound(""0.7f);
            
FadeOut(5.7f);
            
partSpeed 6.0f;
        break;
        
        case 
5:
            
TeleportPlayer("PlayerDrag");
            
MovePlayerHeadPos(-1.0f, -0.45, -1.110.0f0.1f);
            
partSpeed 0.01f;
        break;
        
        case 
6:
            
PlayGuiSound("joint_cage_slide_open"1.0f);
            
FadeIn(6.0f);
            
partSpeed 8.0f;
        break;
    }
    
    if(
GetLocalVarInt("iIntroPart") < 7)    AddTimer("tmrIntro"partSpeed"IntroSequence");     
}

void Drag(string &in asTimer)
{
  
AddPlayerBodyForce(80000, -8000false);
  
AddTimer(asTimer1.5f"PlayerDrag");
}

void Manpig01()
{
    
AddEnemyPatrolNode("engineer_1""PathNodeArea_1"0.0f"");
    
AddEnemyPatrolNode("engineer_1""PathNodeArea_2"0.0f"");
    
AddEnemyPatrolNode("engineer_1""PathNodeArea_3"0.0f"");





RE: Simulate the player being dragged ? - Neelke - 03-24-2014

Code:
void Drag(string &in asTimer)
{
  AddPlayerBodyForce(8000, 0, -8000, false);
  AddTimer(asTimer, 1.5f, "(Player)Drag");
}

Marked with () what was wrong. The timer aint named like that. This below is correct.

Code:
void Drag(string &in asTimer)
{
  AddPlayerBodyForce(8000, 0, -8000, false);
  AddTimer(asTimer, 1.5f, "Drag");
}



RE: Simulate the player being dragged ? - lothabread - 03-25-2014

okay this is gonna sound kinda dumb, but how do i get the player to look straight up at the cieling ?

is it FadePlayerRollTo

or MovePlayerHeadPos

?


RE: Simulate the player being dragged ? - Romulator - 03-25-2014

I think you're better to just place a ScriptArea above you, and;

PHP Code:
void StartPlayerLookAt(stringasEntityNamefloat afSpeedMulfloat afMaxSpeedstringasAtTargetCallback); 
Where:
asEntityName - the entity to look at
afSpeedMul - how fast should the player look at the entity
afMaxSpeed - maximum speed allowed
asAtTargetCallback - function to call when player looks at target

You will have to declare a StopPlayerLookAt() at some point if you use this Smile