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
What is the script for making the player look a spefici place?
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#11
RE: What is the script for making the player look a spefici place?

StartPlayerLookAt("mansion_5", 10, 10, "");
Is under OnStart().
OnStart means it plays once the map is entered for the first time, of course you instantly look there. If you want to look at the mansion_5 door once you picked up key3, cut out the above line(StartPlayerlLookAt etc) and place it inside the KeyonDoor_5 function.
(This post was last modified: 06-23-2012, 02:46 PM by Cruzore.)
06-23-2012, 02:46 PM
Find
bored2tears Offline
Member

Posts: 56
Threads: 6
Joined: Jun 2012
Reputation: 3
#12
RE: What is the script for making the player look a spefici place?

I don't mean to ask a question on my problem in this thread, but it seems as if we have similar problems, so I didn't think it would be necessary to create a new thread for it.

I want the character, when he walks into the script area "screamlook", he faces the door "mansion_1", a sound plays "help.snt", and he looks at it for a few seconds.

Here is my .hpl log.
void OnStart()
{


AddEntityCollideCallback("Player", "slam1", "slamshut", true, 1);

AddUseItemCallback("", "Spare_Key", "LockedDoor1", "UsedKeyOnDoor", true);

    FadeOut(0);     // Instantly fades the screen out. (Good for starting the game)
    FadeIn(20);      // Amount of seconds the fade in takes
    FadeImageTrailTo(2, 2);
    FadeSepiaColorTo(100, 4);
    SetPlayerActive(false);    
    FadePlayerRollTo(50, 220, 220);                 // "Tilts" the players head
    FadeRadialBlurTo(0.15, 2);
    SetPlayerCrouching(true);              // Simulates being on the ground
    AddTimer("trig1", 11.0f, "beginStory");            // Change '11.0f' to however long you

want the 'unconciousness' to last



    ChangePlayerStateToNormal();
    SetPlayerActive(true);
    FadePlayerRollTo(0, 33, 33);        // Change all settings to defaults
    FadeRadialBlurTo(0.0, 1);
    FadeSepiaColorTo(0, 4);
    SetPlayerCrouching(false);
    FadeImageTrailTo(0,1);


}

void DoorLockedPlayer(string &in entity)
{
    if(GetSwingDoorLocked("LockedDoor1") == true)
    {
     SetMessage("Messages", "lock1", 0);
    }
}

void screamlook(string &in asParent, string &in asChild, int alState)
{
    PlaySoundAtEntity("", "help.snt", "mansion_1", 0, false);
    SetPlayerActive(false);
    StartPlayerLookAt("mansion_1", 3.0f, 5.0f, "StopLook");
    AddTimer("timer01", 1.5f, "StopLook");
}

void StopLook(string &in asTimer)
{
    StopPlayerLookAt();
    SetPlayerActive(true);
}


void slamshut(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("doorslam1", true, true);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false);

PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(5.0f, true);
}

void UsedKeyOnDoor(string &in item, string &in door)
{
    SetSwingDoorLocked("LockedDoor1", false, true);
    PlaySoundAtEntity("", "unlock_door", "LockedDoor1", 0, false);
    RemoveItem("Spare_Key");
}

Thanks in advance.
06-23-2012, 09:05 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#13
RE: What is the script for making the player look a spefici place?

(06-23-2012, 09:05 PM)bored2tears Wrote: I don't mean to ask a question on my problem in this thread, but it seems as if we have similar problems, so I didn't think it would be necessary to create a new thread for it.

I want the character, when he walks into the script area "screamlook", he faces the door "mansion_1", a sound plays "help.snt", and he looks at it for a few seconds.

Here is my .hpl log.
void OnStart()
{


AddEntityCollideCallback("Player", "slam1", "slamshut", true, 1);

AddUseItemCallback("", "Spare_Key", "LockedDoor1", "UsedKeyOnDoor", true);

    FadeOut(0);     // Instantly fades the screen out. (Good for starting the game)
    FadeIn(20);      // Amount of seconds the fade in takes
    FadeImageTrailTo(2, 2);
    FadeSepiaColorTo(100, 4);
    SetPlayerActive(false);    
    FadePlayerRollTo(50, 220, 220);                 // "Tilts" the players head
    FadeRadialBlurTo(0.15, 2);
    SetPlayerCrouching(true);              // Simulates being on the ground
    AddTimer("trig1", 11.0f, "beginStory");            // Change '11.0f' to however long you

want the 'unconciousness' to last



    ChangePlayerStateToNormal();
    SetPlayerActive(true);
    FadePlayerRollTo(0, 33, 33);        // Change all settings to defaults
    FadeRadialBlurTo(0.0, 1);
    FadeSepiaColorTo(0, 4);
    SetPlayerCrouching(false);
    FadeImageTrailTo(0,1);


}

void DoorLockedPlayer(string &in entity)
{
    if(GetSwingDoorLocked("LockedDoor1") == true)
    {
      SetMessage("Messages", "lock1", 0);
    }
}

void screamlook(string &in asParent, string &in asChild, int alState)
{
    PlaySoundAtEntity("", "help.snt", "mansion_1", 0, false);
    SetPlayerActive(false);
    StartPlayerLookAt("mansion_1", 3.0f, 5.0f, "StopLook");
    AddTimer("timer01", 1.5f, "StopLook");
}

void StopLook(string &in asTimer)
{
    StopPlayerLookAt();
    SetPlayerActive(true);
}


void slamshut(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("doorslam1", true, true);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false);

PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(5.0f, true);
}

void UsedKeyOnDoor(string &in item, string &in door)
{
    SetSwingDoorLocked("LockedDoor1", false, true);
    PlaySoundAtEntity("", "unlock_door", "LockedDoor1", 0, false);
    RemoveItem("Spare_Key");
}

Thanks in advance.
---------------------------------------------------------------------------------------------
Under void screamlook(string &in asParent, string &in asChild, int alState)
that's the wrong point. Add this to OnStart():
AddEntityCollideCallback("screamlook", "Player", "ScreamlookFunc", true, 1);

Then add this anywhere, but not inside any other function:

void ScreamlookFunc(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "help.snt", "mansion_1", 0, false);
SetPlayerActive(false);
StartPlayerLookAt("mansion_1", 3.0f, 5.0f, "StopLook");
}

The rest is all right, it seems. To explain your mistake: You have to use a collide callback to check if the player ever collides with the area.
(This post was last modified: 06-23-2012, 09:14 PM by Cruzore.)
06-23-2012, 09:13 PM
Find
bored2tears Offline
Member

Posts: 56
Threads: 6
Joined: Jun 2012
Reputation: 3
#14
RE: What is the script for making the player look a spefici place?

Thanks, I didn't know you had to add that.

By the way, it should be AddEntityCollideCallback("Player", "screamlook", "ScreamlookFunc", true, 1); :3


EDIT: wait, it is not working. He turns and looks and the sound plays, but he won't stop staring at the door. :/

EDIT2: ah, didn't have timer set up for some reason. Tongue
(This post was last modified: 06-23-2012, 09:48 PM by bored2tears.)
06-23-2012, 09:42 PM
Find




Users browsing this thread: 1 Guest(s)