Frictional Games Forum (read-only)
Callback help? - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Callback help? (/thread-7978.html)

Pages: 1 2 3


Callback help? - WatzUpzPeepz - 05-13-2011

How exactly would I go about doing this?
When I interact with a locked door a message appears?
My current code doesnt work.
I just get:Unexpected end of file error report?
This is what I have:

"void InteractOfficeDoor (string &in asEntity)
{
}
if(GetSwingDoorLocked("OfficeDoor")== true)
{
SetMessage("Map4", "OfficeDoorMessage", 5.0f);
}"
which is at the end of the script

I have this at the voidOnStart

"SetEntityPlayerInteractCallback("OfficeDoor", "InteractOfficeDoor", true);"

The error is comming from the } at the end of file,If that helps!


RE: Callback help? - Anxt - 05-13-2011

You never closed your InteractStudyDoor function. Add another "}" after the if statement and you should be set.


RE: Callback help? - WatzUpzPeepz - 05-13-2011

(05-13-2011, 08:59 PM)Anxt Wrote: You never closed your InteractStudyDoor function. Add another "}" after the if statement and you should be set.

I made the change(as now shown above) but I still get the same thingSad
I have no idea of scripting what so ever, so I wouldn't even see the most obvious mistake.


RE: Callback help? - Anxt - 05-13-2011

Did you make sure you closed your OnStart function as well? Unexpected end of file almost always, if not always, means you are missing a bracket. Check every function for an opening and a close.


RE: Callback help? - Karai16 - 05-13-2011

Try putting this in your file, instead of what you have
Code:
void InteractOfficeDoor (string &in asEntity)
{
if(GetSwingDoorLocked("OfficeDoor")== true)
{
  SetMessage("Map4", "OfficeDoorMessage", 5.0f);
}
}



RE: Callback help? - Roenlond - 05-13-2011

(05-13-2011, 09:11 PM)Anxt Wrote: Did you make sure you closed your OnStart function as well? Unexpected end of file almost always, if not always, means you are missing a bracket. Check every function for an opening and a close.

It is also possible that you have a left-over quotation mark around for example a bool. i.e AddDebugMessage("Message", false");

That would produce the same result.


RE: Callback help? - Anxt - 05-13-2011

Oh, thank you Karai. I didn't even notice that his if statement wasn't in the function anymore.

Listen to her, Watz Smile


RE: Callback help? - WatzUpzPeepz - 05-13-2011

Thanks man but Its not helping,Ill be fine without itUndecided


RE: Callback help? - Karai16 - 05-13-2011

(05-13-2011, 09:21 PM)WatzUpzPeepz Wrote: Thanks man but Its not helping,Ill be fine without itUndecided

Can you put up your entire code please? I have a great eye for detail, maybe I can see what's wrong


RE: Callback help? - WatzUpzPeepz - 05-13-2011

Yea here ya go:
void OnStart()
{
AddUseItemCallback("", "crowbar_1", "door1", "KeyOnDoor", true);
AddUseItemCallback("", "key1", "door3", "KeyOnClosetDoor", true);
AddEntityCollideCallback("Player", "DoorSlamArea", "CollideDoorSlam", true, 1);
SetEntityPlayerInteractCallback("OfficeDoor", "InteractOfficeDoor", true);"
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "break_wood.snt", "door1", 0.0f, true);
}


void KeyOnClosetDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door3", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door3", 0.0f, true);
}

void CollideDoorSlam(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("door3", 10, 50, "");
AddTimer("", 0.5f, "TimerSlamDoor");
SetEntityActive("ParticleSystem_1" , true);
}
void TimerSlamDoor(string &in asTimer)
{
SetSwingDoorLocked("door2", true, true);
SetSwingDoorClosed("door3", true, true);
GiveSanityDamage(4.0f, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
AddTimer("", 2.0f, "TimerStopLook");
SetEntityActive("armour2", true);
SetEntityActive("armour1", false);
}

void TimerStopLook(string &in asTimer)
{
StopPlayerLookAt();
}

void InteractOfficeDoor (string &in asEntity)
{
if(GetSwingDoorLocked("OfficeDoor")== true)
{
SetMessage("Map4", "OfficeDoorMessage", 5.0f);
{
}