Frictional Games Forum (read-only)
How to make two scripts? Need help! - 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: How to make two scripts? Need help! (/thread-19261.html)



How to make two scripts? Need help! - giacomo9 - 11-18-2012

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()
{

}


RE: How to make two scripts? Need help! - GoranGaming - 11-18-2012

////////////////////////////
// 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()
{

}


RE: How to make two scripts? Need help! - JMFStorm - 11-18-2012

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 ()"


RE: How to make two scripts? Need help! - FlawlessHappiness - 11-18-2012

Do i sense irony?


RE: How to make two scripts? Need help! - giacomo9 - 11-18-2012

Thanks for help! GoranGaming, I use your script, but there's another fatal error:
main (19,1):ERR:Unexpected token '{'

What should I do?


RE: How to make two scripts? Need help! - FlawlessHappiness - 11-18-2012

void DeadOne(string &in asParent, string &in asChild, int alStates);



Remove this one ;


RE: How to make two scripts? Need help! - giacomo9 - 11-18-2012

Finnaly it works! Big Grin Thanks you all for help Smile