Frictional Games Forum (read-only)

Full Version: 2 Script error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
Try removing the second OnStart function and putting the AddItemUseCallback into the brackets.
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
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.
(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.

Thanks you so much !! It works !
So now I want to play 2 .ogg at the same time, what should I do ?
(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/amn..._functions