Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is the script for making the player look a spefici place?
Author Message
Hartmann Offline
Member

Posts: 52
Joined: Jun 2012
Reputation: 0
Post: #1
What is the script for making the player look a spefici place?

What is the script for making the player look a specific upon picking up and item?
item: key_3
place name: mansion_5
and if u can can you make the door close too?
06-22-2012 04:42 PM
Find all posts by this user Quote this message in a reply
drunkmonk Offline
Member

Posts: 109
Joined: Jun 2012
Reputation: 4
Post: #2
RE: What is the script for making the player look a spefici place?

The script for making the play look at something is
StartPlayerLookAt("mansion_5", 10, 10, ""); (the numbers are just the spped at which the player looks at the object or area)
and to open a door you woul either have to use
AddPropImpulse("mansion_5", 0, 0, 10, "World");
or
AddPropForce("mansion_5", 0, 0, 10, "World");
(you may need to play around with the scripting for the door closing)

you may also be able to get away with just using
SetSwingDoorClosed("mansion_5", true, true);
(This post was last modified: 06-22-2012 04:57 PM by drunkmonk.)
06-22-2012 04:56 PM
Find all posts by this user Quote this message in a reply
Cruzore Offline
Senior Member

Posts: 304
Joined: Jun 2012
Reputation: 37
Post: #3
RE: What is the script for making the player look a spefici place?

You need to add a timer with AddTimer, which call the function to stop the looking at part with StopPlayerLookAt, or else you're frozen to look there. Look at the Engine scripts page in the wiki(http://wiki.frictionalgames.com/hpl2/amn..._functions) for everything you need.
06-22-2012 05:03 PM
Find all posts by this user Quote this message in a reply
drunkmonk Offline
Member

Posts: 109
Joined: Jun 2012
Reputation: 4
Post: #4
RE: What is the script for making the player look a spefici place?

(06-22-2012 05:03 PM)FastHunteR Wrote:  You need to add a timer with AddTimer, which call the function to stop the looking at part with StopPlayerLookAt, or else you're frozen to look there. Look at the Engine scripts page in the wiki(http://wiki.frictionalgames.com/hpl2/amn..._functions) for everything you need.
Right I forgot about that lol Tongue
06-22-2012 05:05 PM
Find all posts by this user Quote this message in a reply
Hartmann Offline
Member

Posts: 52
Joined: Jun 2012
Reputation: 0
Post: #5
RE: What is the script for making the player look a spefici place?

(06-22-2012 04:56 PM)drunkmonk Wrote:  The script for making the play look at something is
StartPlayerLookAt("mansion_5", 10, 10, ""); (the numbers are just the spped at which the player looks at the object or area)
and to open a door you woul either have to use
AddPropImpulse("mansion_5", 0, 0, 10, "World");
or
AddPropForce("mansion_5", 0, 0, 10, "World");
(you may need to play around with the scripting for the door closing)

you may also be able to get away with just using
SetSwingDoorClosed("mansion_5", true, true);
can you fix it i screwed up. here is my whole hps

void OnStart()
{
AddUseItemCallback("", "key_1", "mansion_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_2", "mansion_2", "KeyOnDoor_2", true);
AddUseItemCallback("", "key_3", "mansion_5", "KeyOnDoor_5", true);
SetEntityPlayerInteractCallback("key_3", "ActivateMonster", true);
StartPlayerLookAt("mansion_5", 10, 10, "");
AddPropImpulse("mansion_5", 0, 0, 10, "World");
AddTimer(mansion_5, 3, LookAtDoor);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0.0f, true);
RemoveItem("key_1");
}

void KeyOnDoor_2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_2", 0.0f, true);
RemoveItem("key_2");
}

void KeyOnDoor_5(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_5", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_5", 0.0f, true);
RemoveItem("key_3");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

void ActivateMonster(string &in item)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 4, "Idle");

}
06-22-2012 05:34 PM
Find all posts by this user Quote this message in a reply
drunkmonk Offline
Member

Posts: 109
Joined: Jun 2012
Reputation: 4
Post: #6
RE: What is the script for making the player look a spefici place?

(06-22-2012 05:34 PM)Hartmann Wrote:  
(06-22-2012 04:56 PM)drunkmonk Wrote:  The script for making the play look at something is
StartPlayerLookAt("mansion_5", 10, 10, ""); (the numbers are just the spped at which the player looks at the object or area)
and to open a door you woul either have to use
AddPropImpulse("mansion_5", 0, 0, 10, "World");
or
AddPropForce("mansion_5", 0, 0, 10, "World");
(you may need to play around with the scripting for the door closing)

you may also be able to get away with just using
SetSwingDoorClosed("mansion_5", true, true);
can you fix it i screwed up. here is my whole hps

