Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
More advance coding (for me)
X4anco Offline
Member

Posts: 157
Threads: 66
Joined: Apr 2011
Reputation: 0
#1
More advance coding (for me)

Hello peoples

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

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

Question 2:
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:
What creates a 'uncomfortable' enviroment to make the player's imagination go wild and think of what nightmares lie ahead

...
(This post was last modified: 05-29-2011, 12:50 PM by X4anco.)
05-29-2011, 12:49 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#2
RE: More advance coding (for me)

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.

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. :/

05-29-2011, 01:39 PM
Find
X4anco Offline
Member

Posts: 157
Threads: 66
Joined: Apr 2011
Reputation: 0
#3
RE: More advance coding (for me)

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

-X4anco

...
05-29-2011, 02:01 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#4
RE: More advance coding (for me)

(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?

05-29-2011, 02:22 PM
Find




Users browsing this thread: 1 Guest(s)