Frictional Games Forum (read-only)

Full Version: How to make two scripts? Need help!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to create two different script in my .hps file, but when I running a map, game shows fatal error:
main (12,1): ERR: Unexpected token '{'
main (17,1): ERR: Unexpected token '{'

What's wrong with it? Please, help. Could you explain how to make different scripts and, if you have time, fix those two? (to example how make scripts). Btw, sorry for my (maybe) bad English Big Grin
Here's a script:

////////////////////////////
// Run when starting map
void OnStart()
{
AddUseItemCallback("", "basementkey_1", "basement_1", "KeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("basement_1", false, true);
PlaySoundAtEntity("", "unlock_door", "basement_1", 0, false);
}
{
AddEntityCollideCallback("Player", "tp_1", "DeadOne", true, 1);
}

void DeadOne(string &in asParent, string &in asChild, int alStates);
{
SetEntityActive("GhostOne", true);
AddPropForce("GhostOne", 0, 0, -10000, "world");
PlaySoundAtEntity("", "24_iron_maiden.snt", "GhostOne", 0, false);
}



////////////////////////////
// Run when entering map
void OnEnter()
{

}


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

}
////////////////////////////
// Run when starting map
void OnStart()
{
AddUseItemCallback("", "basementkey_1", "basement_1", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "tp_1", "DeadOne", true, 1);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("basement_1", false, true);
PlaySoundAtEntity("", "unlock_door", "basement_1", 0, false);
}




void DeadOne(string &in asParent, string &in asChild, int alStates);
{
SetEntityActive("GhostOne", true);
AddPropForce("GhostOne", 0, 0, -10000, "world");
PlaySoundAtEntity("", "24_iron_maiden.snt", "GhostOne", 0, false);
}



////////////////////////////
// Run when entering map
void OnEnter()
{

}


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

}
Very nice script I have to say! The mistake is very simple.
AddEntityCollideCallback("Player", "tp_1", "DeadOne", true, 1); script should be under the function: "void OnStart ()"
Do i sense irony?
Thanks for help! GoranGaming, I use your script, but there's another fatal error:
main (19,1):ERR:Unexpected token '{'

What should I do?
void DeadOne(string &in asParent, string &in asChild, int alStates);



Remove this one ;
Finnaly it works! Big Grin Thanks you all for help Smile