Frictional Games Forum (read-only)
Error when loading second map - 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: Error when loading second map (/thread-52908.html)



Error when loading second map - Ubermensch - 10-16-2016

So I just finished scripting my first map. Here's the .hps file:

Spoiler below!
void OnStart()
{
AddUseItemCallback("", "lockpick", "introcelldoor", "UseKeyOnDoor", true);
AddUseItemCallback("", "BlockBKey", "BlockB", "UseKeyOnLevelDoor", true);
}

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

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

void UseKeyOnLevelDoor(string &in asItem, string &in asEntity)

{
SetLevelDoorLocked(asEntity, false);
PlaySoundAtEntity("", "door_sewer_unlock.snt", asEntity, 0, false);
RemoveItem(asItem);
CompleteQuest("touchblockdoor", "BlockBLocked");
GiveSanityBoost();
}

void touchblockdoor(string &in asEntity)

{
AddQuest("touchblockdoor", "BlockBLocked");
}

After that, I made the .hps file for my second map. Here it is:

Spoiler below!
void OnStart()
{
SetEntityPlayerLookAtCallback("", "lookatcorpse", true);
}

void lookatcorpse(string &in asEntity, 1)

{
GiveSanityDamage(25.0f, true)
}

The issue here is that the second map does not load. Since I'm pretty new to the editor and scripting it could be a little bit silly. Anyways, the error that shows up is:

Spoiler below!
FATAL ERROR
Couldn't load (map name and directory here)
ExecuteString (1,1): ERR : No matching signatures to 'OnLeave()'
main (6, 40) : ERR : Expected data type


I did try some things, but I'm kinda lost here so any help is appreciated! Tongue

p.s: looks like I posted in the wrong section. my bad. Confused


RE: Error when loading second map - Mudbill - 10-16-2016

The issue is that your parameters for your "lookatcorpse" function are incorrect. You're not supposed to edit anything in the parameters after you copy them to your script because they need to match what is required by the function call.

SetEntityPlayerLookAtCallback requires these parameters:

void MyFunc(string &in asEntity, int alState)

So that's what you must use. Replace the 1 with "int alState".

Also, in your OnStart, you didn't specify which entity the player must look at to call this event, so it will never happen.


RE: Error when loading second map - Ubermensch - 10-16-2016

(10-16-2016, 10:24 PM)Mudbill Wrote: The issue is that your parameters for your "lookatcorpse" function are incorrect. You're not supposed to edit anything in the parameters after you copy them to your script because they need to match what is required by the function call.

SetEntityPlayerLookAtCallback requires these parameters:

void MyFunc(string &in asEntity, int alState)

So that's what you must use. Replace the 1 with "int alState".

Also, in your OnStart, you didn't specify which entity the player must look at to call this event, so it will never happen.

Hm... Thanks! I'll let you know how it went when I modify the script.


RE: Error when loading second map - Mudbill - 10-17-2016

By the way, in case you haven't yet, just look at the engine scripts page for all the references of what the callback syntaxes are.

https://wiki.frictionalgames.com/doku.php?id=hpl2/amnesia/script_functions


RE: Error when loading second map - Ubermensch - 10-17-2016

Oh, it worked!

Thanks a bunch. Big Grin


RE: Error when loading second map - Romulator - 10-17-2016

Your friendly neighbourhood moderator here;

Don't worry about the posting in the wrong section Smile Eventually myself or someone else will move it for you Smile Glad to hear you got your issue solved!