Frictional Games Forum (read-only)
2 Script error - 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: 2 Script error (/thread-8900.html)



2 Script error - Hellday - 07-01-2011

Hello, first sorry for my bad english, i'm French.
I've a problem with my script, one is for a locked door and key, the other spawn a monster. They work perfectly but when I put them both in my .hps i've a fatal error.

void OnStart()
{

SetEntityPlayerInteractCallback("lantern_1", "Spawn_Monster", true);

}

void Spawn_Monster(string &in entity)
{

SetEntityActive("servant_grunt_1", true);
}

void UseKey(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);

RemoveItem(asItem);
}


void OnStart()
{

AddUseItemCallback("useexit", "key_1", "coffre", "UseKey",true);

Thanks for reply.


RE: 2 Script error - TFEF - 07-01-2011

Try removing the second OnStart function and putting the AddItemUseCallback into the brackets.


RE: 2 Script error - Hellday - 07-01-2011

Like this :

void OnStart()
{

SetEntityPlayerInteractCallback("lantern_1", "Spawn_Monster", true);

}

void Spawn_Monster(string &in entity)
{

SetEntityActive("servant_grunt_1", true);
}

void UseKey(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
AddUseItemCallback("useexit", "key_1", "coffre", "UseKey",true);
RemoveItem(asItem);
}
?
Thanks their is no crash but my ket doesn't works Sad


RE: 2 Script error - TFEF - 07-01-2011

You should replace the asEntity in SetSwingDoorLocked with the name of the door I think. I might be wrong, it's really early here and I've been awake all night. Or just remove that altogether and set the door locked in the Level Editor.

Put the AddUseItemCallback on it's own, outside of the function.


RE: 2 Script error - HumiliatioN - 07-01-2011

(07-01-2011, 12:04 PM)Hellday Wrote: Like this :

void OnStart()
{

SetEntityPlayerInteractCallback("lantern_1", "Spawn_Monster", true);

}

void Spawn_Monster(string &in entity)
{

SetEntityActive("servant_grunt_1", true);
}

void UseKey(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
AddUseItemCallback("useexit", "key_1", "coffre", "UseKey",true);
RemoveItem(asItem);
}
?
Thanks their is no crash but my ket doesn't works Sad


Try this: OnStart inside the brackets like this:

void OnStart()
{
AddUseItemCallback("useexit", "key_1", "coffre", "UseKey",true);
SetEntityPlayerInteractCallback("lantern_1", "Spawn_Monster", true);
}


void OnEnter()
{
}


void Spawn_Monster(string &in entity)
{
SetEntityActive("servant_grunt_1", true);
}

void UseKey(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("name of the door?", false, true);
RemoveItem(asItem);
PlaySoundAtEntity("", "unlock_door.snt", "name of the door?", 0.0f, true);
}

That should do it.




RE: 2 Script error - Hellday - 07-01-2011

Thanks you so much !! It works !
So now I want to play 2 .ogg at the same time, what should I do ?


RE: 2 Script error - HumiliatioN - 07-01-2011

(07-01-2011, 05:35 PM)Hellday Wrote: Thanks you so much !! It works !
So now I want to play 2 .ogg at the same time, what should I do ?

Sorry i cant help you continuosly but search this link for functions and you can found there that "Play music scripts easily" Smile

http://wiki.frictionalgames.com/hpl2/amnesia/script_functions