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...
LoneWolf Offline
Senior Member

Posts: 308
Threads: 43
Joined: Sep 2010
Reputation: 0
#1
My level will not load...

It shows up in custom story, stangely my description will not show, when i click on the game it crashes and gives me an error.

And yes i have watched the tutorials and i copied alot of what was written.

(Underlined text is the file name)


Custom_Story_setting.cfg

<Main
Name = "My first map"
Author = "Kieren Tod"

MapsFolder = "maps/"
StartMap = "Firstmap.map" (yes this is my map name!)
StartPos = "PlayerStartArea_1" *(changed lower case s to caps S)*


/>



extra_english.lang

<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">My first level.[br][br]I hope you'll enjoy! </Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_StudyKey">Study Key </Entry>
<Entry Name="ItemDesc_StudyKey">Key for room one </Entry> *(Added </Entry> )*
</CATEGORY>
</LANGUAGE>


Firstmap.hps (in map folder)

////////////////////////////
// Run first time starting map
void OnStart()
{
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);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave(
{
}







Thanks for reading please tell me what is wrong with my coding.

*(.....)* - means i have changed something from feed back.
10-01-2010, 03:12 PM
Find
HakePT Offline
Junior Member

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

Quote:It shows up in custom story, stangely my description will not show
--> error in the file. Use the XML tester to test files in the future.

Custom_Story_setting.cfg

Quote:<Main
Name = "My first map"
Author = "Kieren Tod"

MapsFolder = "maps/"
StartMap = "Firstmap.map" (yes this is my map name!)
StartPos = "PlayerStartArea_1"


/>
-->Its StarPos not startpos.
extra_english.lang

Quote:<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">My first level.[br][br]I hope you'll enjoy!</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_StudyKey">Study Key </Entry>
<Entry Name="ItemDesc_StudyKey">Key for room one</Entry>
</CATEGORY>
</LANGUAGE>
--> missed the closing of entry in the key description.


Quote:Firstmap.hps (in map folder)
--> no problems i think.


Thats it. Try fixing these and post the results.
10-01-2010, 03:38 PM
Find
LoneWolf Offline
Senior Member

Posts: 308
Threads: 43
Joined: Sep 2010
Reputation: 0
#3
RE: My level will not load...

The description now works, but it wont load, i get this:

FATAL ERROR Could not load script file 'custom_stories/story/maps/firstmap.hps'! main (24,2) : ERR :Expected data type


IS it my HPS then? i fixed the things you said.
Also where do i find the XML tester?


My HPS now looks like this - (now i have 2 errors when tryign to load it.....)

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "CollideScript", true, 1);
}

void CollideScript(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("castle_arched01_2", true, true);
ShowEnemyPlayerPosition("servant_grunt_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);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave(
{
}
10-01-2010, 04:09 PM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#4
RE: My level will not load...

There

void OnLeave(

should be

void OnLeave()

10-01-2010, 04:43 PM
Find
HakePT Offline
Junior Member

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

http://www.frictionalgames.com/forum/thr...+validator

Internets to MulleDK19 for sharing.

And yes the error seems to be in the HPS file.

"main (24,2) : ERR :Expected data type"

line 24, 2 error unexpected data type. Sorry i didn't notice:

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

You forgot the parentheses on the function OnLeave.

Causes immediate error since what is between the () is what the function receives as information so if you don't close it or put unsupported information it crashes.

EDITTongueandemoneus was faster than me Tongue
10-01-2010, 04:55 PM
Find
LoneWolf Offline
Senior Member

Posts: 308
Threads: 43
Joined: Sep 2010
Reputation: 0
#6
RE: My level will not load...

Thanks guys, i updated my 2nd post to show what my coding is like now, i have a new error and i dont know why.

Appretiate the help Big Grin

EDIT : it says (16,1) : unexpected token
10-01-2010, 04:57 PM
Find
HakePT Offline
Junior Member

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

(10-01-2010, 04:57 PM)LoneWolf Wrote: EDIT : it says (16,1) : unexpected token

Like it says go to line 16, 1st character:
{ <--
AddUseItemCallback("", "StudyKey", "castle_arched01_3", "UsedKeyOnDoor", true);

}<--

you don't place this here place it on void OnStart()
{
*(what else you have let it stay there as well)*
AddUseItemCallback("", "StudyKey", "castle_arched01_3", "UsedKeyOnDoor", true);
}

Edit:
Remove the {} marked with <-- after you change the callback to OnStart.
10-01-2010, 05:01 PM
Find
LoneWolf Offline
Senior Member

Posts: 308
Threads: 43
Joined: Sep 2010
Reputation: 0
#8
RE: My level will not load...

Okay i now have this - (please tell me if im doing it wrong, it says line 5 and 15 is wrong)



////////////////////////////
// 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)
{
SetSwingDoorLocked("castle_arched01_3", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_arched01_3", 0, false);
RemoveItem("StudyKey");
}
(LINE 15 , WHICH IS APPARENTLY WRONG, whats wrong with havign a space?)
{
AddEntityCollideCallback("Player", "ScriptArea_1", "CollideScript", true,

1);
}

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()
{
}
10-01-2010, 05:11 PM
Find
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




Users browsing this thread: 1 Guest(s)