Frictional Games Forum (read-only)

Full Version: What would be the script for this?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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)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.


Tutorial for exactly what you need:
http://wiki.frictionalgames.com/hpl2/tut...cked_doors
Add in the script the following line:
Code:
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
(HasItem("KEYNAME") == true) should be (HasItem("KEYNAME")) since with the == true it will say if true then true
(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.


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