KingCrimson
Junior Member
Posts: 45
Threads: 14
Joined: Jul 2012
Reputation:
0
|
My locked door doesn't display a message?
I was using one of the tutorials at the wiki because i want a locked door to say "The lock's broken". But when i try to open the door, it doesn't display anything... Here you've a copy of my script:
Quote:void lockedoor(string &in entity)
{
if(GetSwingDoorLocked("locked1") == true)
{
SetMessage("Messages", "Broken", 0);
}
}
Some info that might be useful:
PlayerInteractCallback
Door's name
Category at extra_english.lang where the messages are
Name of the message
Thanks in advance...
Current Projects:
DADDY - 10%
|
|
07-08-2012, 04:29 AM |
|
Adny
Posting Freak
Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation:
173
|
RE: My locked door doesn't display a message?
Would you mind showing the full script? The problem most likely lies somewhere in the callback used; what you currently have shown is fine.
I rate it 3 memes.
|
|
07-08-2012, 04:35 AM |
|
KingCrimson
Junior Member
Posts: 45
Threads: 14
Joined: Jul 2012
Reputation:
0
|
RE: My locked door doesn't display a message?
You mean the map's script? If so, here it is:
Quote:////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "secret1", "door3", "unlock", true);
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
AddUseItemCallback("", "crowbar1", "crowdoor", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar2", "area1", "CollideAreaBreakDoor", true, 1);
SetEntityActive("crowbar_broken", true);
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door2", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
void unlock(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
}
void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("", 0.2, "TimerSwitchShovel");
RemoveItem("crowbar1");
}
void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("","puzzle_place_jar.snt", "", 0, false);
SetEntityActive("crowbar2", true);
}
void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(25);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("crowdoor", false, true);
AddPropImpulse("crowdoor", 0, 0, -50, "World");
SetSwingDoorDisableAutoClose("crowdoor", true);
SetSwingDoorClosed("crowdoor", false, false);
SetMoveObjectState("crowdoor", 1);
PlaySoundAtEntity("","break_wood_metal", "area2", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "area2", false);
SetEntityActive("crowbar2", false);
SetLocalVarInt("Door", 1);
}
void lockedoor(string &in entity)
{
if(GetSwingDoorLocked("locked1") == true)
{
SetMessage("Messages", "Broken", 0);
}
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
Current Projects:
DADDY - 10%
|
|
07-08-2012, 04:36 AM |
|
Adny
Posting Freak
Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation:
173
|
RE: My locked door doesn't display a message?
You do not have a callback in the script for the function "lockedoor"; would I be correct to assume that your have one in the level editor as "PlayerInteractCallback" for the door under the entity tab? If not, here is a callback you can use:
void OnStart()
{
SetEntityPlayerInteractCallback("locked1", "lockedoor", true);
}
Alternatively, you can set up an interact callback via the level editor (I prefer this method so I don't use up extra space in my hps file). Simply select any entity (a door in this case), go to the "entity" tab on the right, and in the box under "PlayerInteractCallback" type in anything (this will be the name of the function). You can write the rest of it in the hps file as:
void FUNC(string &in asEntity)
{
///do stuff
}
Hope that helped.
I rate it 3 memes.
|
|
07-08-2012, 04:43 AM |
|
KingCrimson
Junior Member
Posts: 45
Threads: 14
Joined: Jul 2012
Reputation:
0
|
RE: My locked door doesn't display a message?
(07-08-2012, 04:43 AM)andyrockin123 Wrote: You do not have a callback in the script for the function "lockedoor"; would I be correct to assume that your have one in the level editor as "PlayerInteractCallback" for the door under the entity tab? I have one in the level editor. Under the entity tab. It's there where i put lockedoor
Current Projects:
DADDY - 10%
|
|
07-08-2012, 04:47 AM |
|
Adny
Posting Freak
Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation:
173
|
RE: My locked door doesn't display a message?
Okay I tested the script using your method and it worked fine (although I replaced the set message function with a sound). Make sure "lockedoor" is written under PlayerInteractCallback and not CallbackFunc.
If your problem hasn't been solved yet it is most likely due to your lang file. If nothing has worked so far, please post your extra_english.lang
I rate it 3 memes.
|
|
07-08-2012, 04:55 AM |
|
KingCrimson
Junior Member
Posts: 45
Threads: 14
Joined: Jul 2012
Reputation:
0
|
RE: My locked door doesn't display a message?
I put it on PlayerInteractCallback. I'll paste here the .lang file so you check if everything's alright on it:
Quote:
[br]You wake up in an unknown room. You see things... things that cannot be real, but they are. What is going on? You see some cyanide by you... did you try to suicide?[br]Why? Will you be able to remember?
Bedroom
Dinning Room
Locked. Won't open without a key...
The lock is broken...
//KEYS
Might be this bedroom key?
¿Bedroom key?
Hallway Key
A key for the main hall.
Strange key
I wonder where it fits...
//BLOOD AND CHEMS
This door is locked.
Thank you for playing Suicide[br][br]
Made by ExenderVes[br][br]
Composed of:[br]
Level Design, Programming and Story: ExenderVes[br]
[br][br]
Demo Programming:[br]
[br][br]
Art:[br]
[br][br]
Voice Acting:
Bunnypoppop[br][br]
[br]
[br]
[br][br]
Special Thanks:[br][br]
[br]
[br]
[br]
[br]
[br]
[br]
[br]
[br]
[br]
[br]
PS: Most of it is empty, since i've not worked too much on scripts and the .lang file...
Current Projects:
DADDY - 10%
|
|
07-08-2012, 05:03 AM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: My locked door doesn't display a message?
If this is your Lang. file then i understand
You will have to read up on it!
The lang. should go like this:
<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">
This is a test of my description
</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_NAMEOFNOTE_Name">HEADLINE OF THE NOTE</Entry>
<Entry Name="Note_NAMEOFNOTE_Text">
THIS IS A TEST OF MY NOTE
</Entry>
<Entry Name="Note_NAMEOFNOTE_2_Name">HEADLINE</Entry>
<Entry Name="Note_NAMEOFNOTE_2_Text">
blablablablablabla
</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_NAMEOFKEY">KEY NAME</Entry>
<Entry Name="ItemDesc_NAMEOFKEY">This is my key description</Entry>
</CATEGORY>
</LANGUAGE>
Do you understand? It works like a script too.. <LANGUAGE> starts the whole file, and </LANGUAGE> ends it. <CATEGORY Name="something"> Starts a new category. </CATEGORY> ends a category.
I would say read a little bit more about it
Trying is the first step to success.
|
|
07-08-2012, 11:03 AM |
|
SilentHideButFine
Member
Posts: 156
Threads: 38
Joined: May 2012
Reputation:
6
|
RE: My locked door doesn't display a message?
(07-08-2012, 04:29 AM)ExenderVes Wrote: I was using one of the tutorials at the wiki because i want a locked door to say "The lock's broken". But when i try to open the door, it doesn't display anything... Here you've a copy of my script:
Quote:void lockedoor(string &in entity)
{
if(GetSwingDoorLocked("locked1") == true)
{
SetMessage("Messages", "Broken", 0);
}
}
Some info that might be useful:
PlayerInteractCallback
Door's name
Category at extra_english.lang where the messages are
Name of the message
Thanks in advance...
SetMessage(" Messages", " Broken", 3);
try with that!
|
|
07-08-2012, 03:08 PM |
|
KingCrimson
Junior Member
Posts: 45
Threads: 14
Joined: Jul 2012
Reputation:
0
|
RE: My locked door doesn't display a message?
(07-08-2012, 11:03 AM)beecake Wrote: If this is your Lang. file then i understand
You will have to read up on it!
The lang. should go like this:
This is a test of my description
HEADLINE OF THE NOTE
THIS IS A TEST OF MY NOTE
HEADLINE
blablablablablabla
KEY NAME
This is my key description
Do you understand? It works like a script too.. starts the whole file, and ends it. Starts a new category. ends a category.
I would say read a little bit more about it
I don't think the .lang is related to this. I would ask you to tell me where I can download one of those in blank. Since the one i have is one i took from a CS (I eliminated all the content from the CS).
Quote:quote='SilentHideButFine'
SetMessage("Messages", "Broken", 3);
try with that!
Didn't work
Current Projects:
DADDY - 10%
|
|
07-09-2012, 01:50 AM |
|
|