Frictional Games Forum (read-only)
No matching signatures to OnLeave? - 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: No matching signatures to OnLeave? (/thread-23262.html)



No matching signatures to OnLeave? - Efendi - 09-19-2013

Hello, i'm new here in forums, and also started recently learning to script for amnesia the dark descent.

I have encountered one little problem, that i don't know what to with.

I have one level first, where i spawn, then, i want to go to a level door, that brings me to 2:nd level, that worked first just fine. I then created a door, that should open by itself (That door is located in the 2:nd level), but now i get an error message: (This error message appeared when i opened the 2:nd level door)

FATAL ERROR: Could not load script file (The location of the script file, is in the right place, too lazy to write it down.)
ExecuteString (1,1): ERR : No matching signatures to OnLeave()' main (49,1): ERR : Unexpected end of file
.

Here is the codes:

2:nd map script codes

Spoiler below!
void OnStart()
{
AddEntityCollideCallback("Player", "DoorOpenSelf", "EventDoor", true, 1);
}

void Area51(string &in asEntity)
{
FadeOut(2);
AddTimer("", 2, "LoadMap");
}

void LoadMap(string &in asTimer)
{
ChangeMap("Tutorial.map", "Spawn", "", "");
}

void EventDoor(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("DoorOpen", false, false);
SetSwingDoorDisableAutoClose("DoorOpen", true);
PlaySoundAtEntity("creak", "joint_door_move_special", "DoorOpen", 1, false);

AddTimer("", 2, "TimerStopSound");
AddTimer("DoorOpen", 0, "TimerMoveDoor");

}

void TimerMoveDoor(string &in asTimer)
{
if(GetLocalVarInt("VarDoor") == 10) return;
AddLocalVarInt("VarDoor", 1);

AddTimer(asTimer, 0.03, ""TimerMoveDoor");

AddPropForce(asTimer, -70, 0, 0, "world");
}

void TimerStopSound(string &in asTimer)
{
StopSound("creak", 0.4);
}


first map script codes

Spoiler below!
void OnStart()

{

SetPlayerSanity(50);

AddUseItemCallback("", "key1", "door1", "UseKeyOnDoor", true);
AddUseItemCallback("", "keytest", "level1", "UseKeyOnDoor2", true);
AddUseItemCallback("", "BottleDone", "AreaUseItem", "UseItemOnTable", true);
AddUseItemCallback("", "crowbar", "door20", "UseCrowbarOnDoor", true);
AddEntityCollideCallback("Joint", "AreaBreak", "BreakDoor", true, 1);


AddEntityCollideCallback("Player", "AreaMemento", "AreaEvent", true, 1);
}

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{

SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
RemoveItem(asItem);


SetLocalVarInt("Check", 1);

//Quest disappears from the Journal
CompleteQuest("door", "memento3");
}
void UseKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked(asEntity, false);
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
RemoveItem(asItem);
GiveSanityBoostSmall();
}
void UseItemOnTable(string &in asItem, string &in asEntity)
{
RemoveItem(asItem);


SetEntityActive("BottleDoneStatic", true);
}
void PickKey(string &in asEntity, string &in type)
{

AddQuest("Key", "memento1");
}
void AreaEvent(string &in asParent, string &in asChild, int alState)
{
AddQuest("area", "memento2");
}
void DoorMemento(string &in asEntity)
{
if(GetLocalVarInt("Check") == 0)
{
AddQuest("door", "memento4");
}
}
void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
{
RemoveItem(asItem);
PlaySoundAtEntity("", "player_crouch.snt", "Player", 0.05, false);
AddTimer(asEntity, 0.2, "TimerPlaceCrowbar");
}

void TimerPlaceCrowbar(string &in asTimer)
{
SetEntityActive("Joint", true);
PlaySoundAtEntity("", "puzzle_place_jar.snt", asTimer, 0, false);
}

void BreakDoor(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Joint", false);
SetEntityActive("Broken", true);

SetSwingDoorLocked("door20", false, false);
SetSwingDoorClosed("door20", false, false);
SetSwingDoorDisableAutoClose("door20", true);

AddPropImpulse("door20", 0, 0, 3, "world");

CreateParticleSystemAtEntity("", "ps_hit_wood.ps", "AreaEffect", false);
PlaySoundAtEntity("", "break_wood_metal", "AreaEffect", 0, false);

GiveSanityBoostSmall();

PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);

AddTimer("", 0.1, "TimerPushDoor");
}

void TimerPushDoor(string &in asTimer)
{
AddPropImpulse("door20", -4, 2, 1, "world");
AddTimer("", 1.1, "TimerDoorCanClose");
}

void TimerDoorCanClose(string &in asTimer)
{
SetSwingDoorDisableAutoClose("door20", false);
}

Inventory.hps script file

Spoiler below!
void OnGameStart()
{

AddCombineCallback("bottle", "BottleA", "BottleB", "CombineBottles", true);
}

void CombineBottles(string &in asItemA, string &in asItemB)
{
RemoveItem(asItemA);
RemoveItem(asItemB);

GiveSanityBoost();


PlayGuiSound("12_make_drill", 1);


GiveItem("BottleDone", "Puzzle", "BottleDone", "glass_container_mix_done.tga", 1);
}



If someone could help me on this, i would be really grateful. Probably there is just one tiny wrong bit in this code, but i just can't see it Sad

Thanks in advance!!

EDIT: Forgot to mention that the Fatal Error screen comes when i try to open the 2:nd level door. The custom story launches correctly, when i have my player spawn at the first level. I don't think it is necessary for me to give the script codes to the first level, because everything works just fine at the first level. But anyone wants to see the codes to first level, i can post it here Smile


RE: No matching signatures to OnLeave? - PutraenusAlivius - 09-19-2013

How about you give us the whole code? A small fraction is not enough.

Also, if it's that big, put it in spoiler tags.
Like this:
Code:
[spoiler]*INSERT MESSAGE HERE*[/spoiler]

That code will appear as..
Spoiler below!
*INSERT MESSAGE HERE*



RE: No matching signatures to OnLeave? - Efendi - 09-19-2013

Edited. Thanks for the tip!


RE: No matching signatures to OnLeave? - Daemian - 09-19-2013

Here:
Quote:void TimerMoveDoor(string &in asTimer)
{
if(GetLocalVarInt("VarDoor") == 10) return;
AddLocalVarInt("VarDoor", 1);

AddTimer(asTimer, 0.03, ""TimerMoveDoor");

AddPropForce(asTimer, -70, 0, 0, "world");
}

Put return between { }
And remove the extra "

I think that's all.


RE: No matching signatures to OnLeave? - Efendi - 09-19-2013

Thank you for your help! It was enough by removing the extra ", my poor lazy eyes Tongue