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

Posts: 15
Threads: 8
Joined: Apr 2012
Reputation: 0
#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
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#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
Knittel Offline
Junior Member

Posts: 8
Threads: 1
Joined: Apr 2012
Reputation: 0
#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
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#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
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#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
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#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
Knittel Offline
Junior Member

Posts: 8
Threads: 1
Joined: Apr 2012
Reputation: 0
#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 :p

[Image: 2ZwH0ZGD0AwL2.png]
[TRACKMANIA]


04-28-2012, 09:14 PM
Find




Users browsing this thread: 3 Guest(s)