Frictional Games Forum (read-only)

Full Version: Please check the troubleshooting guides before posting!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
ok so its been about 5 hours now and i still cant get this to work im making a custom story and i followed all the instructions to make a key open a door script and then everytime i try to run the map in game it says unable to load script unexpected end of file. here is my .HPS also i dont have much in the map either just two rooms basically its like a test. please respond asap! Smile
void OnStart()
{
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
SetPlayerLampOil(100.0f);


for(int i = 0;i < 10;i++)
{
GiveItemFromFile("tinderbox", "tinderbox.ent");
}
//===========================================
// This runs when the player enters the map
void OnEnter()
{
AddUseItemCallback("", "Newdoorkey_1", "Newdoor", "UsedKeyOnDoor", "true");
{
void UsedDoorKey(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Newdoor", false, true);
PlaySoundAtEntity("", "","Newdoor", 0, false);
RemoveItem(Newdoorkey_1);
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}
At your if(ScriptDebugOn))) and void OnStart(), you forgot the ending bracket "}". Also, you forgot the "" at RemoveItem.
(06-29-2012, 07:07 PM)FastHunteR Wrote: [ -> ]At your if(ScriptDebugOn))) and void OnStart(), you forgot the ending bracket "}". Also, you forgot the "" at RemoveItem.
Now it says unexpected token for if and for?
Change this:
GiveItemFromFile("tinderbox", "tinderbox.ent");
to this:
GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
After correcting this and it still doesn't work, post the whole corrected script again.
He also should correctly close OnEnter.

Then again, learning the basics would have avoided all of this.
True. the worst is the people who ask for the whole script or tell you to hurry up but are themselves too lazy to watch tutorials on how to script properly/understand the very, very basics.
Anyway, after that it should work. Depends if you made another mistake somewhere in the level editor. Just try it out.