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


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

(05-13-2011, 09:59 PM)WatzUpzPeepz Wrote: 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);
{
}

found it, there's a slight typo, here you go:

Code:
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);
    }
}



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

Thanks for trying but it still didn't work,oh well Its not that important.


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

(05-13-2011, 10:19 PM)WatzUpzPeepz Wrote: Thanks for trying but it still didn't work,oh well Its not that important.

have you tried deleting the cache file before testing?
----
EDIT: Also, can you maybe give us a picture of the error you're getting?


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

Epic noob moment comming.....whats that? Huh

Here is that error report I keep getting


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

(05-13-2011, 10:25 PM)WatzUpzPeepz Wrote: Epic noob moment comming.....whats that? Huh

go to the folder with all your custom story files (map_name.hps, map_name.map etc) if there's a map_name.cache file there, delete it, then try testing out the code again
If that isn't working, give us a picture of the error you're getting... not to sound all serious and all, but it's personal now... Sad I'm not letting a computer win any argument whatsoever!


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

No cache file but I got the picture you asked for.


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

(05-13-2011, 10:30 PM)WatzUpzPeepz Wrote: No cache file but I got the picture you asked for.

hmm, and you already tried deleting everything in your hps file, and replace it with the code I gave you?


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

Code:
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);
    }
}

Try that, there was a bad quotation mark in there Smile


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

You're right! I see it! That should put an end to your trouble!


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

Oh lord that has made it even worse,now it crashes at the ( on the voidOnStart.
(05-13-2011, 10:39 PM)Karai16 Wrote:
(05-13-2011, 10:30 PM)WatzUpzPeepz Wrote: No cache file but I got the picture you asked for.

hmm, and you already tried deleting everything in your hps file, and replace it with the code I gave you?

YesSad now that I removed the extra " its now crashing at the voidOnStart

I'd like to thank all of you for helping me to get this troublesum script under control