Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My level will not load...
HakePT Offline
Junior Member

Posts: 49
Threads: 1
Joined: Sep 2010
Reputation: 0
#9
RE: My level will not load...

(10-01-2010, 05:11 PM)LoneWolf Wrote: (please tell me if im doing it wrong, it says line 5 and 15 is wrong)



////////////////////////////Bad
// Run first time starting map
void OnStart()

AddUseItemCallback("", "StudyKey", "castle_arched01_3", "UsedKeyOnDoor",true); (coding is wrong apparently)

void UsedKeyOnDoor(string &in asItem, string &in asEntity)

-----------------------------------------------------------------
good
void CollideScript(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("castle_arched01_2", true, true);
ShowEnemyPlayerPosition("servant_grunt_1");

}

These are examples of a bad function and a good one.
All function follow this rule:

nameOfTheFuncion(parameters)
{
whatTheFunctionDoes1;
whatTheFunctionDoes2;
whatTheFunctionDoesetc;
}


So change the OnStart:
void OnStart()
{
AddUseItemCallback("","StudyKey","castle_arched01_3","UsedKeyOnDoor",true);

void UsedKeyOnDoor(string &in asItem, string &in asEntity); (<--don't forget the ;! its important)
}


When i said to remove the {} i meant the one you had around the callback not the ones OnStart. Sorry for the confusion Big Grin

The 1st error was missing the {} so wrong coding because that wasn't what the program expected.
The 2nd error was because when the {} came they weren't for the OnStart function but the program recognized them as being for the OnStart which lead to an error.

To prevent more confusion here is the code:
Quote:// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "CollideScript", true,1);
AddUseItemCallback("","StudyKey","castle_arched01_3","UsedKeyOnDoor",true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_arched01_3", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_arched01_3", 0, false);
RemoveItem("StudyKey");
}

void CollideScript(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("castle_arched01_2", true, true);
ShowEnemyPlayerPosition("servant_grunt_1");

}

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

All Add(...) go on the OnStart() function.
The void(...) go outside the OnStart().

void OnStart()
{

This text is inside the OnStart()

}

Void This text is outside the OnStart()
{
}
10-01-2010, 06:12 PM
Find


Messages In This Thread
My level will not load... - by LoneWolf - 10-01-2010, 03:12 PM
RE: My level will not load... - by HakePT - 10-01-2010, 03:38 PM
RE: My level will not load... - by LoneWolf - 10-01-2010, 04:09 PM
RE: My level will not load... - by Pandemoneus - 10-01-2010, 04:43 PM
RE: My level will not load... - by HakePT - 10-01-2010, 04:55 PM
RE: My level will not load... - by LoneWolf - 10-01-2010, 04:57 PM
RE: My level will not load... - by HakePT - 10-01-2010, 05:01 PM
RE: My level will not load... - by LoneWolf - 10-01-2010, 05:11 PM
RE: My level will not load... - by HakePT - 10-01-2010, 06:12 PM



Users browsing this thread: 3 Guest(s)