Frictional Games Forum (read-only)
More advance coding (for me) - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: More advance coding (for me) (/thread-8320.html)



More advance coding (for me) - X4anco - 05-29-2011

Hello peoples

I'm trying to put some more interactivity into my levels, and I need help understanding numerous precepts.

Question 1:
Code:
Say I want a door to move when you pull a lever, e.g. a metal door will move upwards.

Question 2:
Code:
How would I use the StartPlayerLookAt function because when I do use it the player doesn't stop looking even when I use StopPlayerLookAt

Question 3:
Code:
What creates a 'uncomfortable' enviroment to make the player's imagination go wild and think of what nightmares lie ahead



RE: More advance coding (for me) - Kyle - 05-29-2011

To question 1, I can't answer it because I tried so many times before and it wouldn't work. :/

To question 2, It should work.

Example. The player collides with ScriptArea_1 and then looks at some place called ScriptArea_2 and then 2 seconds later, looks at ScriptArea_3.

Code:
void OnStart()
{
     AddEntityCollideCallback("Player", "ScriptArea_1", "Func01", true, 1);
}
void Func01(string &in asParent, string &in asChild, int alState)
{
     StartPlayerLookAt("ScriptArea_2", 2, 2, "");
     AddTimer("T1", 1.5, "Func02");
     AddTimer("T2", 2, "Func02");
     AddTimer("T3", 3.5, "Func02");
}
void Func02(string &in asTimer)
{
     string x = asTimer;
     if (x == "T1")
     {
          StopPlayerLookAt();
          return;
     }
     else if (x == "T2")
     {
          StartPlayerLookAt("ScriptArea_3", 2, 2, "");
          return;
     }
     else if (x == "T3")
     {
          StopPlayerLookAt();
          return;
     }
}

To question 3, maybe have big rooms with unlit areas with creeping doors making the player assume that something is there. :/


RE: More advance coding (for me) - X4anco - 05-29-2011

Thank-you but DAMN it 's hard to understand. Could you break it down please?

-X4anco


RE: More advance coding (for me) - Kyle - 05-29-2011

(05-29-2011, 02:01 PM)X4anco Wrote: Thank-you but DAMN it 's hard to understand. Could you break it down please?

-X4anco

-_-

Player collides with ScriptArea_1.
AddEntityCollideCallback("Player", "ScriptArea_1", "Func01", true, 1);

The Player Is now starting to look at ScriptArea_2 once the Player does collide with ScriptArea_1.
StartPlayerLookAt("ScriptArea_2", 2, 2, "");

3 timers are added, each going to the same function (Func02) carrying the information of the timer (T1, T2, T3). Once the timer runs out of time, the function is called for that one individual timer.

So when timer "T1" runs out of time, function "Func02" is called and it carries over the timer information represented by "Func02(string &in asTimer)".

Since "T1" is a string, a "line" of letters, x will equal it. So instead of saying "if (asTimer == "T1")" It will be saying "if(x == "T1")".

The player stops looking at ScriptArea_2. Then the next timer runs out of time (T2). Then it makes the player look at ScriptArea_3. When the last timer runs out of time (T3), the player stops looking at ScriptArea_3.

Is that good enough?