Frictional Games Forum (read-only)
a function with same name and function alrdy exist? - 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: a function with same name and function alrdy exist? (/thread-16436.html)



a function with same name and function alrdy exist? - Hartmann - 06-23-2012

Im getting an error saying that a function with the same name and functions alrd exist. cna you help. here is my script

void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddUseItemCallback("", "key_4", "castle_no_grav_1", "KeyOnDoor", true);
AddUseItemCallback("", "bone_saw_1", "wooden_boards_block_1", "DestroyParticleSystem", true);
AddTimer("StopLook", 4, "LookAtSaw");
}

void DestroyParticleSystem(string& asName)
{
PlaySoundAtEntity("", "saw", "wooden_boards_block_1", 0.0f, true);
RemoveItem("bone_saw_1");
}


void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_no_grav_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_no_grav_1", 0.0f, true);
RemoveItem("key_4");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

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


RE: a function with same name and function alrdy exist? - Your Computer - 06-23-2012

void DestroyParticleSystem(string& asName) is a predefined function of Amnesia. You have the wrong syntax callback for it; it's supposed to take in two strings.


RE: a function with same name and function alrdy exist? - Hartmann - 06-23-2012

(06-23-2012, 04:22 PM)Your Computer Wrote: void DestroyParticleSystem(string& asName) is a predefined function of Amnesia. You have the wrong syntax callback for it; it's supposed to take in two strings.
Its supposed to destroy some wooden planks. you know what syntax calldback i shall use instead?


RE: a function with same name and function alrdy exist? - SilentStriker - 06-23-2012

if it's AddUseItemCallback it's (string &in asItem, string &in asEntity)


RE: a function with same name and function alrdy exist? - Hartmann - 06-23-2012

(06-23-2012, 04:41 PM)SilentStriker Wrote: if it's AddUseItemCallback it's (string &in asItem, string &in asEntity)
i am sorry i dotn quite get yor answer it is supposed to destroy some wooden planks. i currenlt have void DestroyParticleSystem(string& asName); What shall i use instead of that


RE: a function with same name and function alrdy exist? - SilentStriker - 06-23-2012

DestroyParticleSystem(string &in asItem, string &in asEntity)


RE: a function with same name and function alrdy exist? - Cruzore - 06-23-2012

Change the name of the function too. DestroyParticleSystem is, like Your Computer said, a predefined one, you can't use it.

Edit: Or maybe it works with a other syntax, I don't know.


RE: a function with same name and function alrdy exist? - Hartmann - 06-23-2012

(06-23-2012, 05:17 PM)FastHunteR Wrote: Change the name of the function too. DestroyParticleSystem is, like Your Computer said, a predefined one, you can't use it.

Edit: Or maybe it works with a other syntax, I don't know.
i dont know what syntax to use that is supposed to destry the wooden planks


RE: a function with same name and function alrdy exist? - Cruzore - 06-23-2012

..Just change the name and you're good. But since you probably have no idea what even a function is:
void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddUseItemCallback("", "key_4", "castle_no_grav_1", "KeyOnDoor", true);
AddUseItemCallback("", "bone_saw_1", "wooden_boards_block_1", "DestroyPlank", true);
StartPlayerLookAt("bone_saw_1", 2, 2, "");

AddTimer("StopLook", 4, "LookAtSaw");
}

void DestroyPlank(string &in asItem, string &in asEntity)
{
PlaySoundAtEntity("", "26_saw.snt", "wooden_boards_block_1", 0.0f, true);
RemoveItem("bone_saw_1");
AddTimer("", 4, "DestroyPlank2");
}
void DestroyPlank2(string &in asTimer)
{
SetEntityActive("wooden_boards_block_1", false);
}

void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_no_grav_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_no_grav_1", 0.0f, true);
RemoveItem("key_4");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

void LookAtSaw(string &in asTimer)
{
StopPlayerLookAt();
}
With such scripting skills, don't expect anything better than dissapearing wooden planks. You should look at some tutorials at http://wiki.frictionalgames.com/hpl2/amnesia/script_functions


RE: a function with same name and function alrdy exist? - Hartmann - 06-23-2012

(06-23-2012, 05:28 PM)FastHunteR Wrote: ..Just change the name and you're good. But since you probably have no idea what even a function is:
void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddUseItemCallback("", "key_4", "castle_no_grav_1", "KeyOnDoor", true);
AddUseItemCallback("", "bone_saw_1", "wooden_boards_block_1", "DestroyPlank", true);
StartPlayerLookAt("bone_saw_1", 2, 2, "");

AddTimer("StopLook", 4, "LookAtSaw");
}

void DestroyPlank(string &in asItem, string &in asEntity)
{
PlaySoundAtEntity("", "26_saw.snt", "wooden_boards_block_1", 0.0f, true);
RemoveItem("bone_saw_1");
AddTimer("", 4, "DestroyPlank2");
}
void DestroyPlank2(string &in asTimer)
{
SetEntityActive("wooden_boards_block_1", false);
}

void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_no_grav_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_no_grav_1", 0.0f, true);
RemoveItem("key_4");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

void LookAtSaw(string &in asTimer)
{
StopPlayerLookAt();
}
With such scripting skills, don't expect anything better than dissapearing wooden planks. You should look at some tutorials at http://wiki.frictionalgames.com/hpl2/amnesia/script_functions
Thank youSmile