This shows you the differences between two versions of the page.
Next revision | Previous revision Last revision Both sides next revision | ||
hpl2:tutorials:script:adding_messages_to_locked_doors [2012/03/15 11:03] claypigeon created |
hpl2:tutorials:script:adding_messages_to_locked_doors [2012/04/01 16:48] claypigeon [The door] |
||
---|---|---|---|
Line 17: | Line 17: | ||
- | <Entry Name ="msgname">TYPE MESSAGE HERE</Entry> | + | <Entry Name ="msgname">TYPE MESSAGE HERE</Entry> |
Line 29: | Line 29: | ||
- | The door | + | ====== The door ====== |
Line 47: | Line 47: | ||
- | ====== The script ====== | + | Under General tab, name the door to whatever you want. |
- | Open up your mapname.hps that is on your AmnesiaFolder/redist/custom_stories/yourstory/maps, with notepad++ or whatever editor that fits for you, and now write this under the last '}' you see on the text: | + | I'll call it "EXAMPLE_DOOR". |
- | void DoorLockedPlayer(string &in entity) | + | {{http://oi43.tinypic.com/656cs3.jpg?nolink&}} |
+ | ====== The script ====== | ||
- | { | ||
- | + | Open up your mapname.hps that is on your AmnesiaFolder/redist/custom_stories/yourstory/maps, with notepad++ or whatever editor that fits for you, and now write this under the last '}' you see on the text: | |
- | SetMessage("Messages", "msgname", 0); | + | |
+ | <code c++> | ||
+ | |||
+ | void DoorLockedPlayer(string &in entity) | ||
+ | |||
+ | |||
+ | { | ||
+ | if(GetSwingDoorLocked("EXAMPLE_DOOR") == true) | ||
+ | { | ||
+ | |||
+ | SetMessage("Messages", "msgname", 0); | ||
+ | |||
+ | } | ||
} | } | ||
+ | </code> | ||
Line 68: | Line 80: | ||
- | void DoorLockedPlayer - this is the function that is called when the player interacts with the door | + | void DoorLockedPlayer - this is the function that is called when the player interacts with the door (the one you've set in your level editor!) |
+ | |||
+ | |||
+ | GetSwingDoorLocked - We are checking wheter the doors is locked or not, so we won't get the message even when it's unlocked and interacted with. "EXAMPLE_DOOR" is the name of the door that we have given it earlier! | ||
Line 74: | Line 89: | ||
- | "msgname" - this is the name of the message we've set earlier, remember? | + | "msgname" - this is the name of the message we've set earlier, remember? |
Line 81: | Line 96: | ||
PM me for any help, my forum account: ClayPigeon. | PM me for any help, my forum account: ClayPigeon. | ||
- | |||
- | |||
- | {{http://imageupload.org/en/file/200699/wiki.png.html}} | ||