Frictional Games Forum (read-only)

Full Version: Help with script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi im new here in this forum and im pretty new to the this custom story editor and I think this is pretty funny, but i got this scripting problem that has been bothering me for a while.. I am trying to make a grunt appear when I pick up a certian key and make the kety fit into a door like they do in this tutorial: http://wiki.frictionalgames.com/hpl2/tut...[]=monster
I have followed and read the whole page a couple of times now and I still got problems..(There may be something I have missed. Im good at missing stuff I read)
This is the error I get:

FATAL ERROR: Could not load script file `MyMaps/Firstmap.hps`!
Main(7,3): ERR A function with the same name and parameters already exist.
Main(12,1): ERR A function with the same name and parameters already exist.

Main(23,3): ERR A function with the same name and parameters already exist.

Main(28,3): ERR A function with the same name and parameters already exist.

Main(14,3): ERR No matching signatures to `AddUseItemCallback(string@&,string@&,string@&, const bool)`


I know those first Errors seems kind of obvious but I have tried to do something about it by deleting some void OnStart just to check if that worked, but sadly it didnt.

Here is my script if you are considering to help Smile


////////////////////////////
// Run when entering map
void OnStart()
{
AddUseItemCallback("", "corridorkey_1", "keydoor_1", "UsedKeyOnDoor", true);
}
void OnStart()
{
AddUseItemCallback("", "corridorkey_1", "keydoor_1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("corridorkey_1", "OnPickup");
}
void OnStart()
{
AddUseItemCallback("corridorkey_1", "keydoor_1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("corridorkey_1", "OnPickup");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("keydoor_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "keydoor_1", 0, false);
RemoveItem("corridorkey_1");
}
void OnStart()
{
AddUseItemCallback("", "corridorkey_1", "keydoor_1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("corridorkey_1", "OnPickup");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("keydoor_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "keydoor_1", 0, false);
RemoveItem("corridorkey_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("gruntyboy_1", true);
ShowEnemyPlayerPosition("gruntybot1");
}

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


Thx anyway Smile
Well, you didn't delete enough OnStart functions. You're only supposed to have one (with the same return type and parameters). You also misused AddUseItemCallback on the third OnStart.
Thx for a fast reply!
Ok ill try deleting all those OnStarts again but you said I missused the Callback, how?
(02-14-2012, 07:09 AM)chriiisss Wrote: [ -> ]Ok ill try deleting all those OnStarts again but you said I missused the Callback, how?

Look at the third time you used AddUseItemCallback and compare it with all the other times you used it. See a difference? The third one is missing an argument.
Ok got it to work now Smile Thx for the help, it is really appreciated.