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 would be the script for this?
Author Message
GetHimNotMe Offline
Junior Member

Posts: 15
Joined: Apr 2012
Reputation: 0
Post: #1
What would be the script for this?

I want to do it so the when you try to open a locked door it will display a message only when you have a certain item. For example, you try to open door. It says "it's locked" when you pick up a key and try to open the door again it would say "try using the key to open the door" instead. It would say "try using the key to open the door" only when you have the key. What script would you type for that? (I'm a newbie with scripting).
04-28-2012 04:27 AM
Find all posts by this user Quote this message in a reply
Cranky Old Man Offline
Posting Freak

Posts: 922
Joined: Apr 2012
Reputation: 37
Post: #2
RE: What would be the script for this?

(04-28-2012 04:27 AM)GetHimNotMe Wrote:  I want to do it so the when you try to open a locked door it will display a message only when you have a certain item. For example, you try to open door. It says "it's locked" when you pick up a key and try to open the door again it would say "try using the key to open the door" instead. It would say "try using the key to open the door" only when you have the key. What script would you type for that? (I'm a newbie with scripting).
You describe exactly what happens when you try to open a door in the first hub. Have you checked out how Frictional Games did it?
You can't except us to write an entire script for you, though. At least write as much of the script as you can, and we'll fill in the gaps.

Noob scripting tutorial: From Noob to Pro

04-28-2012 04:34 AM
Find all posts by this user Quote this message in a reply
Knittel Offline
Junior Member

Posts: 8
Joined: Apr 2012
Reputation: 0
Post: #3
RE: What would be the script for this?

Tutorial for exactly what you need:
http://wiki.frictionalgames.com/hpl2/tut...cked_doors
Add in the script the following line:
void DoorLockedPlayer(string &in entity)
{
    if(GetSwingDoorLocked("EXAMPLE_DOOR") == true)
    {  if (HasItem("KEYNAME") == true) SetMessage("Messages", "msgnameA", 0);  else  SetMessage("Messages", "msgnameB", 0);
    }
}
And BTW, here is a complete Tutorial for Scripting etc. (in English)
http://www.frictionalgames.com/forum/thread-10798.html
Here would be a complete Tutorial (in German) for the complete editor instead of only scripting but not that extensive as the other tutorial:
http://www.youtube.com/watch?v=_sHYeUJ93...plpp_video

[Image: 2ZwH0ZGD0AwL2.png]
[TRACKMANIA]


04-28-2012 07:18 AM
Find all posts by this user Quote this message in a reply
SilentStriker Offline
Posting Freak

Posts: 950
Joined: Jul 2011
Reputation: 42
Post: #4
RE: What would be the script for this?

(HasItem("KEYNAME") == true) should be (HasItem("KEYNAME")) since with the == true it will say if true then true

04-28-2012 09:32 AM
Find all posts by this user Quote this message in a reply
Cranky Old Man Offline
Posting Freak

Posts: 922
Joined: Apr 2012
Reputation: 37
Post: #5
RE: What would be the script for this?

(04-28-2012 09:32 AM)SilentStriker Wrote:  (HasItem("KEYNAME") == true) should be (HasItem("KEYNAME")) since with the == true it will say if true then true
Don't you mean "if true == true"? It's small matter of fewer characters versus readability. You're making it sound like an error.

Noob scripting tutorial: From Noob to Pro

04-28-2012 01:49 PM
Find all posts by this user Quote this message in a reply
SilentStriker Offline
Posting Freak

Posts: 950
Joined: Jul 2011
Reputation: 42
Post: #6
RE: What would be the script for this?

(04-28-2012 01:49 PM)Cranky Old Man Wrote:  
(04-28-2012 09:32 AM)SilentStriker Wrote:  (HasItem("KEYNAME") == true) should be (HasItem("KEYNAME")) since with the == true it will say if true then true
Don't you mean "if true == true"? It's small matter of fewer characters versus readability. You're making it sound like an error.
Well my english isn't flawless so I may have used the wrong words ^^ What I meen is that you don't need the == true since the if(HasItem("NAMEOFKEY")) already is a true statement Smile

04-28-2012 09:07 PM
Find all posts by this user Quote this message in a reply
Knittel Offline
Junior Member

Posts: 8
Joined: Apr 2012
Reputation: 0
Post: #7
RE: What would be the script for this?

Normally and in all of my pascal programs I'm doing it also that way (if HasItem then), but I thought Amnesia would need it in that way (if HasItem == true).
Well thanks for telling. No I can save time Tongue

[Image: 2ZwH0ZGD0AwL2.png]
[TRACKMANIA]


04-28-2012 09:14 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: