Viperdream
Member
Posts: 124
Threads: 16
Joined: Jan 2011
Reputation:
0
Problem when loading map
When I try to load my map, I get this error:
Fatal Error: Unexpected end 24,5$
I checked 24,5 and it should be fine.
I'm pretty new to programming so any help is welcome
Spoiler below!
void OnLeverStateChange(string &in EntityName, int alState)
{
if (alState == 0)
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
}
void OnStart()
{
PlayMusic("01_amb_darkness.ogg, false, 1.0f, 0.5f, 10, false)
}
void SetEntityConnectionStateChangeCallback(leverbooks_01, OnLeverStateChange);
//===========================================
// This runs when the player enters the map
void OnEnter()
{
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
StopMusic(0.5f, 1);
}
03-02-2011, 05:34 PM
Oscar House
Senior Member
Posts: 302
Threads: 3
Joined: Nov 2010
Reputation:
9
RE: Problem when loading map
Here is where your problem is:
Spoiler below!
void OnLeverStateChange(string &in EntityName, int alState)
{
if (alState == 0)
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
}
void OnStart()
{
PlayMusic("01_amb_darkness.ogg, false, 1.0f, 0.5f, 10, false)
}
void SetEntityConnectionStateChangeCallback(leverbooks_01, OnLeverStateChange);
//===========================================
// This runs when the player enters the map
void OnEnter()
{
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
StopMusic(0.5f, 1);
}
You shouldn't put it as a function, instead place it inside Onstart(), like this:
Spoiler below!
void OnLeverStateChange(string &in EntityName, int alState)
{
if (alState == 0)
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
}
void OnStart()
{
PlayMusic("01_amb_darkness.ogg", false, 1.0f, 0.5f, 10, false);
SetEntityConnectionStateChangeCallback("leverbooks_01", "OnLeverStateChange");
}
//===========================================
// This runs when the player enters the map
void OnEnter()
{
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
StopMusic(0.5f, 1);
}
You also missed some quotation marks and a semicolon from there, I added those as well. See how it works, though I suspect there might still be something I missed.
03-02-2011, 05:44 PM
Viperdream
Member
Posts: 124
Threads: 16
Joined: Jan 2011
Reputation:
0
RE: Problem when loading map
The map loads now.
But the lever won't work :<
03-02-2011, 06:24 PM
nkmol
Senior Member
Posts: 252
Threads: 19
Joined: Feb 2011
Reputation:
4
RE: Problem when loading map
Try to put the connectioncallback at the entity tab of the lever in the level editor.
03-02-2011, 09:01 PM
Pandemoneus
Senior Member
Posts: 328
Threads: 2
Joined: Sep 2010
Reputation:
0
RE: Problem when loading map
Check the test map in my sig, it has a working lever.
03-02-2011, 09:02 PM
nkmol
Senior Member
Posts: 252
Threads: 19
Joined: Feb 2011
Reputation:
4
RE: Problem when loading map
Sorry try this. And alState == 0 would be neutral, try to change it to -1 or 1
Void OnLeverStateChange(string &in EntityName, int alState
{
if (alState == 0)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0, false);
}
}
(This post was last modified: 03-02-2011, 09:21 PM by nkmol .)
03-02-2011, 09:16 PM
Viperdream
Member
Posts: 124
Threads: 16
Joined: Jan 2011
Reputation:
0
RE: Problem when loading map
Tried the script in Pandemoneus map and also tried the script nkmol suggested me
Still won't work :<
This is my current script:
Spoiler below!
void OnStart()
{
SetEntityConnectionStateChangeCallback("leverbooks_01", "StateChangeLever");
AddEntityCollideCallback("Player", "LetterArea_01", "Collide_Area", true, 1);
}
void StateChangeLever(string &in asEntity, int alState)
{
AddDebugMessage("called StateChangeLever", false);
if(alState == 1){
SetLeverStuckState(asEntity, 1, true);
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0, false);
PlayMusic("010_puzzle01.ogg", false, 1.0f, 4.0f, 3, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0, false);
}
}
void Collide_Area(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("note_letter_1", true); //makes letter appear on the floor near the door
}
//===========================================
// This runs when the player enters the map
void OnEnter()
{
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
StopMusic(0.5f, 1);
}
03-03-2011, 08:33 PM
Nye
Senior Member
Posts: 250
Threads: 8
Joined: Jan 2011
Reputation:
2
RE: Problem when loading map
(03-03-2011, 08:33 PM) Viperdream Wrote: Tried the script in Pandemoneus map and also tried the script nkmol suggested me
Still won't work :<
This is my current script:
Spoiler below!
void OnStart()
{
SetEntityConnectionStateChangeCallback("leverbooks_01", "StateChangeLever");
AddEntityCollideCallback("Player", "LetterArea_01", "Collide_Area", true, 1);
}
void StateChangeLever(string &in asEntity, int alState)
{
AddDebugMessage("called StateChangeLever", false);
if(alState == 1){
SetLeverStuckState(asEntity, 1, true);
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0, false);
PlayMusic("010_puzzle01.ogg", false, 1.0f, 4.0f, 3, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0, false);
}
}
void Collide_Area(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("note_letter_1", true); //makes letter appear on the floor near the door
}
//===========================================
// This runs when the player enters the map
void OnEnter()
{
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
StopMusic(0.5f, 1);
}
Specifically, in-game - what works and what doesn't work?
03-04-2011, 01:34 AM
Viperdream
Member
Posts: 124
Threads: 16
Joined: Jan 2011
Reputation:
0
RE: Problem when loading map
Everything in the script works. Except for the lever. When I try it, nothing happens. I can move it up or down but doesn't stay stuck or anything and activates nothing.
Do I have to do anything in the Level Editor? It's on the same settings as in Pandemoneus' map
03-04-2011, 04:35 PM
Pandemoneus
Senior Member
Posts: 328
Threads: 2
Joined: Sep 2010
Reputation:
0
RE: Problem when loading map
If you use that book lever, let me take a look at the offcial maps, I will edit this post soon.
[edit]
The developers made it a bit different for that.
They created a script area in front of the book (in the direction you pull it) and made a normal EntityCollideCallback with the book.
for(int i=1;i<=3;i++) AddEntityCollideCallback("SecretBook_"+i, "AreaSecretBook_"+i, "CollideSecretBook", false, 0); //Pull books to reveal room
(Use
AddEntityCollideCallback("leverbooks_01", "NameOfYourScriptAreaHere", "NameOfYourCollideCallbackHere", false, 0);
for your script)
In that callback function they got a
SetPropObjectStuckState(asParent, 1);
which makes the book unmoveable (change
asParent to
"leverbooks_01" if you are not completly sure what this does).
(This post was last modified: 03-04-2011, 05:26 PM by Pandemoneus .)
03-04-2011, 05:15 PM