RE: scripts having effects in two levels
Hey,
thank you very much for your quick and precise answer!
Hey,
there´s still a prolem. The error message says theres a expected identifier missing or s.th. like that. Would you be so kind to check my script?
FIRST LEVEL :
void OnStart()
{
AddEntityCollideCallback("Player", "lights", "SuddenLight", true, 1);
SetLocalVarInt("Var1", 0);
SetEntityConnectionStateChangeCallback("lever", "func_shelf");
SetEntityConnectionStateChangeCallback("lever_1", "func_shelf1");
SetEntityConnectionStateChangeCallback("lever_2", "func_shelf2");
SetEntityConnectionStateChangeCallback("lever_3", "func_shelf3");
SetEntityConnectionStateChangeCallback("lever_4", "func_shelf4");
}
void SuddenLight(string &in asParent, string &in asChild, int alState)
{
SetLightVisible("BoxLight_2", false);
PlaySoundAtEntity("", "enemy_hallucination_disappear.snt", "Player", 0, false);
}
void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var1", 1);
func01();
}
}
void func_shelf1(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var1", 1);
func01();
}
}
void func_shelf2(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var1", 1);
func01();
}
}
void func_shelf3(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var1", 1);
func01();
}
}
void func_shelf4(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var1", 1);
func01();
}
}
void func01()
{
if(GetLocalVarInt("Var1") == 5)
{
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
AddGlobalVarInt("LeverVar", 1);
GiveSanityDamage(15.0f, true);
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_16", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_17", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_18", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_19", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_20", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_21", 0, "");
}
}
SECOND LEVEL :
void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddUseItemCallback("", "crowbar_1", "prison_x", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "guardian_activated.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
GiveSanityDamage(15.0f, true);
SetEntityActive("boxlight_1", true);
}
void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("", 0.2, "TimerSwitchShovel");
RemoveItem("crowbar_1");
}
void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("","puzzle_place_jar.snt", "", 0, false);
SetEntityActive("crowbar_joint_1", true);
}
void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(25);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetMoveObjectState("prison_x", 1);
PlaySoundAtEntity("","break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaBreakEffect", false);
SetEntityActive("crowbar_joint_1", false);
SetEntityActive("prison_x", false);
}
OnEnter()
{
if (GetGlobalVarInt("LeverVar") == 5);
{
SetEntityActive("test1", true);
}
}
(This post was last modified: 05-07-2012, 04:55 PM by Ravenskull.)
|