void OnStart()
{
AddUseItemCallback("", "key_1", "mansion_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_2", "mansion_2", "KeyOnDoor_2", true);
AddUseItemCallback("", "key_3", "mansion_5", "KeyOnDoor_5", true);
SetEntityPlayerInteractCallback("key_3", "ActivateMonster", true);
StartPlayerLookAt("mansion_5", 10, 10, "");
AddPropImpulse("mansion_5", 0, 0, 10, "World");
AddTimer(mansion_5, 3, LookAtDoor);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0.0f, true);
RemoveItem("key_1");
}

void KeyOnDoor_2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_2", 0.0f, true);
RemoveItem("key_2");
}

void KeyOnDoor_5(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_5", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_5", 0.0f, true);
RemoveItem("key_3");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

void ActivateMonster(string &in item)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 4, "Idle");

}
Are you getting a fatal error or is it just not working?
06-22-2012 05:37 PM
Find all posts by this user Quote this message in a reply
Cruzore Offline
Senior Member

Posts: 304
Joined: Jun 2012
Reputation: 37
Post: #7
RE: What is the script for making the player look a spefici place?

AddTimer(mansion_5, 3, LookAtDoor);
mansion_5 must be in brackets:"mansion_5", and LookAtDoor too.
or better: name it something different, as that name is not really great as a stopplayerlookat function.
so change it to this:AddTimer("StopLook", 3, "LookAtDoor");
second problem: you're missing the LookAtDoor function. Add to the very bottom, outside of any function:
void LookAtDoor(string &in asTimer)
{
StopPlayerLookAt();
}
Now the third problem:
PlaySoundAtEntity("", "unlock_door", "mansion_5", 0.0f, true);
the sound needs its extension, or else it won't work. replace all of those functions with this:
PlaySoundAtEntity("", "unlock_door.snt", "mansion_5", 0.0f, true);
That's it. after this, it should work.
However, you can do great at decreasing the length of this script, by putting all UnlockDoor functions into a single one. But since you're unexperienced, you should stay by that at first.
(This post was last modified: 06-22-2012 05:42 PM by Cruzore.)
06-22-2012 05:41 PM
Find all posts by this user Quote this message in a reply
Hartmann Offline
Member

Posts: 52
Joined: Jun 2012
Reputation: 0
Post: #8
RE: What is the script for making the player look a spefici place?

(06-22-2012 05:41 PM)FastHunteR Wrote:  AddTimer(mansion_5, 3, LookAtDoor);
mansion_5 must be in brackets:"mansion_5", and LookAtDoor too.
or better: name it something different, as that name is not really great as a stopplayerlookat function.
so change it to this:AddTimer("StopLook", 3, "LookAtDoor");
second problem: you're missing the LookAtDoor function. Add to the very bottom, outside of any function:
void LookAtDoor(string &in asTimer)
{
StopPlayerLookAt();
}
Now the third problem:
PlaySoundAtEntity("", "unlock_door", "mansion_5", 0.0f, true);
the sound needs its extension, or else it won't work. replace all of those functions with this:
PlaySoundAtEntity("", "unlock_door.snt", "mansion_5", 0.0f, true);
That's it. after this, it should work.
However, you can do great at decreasing the length of this script, by putting all UnlockDoor functions into a single one. But since you're unexperienced, you should stay by that at first.
cant u write the whole HPS for me Smile?
06-22-2012 08:49 PM
Find all posts by this user Quote this message in a reply
Cruzore Offline
Senior Member

Posts: 304
Joined: Jun 2012
Reputation: 37
Post: #9
RE: What is the script for making the player look a spefici place?

if you can't fix it with such instructions, where I stated what to put where, then..well..maybe someone else does the work.
06-22-2012 10:25 PM
Find all posts by this user Quote this message in a reply
Hartmann Offline
Member

Posts: 52
Joined: Jun 2012
Reputation: 0
Post: #10
RE: What is the script for making the player look a spefici place?

(06-22-2012 05:41 PM)FastHunteR Wrote:  AddTimer(mansion_5, 3, LookAtDoor);
mansion_5 must be in brackets:"mansion_5", and LookAtDoor too.
or better: name it something different, as that name is not really great as a stopplayerlookat function.
so change it to this:AddTimer("StopLook", 3, "LookAtDoor");
second problem: you're missing the LookAtDoor function. Add to the very bottom, outside of any function:
void LookAtDoor(string &in asTimer)
{
StopPlayerLookAt();
}
Now the third problem:
PlaySoundAtEntity("", "unlock_door", "mansion_5", 0.0f, true);
the sound needs its extension, or else it won't work. replace all of those functions with this:
PlaySoundAtEntity("", "unlock_door.snt", "mansion_5", 0.0f, true);
That's it. after this, it should work.
However, you can do great at decreasing the length of this script, by putting all UnlockDoor functions into a single one. But since you're unexperienced, you should stay by that at first.
I have fixed it now but it doesnt look at the door when i pick up they key. (key_3) it looks as soon as i enter the map. you know the cause of this? i can link my whole hps if u want
06-23-2012 02:27 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: