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
Scripting Error
Zaffre Away
Posting Freak

Posts: 867
Threads: 50
Joined: Jul 2012
Reputation: 30
#1
Scripting Error

Hi. Recently I've begun creating a custom story with the help of YourComputer's video series. Up to now, I've created scripts without problems (and fixed errors) but recently I've gotten one I can't seem to figure out. I've looked over the script multiple times, but find nothing wrong. This is what I'm getting:
Spoiler below!
[Image: 9SD6y.png]

And this is my map01.hps:
Spoiler below!
void OnStart()
{
SetEntityPlayerInteractCallback("key_study_1", "ActivateMonster", true);
AddUseItemCallback("BedroomLevelDoorOpen", "key_study_1", "level_wood_1", "UnlockLevelDoor", true);
SetPlayerActive(false);
FadeOut(0);
AddTimer("activate_player", 3, "FadeIn");

//Lever
SetEntityConnectionStateCallback("lever_small01_1", "DoCaveIn");
}


void OnEnter()
{

}

void OnLeave()
{

}

void FadeIn(string &in activate_player)
{
FadeIn(2);
SetPlayerActive(true);
SetEntityActive("servant_grunt_2", false);
}

void ActivateMonster(string &in item)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "Idle");

}

void UnlockLevelDoor(string &in item, string &in entity)
{
SetLevelDoorLocked("level_wood_1", false);
RemoveItem("key_study_1");
}

void DoCaveIn(string &in entity, int level state)
{
if(level_state == 1);
{
SetEntityActive("cave_in_1", "cave_in_2", "cave_in_3", true);
FadeEnemyToSmoke("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
}

}


When a key is picked up, a Grunt will spawn behind a door, smash the door down, and make his way outside. Once he's outside, if a lever is pulled, a cave in will spawn and a ragdoll of the Grunt will spawn and fall onto the ground.

Thanks in advance!

As of September 2nd, 2014, I've left the Frictional forums. Check my profile for more details.
08-29-2012, 04:45 PM
Find
Melvin Offline
Member

Posts: 245
Threads: 38
Joined: Jun 2012
Reputation: 5
#2
RE: Scripting Error

void DoCaveIn(string &in entity, int level state)
{
if(level_state == 1);
{
SetEntityActive("cave_in_1", "cave_in_2", "cave_in_3", true);
FadeEnemyToSmoke("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
}

}


Try to delete this (copy it to another notepad) and run Amnesia again, does this solve the error problem?

[Image: 25F7U37.png]
08-29-2012, 04:49 PM
Website Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#3
RE: Scripting Error

void DoCaveIn(string &in entity, int level_state)
{
if(level_state == 1);
{
SetEntityActive("cave_in_1", "cave_in_2", "cave_in_3", true);
FadeEnemyToSmoke("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
}


(50, 44) was leading to the end of "level" in the syntax. I noticed you have a space, but in the parameters, you have an underscore. Try adding the underscore.
(This post was last modified: 08-29-2012, 04:55 PM by Statyk.)
08-29-2012, 04:55 PM
Find
Zaffre Away
Posting Freak

Posts: 867
Threads: 50
Joined: Jul 2012
Reputation: 30
#4
RE: Scripting Error

(08-29-2012, 04:55 PM)Statyk Wrote: void DoCaveIn(string &in entity, int level_state)
{
if(level_state == 1);
{
SetEntityActive("cave_in_1", "cave_in_2", "cave_in_3", true);
FadeEnemyToSmoke("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
}


(50, 44) was leading to the end of "level" in the syntax. I noticed you have a space, but in the parameters, you have an underscore. Try adding the underscore.
That fixed it, (thanks a bunch!)but now I'm getting a different error.
[Image: oJD8W.png]
Since I'm relatively new to AngelScript, I'm not sure what this means. If I'm correct, the integers in the parentheses mean the line of code and the character of code.

[quote="SmokeMelvin"]
Quote:void DoCaveIn(string &in entity, int level state)
{
if(level_state == 1);
{
SetEntityActive("cave_in_1", "cave_in_2", "cave_in_3", true);
FadeEnemyToSmoke("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
}

}


Try to delete this (copy it to another notepad) and run Amnesia again, does this solve the error problem?
Also, this did not fix the error.

If I get an answer and I'm still getting errors, I'll stop pestering you and just try it again.

As of September 2nd, 2014, I've left the Frictional forums. Check my profile for more details.
(This post was last modified: 08-29-2012, 05:35 PM by Zaffre.)
08-29-2012, 05:30 PM
Find
Steve Offline
Member

Posts: 178
Threads: 17
Joined: Jun 2012
Reputation: 7
#5
RE: Scripting Error

just taking a fast look I found the errors I think.
you have three entitiies in one calback: SetEntityActive("cave_in_1", "cave_in_2", "cave_in_3", true);
make it like this:
SetEntityActive("cave_in_1", true);
SetEntityActive("cave_in_2", true);
SetEntityActive("cave_in_3", true);
 
furthermore:
you have an ";" after your if statement delete it: if(level_state == 1) (like this)

CURRENTLY WORKING ON:
Final Light = 40%
Need of voice actors.
(This post was last modified: 08-29-2012, 06:04 PM by Steve.)
08-29-2012, 06:04 PM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#6
RE: Scripting Error

Try this. I highlighted changes in bold:
Spoiler below!

void OnStart()
{
SetEntityPlayerInteractCallback("key_study_1", "ActivateMonster", true);
AddUseItemCallback("BedroomLevelDoorOpen", "key_study_1", "level_wood_1", "UnlockLevelDoor", true);
SetPlayerActive(false);
FadeOut(0);
AddTimer("activate_player", 3, "FadeIn");

//Lever
SetEntityConnectionStateChangeCallback("lever_small01_1", "DoCaveIn");
}


void OnEnter()
{

}

void OnLeave()
{

}

void FadeIn(string &in activate_player)
{
FadeIn(2);
SetPlayerActive(true);
SetEntityActive("servant_grunt_2", false);
}

void ActivateMonster(string &in item)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "Idle");

}

void UnlockLevelDoor(string &in item, string &in entity)
{
SetLevelDoorLocked("level_wood_1", false);
RemoveItem("key_study_1");
}

void DoCaveIn(string &in entity, int alState)
{
if(alState == 1)
{
SetEntityActive("cave_in_*", true);
FadeEnemyToSmoke("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
}

}


08-29-2012, 06:09 PM
Find
Zaffre Away
Posting Freak

Posts: 867
Threads: 50
Joined: Jul 2012
Reputation: 30
#7
RE: Scripting Error

(08-29-2012, 06:09 PM)Statyk Wrote: Try this. I highlighted changes in bold:
Spoiler below!

void OnStart()
{
SetEntityPlayerInteractCallback("key_study_1", "ActivateMonster", true);
AddUseItemCallback("BedroomLevelDoorOpen", "key_study_1", "level_wood_1", "UnlockLevelDoor", true);
SetPlayerActive(false);
FadeOut(0);
AddTimer("activate_player", 3, "FadeIn");

//Lever
SetEntityConnectionStateChangeCallback("lever_small01_1", "DoCaveIn");
}


void OnEnter()
{

}

void OnLeave()
{

}

void FadeIn(string &in activate_player)
{
FadeIn(2);
SetPlayerActive(true);
SetEntityActive("servant_grunt_2", false);
}

void ActivateMonster(string &in item)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "Idle");

}

void UnlockLevelDoor(string &in item, string &in entity)
{
SetLevelDoorLocked("level_wood_1", false);
RemoveItem("key_study_1");
}

void DoCaveIn(string &in entity, int alState)
{
if(alState == 1)
{
SetEntityActive("cave_in_*", true);
FadeEnemyToSmoke("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
}

}


Thank you. All the errors are gone and everything works great. Thanks a ton!

As of September 2nd, 2014, I've left the Frictional forums. Check my profile for more details.
08-29-2012, 06:28 PM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#8
RE: Scripting Error

No problemo =]
08-29-2012, 07:32 PM
Find




Users browsing this thread: 1 Guest(s)