Frictional Games Forum (read-only)
Noob in trouble! - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Noob in trouble! (/thread-14757.html)

Pages: 1 2 3 4


RE: Noob in trouble! - Macetrow - 04-14-2012

I tried that, but it didn't work either. This is quite frustrating xD I'm really grateful that someone is trying to help me with this!


RE: Noob in trouble! - zombiehacker595 - 04-14-2012

(04-14-2012, 09:41 AM)Macetrow Wrote: I tried that, but it didn't work either. This is quite frustrating xD I'm really grateful that someone is trying to help me with this!


AddUseItemCallback("", "key_1", "mansion_3", "UsedKeyOnDoor", true);

change that to this

AddUseItemCallback("OpenDoor", "key_1", "mansion_3", "UsedKeyOnDoor", true);

in your script you didnt have OpenDoor which will mean it wont work if this still doesnt work i have no idea whats wrong



RE: Noob in trouble! - Datguy5 - 04-14-2012

Btw heres an offtopic questionBig Grinoes your door display a message when you interact with it and its locked?Because mine doesnt Sad



RE: Noob in trouble! - Macetrow - 04-14-2012

Quote:
zombiehacker595
Wrote:
Quote:AddUseItemCallback("", "key_1", "mansion_3", "UsedKeyOnDoor", true);

change that to this

AddUseItemCallback("OpenDoor", "key_1", "mansion_3", "UsedKeyOnDoor", true);

in your script you didnt have OpenDoor which will mean it wont work if this still doesnt work i have no idea whats wrong
I tried it, but nothing changed.


Quote: Btw heres an offtopic questionBig Grinoes your door display a message when you interact with it and its locked?Because mine doesnt [Image: sad.gif]
Add a category in your .lang file with something like:

<CATEGORY Name="Messages">
<Entry Name="msgname1">This door is locked, you need the key to go through.</Entry>
</CATEGORY>
And make sure you have something like this in your script:

void DoorLockedPlayer(string &in entity)
{
if(GetSwingDoorLocked("mansion_3") == true)
{

SetMessage("Messages", "msgname1", 0);

}
}

This is what i'm using and it's working.



RE: Noob in trouble! - Datguy5 - 04-14-2012

(04-14-2012, 03:55 PM)Macetrow Wrote:
Quote:
zombiehacker595
Wrote:
Quote:AddUseItemCallback("", "key_1", "mansion_3", "UsedKeyOnDoor", true);

change that to this

AddUseItemCallback("OpenDoor", "key_1", "mansion_3", "UsedKeyOnDoor", true);

in your script you didnt have OpenDoor which will mean it wont work if this still doesnt work i have no idea whats wrong
I tried it, but nothing changed.


Quote: Btw heres an offtopic questionBig Grinoes your door display a message when you interact with it and its locked?Because mine doesnt [Image: sad.gif]
Add a category in your .lang file with something like:

<CATEGORY Name="Messages">
<Entry Name="msgname1">This door is locked, you need the key to go through.</Entry>
</CATEGORY>
And make sure you have something like this in your script:

void DoorLockedPlayer(string &in entity)
{
if(GetSwingDoorLocked("mansion_3") == true)
{

SetMessage("Messages", "msgname1", 0);

}
}

This is what i'm using and it's working.


I have it exactly like that.The messages name in my lang is msgname and in the hps heres the part of my script:
void Lol(string &in entity)


{
if(GetSwingDoorLocked("Baws") == true)
{

SetMessage("Messages", "msgname", 0);

}
}




RE: Noob in trouble! - Macetrow - 04-14-2012

Are you sure you've got msgname in your .lang file as well?

Also, check if you've typed your function into the "PlayerInteractCallback" box on your door in the Level Editor?


RE: Noob in trouble! - Datguy5 - 04-14-2012

(04-14-2012, 04:12 PM)Macetrow Wrote: Are you sure you've got msgname in your .lang file as well?

Also, check if you've typed your function into the "PlayerInteractCallback" box on your door in the Level Editor?


Yes i have done those both.In my lang file its msgname and in the script its like that.



RE: Noob in trouble! - Macetrow - 04-14-2012

Then i don't know why it doesn't work.


RE: Noob in trouble! - Datguy5 - 04-14-2012

(04-14-2012, 05:51 PM)Macetrow Wrote: Then i don't know why it doesn't work.

Ok.But thanks anyways.


RE: Noob in trouble! - DRedshot - 04-14-2012

This is a long-shot, but try it anyways:

Code:
void OnStart()
{
AddUseItemCallback("", "key_1", "mansion_3", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
}

void UsedKeyOnDoor(string &in item, string &in entity)
{
SetSwingDoorLocked(entity, false, true);
PlaySoundAtEntity("", "unlock_door.snt", entity, 0, false);
RemoveItem(item);
AddDebugMessage("Key has been used, is door unlocked?" , false);
}

Check if the debug message shows up when you unlock the door. If it doesn't, there is a problem with the AddUseItemCallback, if it does, the problem is related to the SetSwingDoorLocked function.
Also, make sure you are hitting enter when you type the entity name in the Level Editor. It sounds like an obvious thing to say, but so many times I have had these mysterious problems because I forgot to hit enter and the entities name doesn't register.