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
Script problem, help
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#2
RE: Script problem, help

//------------------------------------------

///////////////////////////////////////////
// GENERAL HELPERS
////////////////////////////////////////////

//------------------------------------------

//A custom script that allows to turn on and off all the candles in the corridors
void LitHallCandles(bool abLit)
{
SetLightVisible("PointLight_1", abLit);
SetLightVisible("PointLight_2", abLit);
SetLightVisible("PointLight_3", abLit);
SetLightVisible("PointLight_4", abLit);
SetLightVisible("PointLight_5", abLit);
SetLightVisible("PointLight_6", abLit);
SetLightVisible("PointLight_7", abLit);
SetLightVisible("PointLight_8", abLit);
SetLightVisible("PointLight_9", abLit);
SetLightVisible("PointLight_10", abLit);
SetLightVisible("PointLight_11", abLit);
SetLightVisible("PointLight_12", abLit);
SetLightVisible("PointLight_13", abLit);
SetLightVisible("PointLight_14", abLit);
SetLightVisible("PointLight_15", abLit);
SetLightVisible("PointLight_16", abLit);
SetLightVisible("PointLight_17", abLit);
SetLightVisible("PointLight_18", abLit);
SetLightVisible("PointLight_19", abLit);
SetLightVisible("PointLight_20", abLit);
SetLightVisible("PointLight_21", abLit);
SetLightVisible("PointLight_22", abLit);


//So annoying, you have to do it this way
SetLampLit("candle_floor_no_light_1", abLit, false);
SetLampLit("candle_floor_no_light_2", abLit, false);
SetLampLit("candle_floor_no_light_3", abLit, false);
SetLampLit("candle_floor_no_light_4", abLit, false);
SetLampLit("candle_floor_no_light_5", abLit, false);
SetLampLit("candle_floor_no_light_6", abLit, false);
SetLampLit("candle_floor_no_light_7", abLit, false);
SetLampLit("candle_floor_no_light_8", abLit, false);
SetLampLit("candle_floor_no_light_9", abLit, false);
SetLampLit("candle_floor_no_light_10", abLit, false);
SetLampLit("candle_floor_no_light_11", abLit, false);
SetLampLit("candle_floor_no_light_12", abLit, false);
SetLampLit("candle_floor_no_light_13", abLit, false);
SetLampLit("candle_floor_no_light_14", abLit, false);
SetLampLit("candle_floor_no_light_15", abLit, false);
SetLampLit("candle_floor_no_light_16", abLit, false);
SetLampLit("candle_floor_no_light_17", abLit, false);
SetLampLit("candle_floor_no_light_18", abLit, false);
SetLampLit("candle_floor_no_light_19", abLit, false);
SetLampLit("candle_floor_no_light_20", abLit, false);
SetLampLit("candle_floor_no_light_21", abLit, false);
SetLampLit("candle_floor_no_light_22", abLit, false);
SetLampLit("candle_floor_no_light_23", abLit, false);
SetLampLit("candle_floor_no_light_24", abLit, false);
SetLampLit("candle_floor_no_light_25", abLit, false);
SetLampLit("candle_floor_no_light_26", abLit, false);
SetLampLit("candle_floor_no_light_27", abLit, false);
SetLampLit("candle_floor_no_light_28", abLit, false);
SetLampLit("candle_floor_no_light_29", abLit, false);
SetLampLit("candle_floor_no_light_30", abLit, false);
SetLampLit("candle_floor_no_light_31", abLit, false);
SetLampLit("candle_floor_no_light_32", abLit, false);
SetLampLit("candle_floor_no_light_33", abLit, false);
SetLampLit("candle_floor_no_light_34", abLit, false);
SetLampLit("candle_floor_no_light_35", abLit, false);
SetLampLit("candle_floor_no_light_36", abLit, false);
SetLampLit("candle_floor_no_light_37", abLit, false);
SetLampLit("candle_floor_no_light_38", abLit, false);
SetLampLit("candle_floor_no_light_39", abLit, false);
SetLampLit("candle_floor_no_light_40", abLit, false);
SetLampLit("candle_floor_no_light_41", abLit, false);
SetLampLit("candle_floor_no_light_42", abLit, false);
SetLampLit("candle_floor_no_light_43", abLit, false);
SetLampLit("candle_floor_no_light_44", abLit, false);
SetLampLit("candle_floor_no_light_45", abLit, false);
SetLampLit("candle_floor_no_light_46", abLit, false);
SetLampLit("candle_floor_no_light_47", abLit, false);
SetLampLit("candle_floor_no_light_48", abLit, false);
SetLampLit("candle_floor_no_light_49", abLit, false);
SetLampLit("candle_floor_no_light_50", abLit, false);
SetLampLit("candle_floor_no_light_51", abLit, false);
SetLampLit("candle_floor_no_light_52", abLit, false);
SetLampLit("candle_floor_no_light_53", abLit, false);
SetLampLit("candle_floor_no_light_54", abLit, false);
SetLampLit("candle_floor_no_light_55", abLit, false);
SetLampLit("candle_floor_no_light_56", abLit, false);
SetLampLit("candle_floor_no_light_57", abLit, false);
SetLampLit("candle_floor_no_light_58", abLit, false);
SetLampLit("candle_floor_no_light_59", abLit, false);
SetLampLit("candle_floor_no_light_60", abLit, false);
SetLampLit("candle_floor_no_light_61", abLit, false);
SetLampLit("candle_floor_no_light_62", abLit, false);
SetLampLit("candle_floor_no_light_63", abLit, false);
SetLampLit("candle_floor_no_light_64", abLit, false);
SetLampLit("candle_floor_no_light_65", abLit, false);
SetLampLit("candle_floor_no_light_66", abLit, false);
SetLampLit("candle_floor_no_light_67", abLit, false);
SetLampLit("candle_floor_no_light_68", abLit, false);
SetLampLit("candle_floor_no_light_69", abLit, false);
SetLampLit("candle_floor_no_light_70", abLit, false);
SetLampLit("candle_floor_no_light_71", abLit, false);
SetLampLit("candle_floor_no_light_72", abLit, false);
SetLampLit("candle_floor_no_light_73", abLit, false);
SetLampLit("candle_floor_no_light_74", abLit, false);
SetLampLit("candle_floor_no_light_75", abLit, false);
SetLampLit("candle_floor_no_light_76", abLit, false);
SetLampLit("candle_floor_no_light_77", abLit, false);
SetLampLit("candle_floor_no_light_78", abLit, false);
SetLampLit("candle_floor_no_light_79", abLit, false);
SetLampLit("candle_floor_no_light_80", abLit, false);
SetLampLit("candle_floor_no_light_81", abLit, false);
SetLampLit("candle_floor_no_light_82", abLit, false);
SetLampLit("candle_floor_no_light_83", abLit, false);
SetLampLit("candle_floor_no_light_84", abLit, false);
SetLampLit("candle_floor_no_light_85", abLit, false);
SetLampLit("candle_floor_no_light_86", abLit, false);
SetLampLit("candle_floor_no_light_87", abLit, false);
SetLampLit("candle_floor_no_light_88", abLit, false);
SetLampLit("candle_floor_no_light_89", abLit, false);
SetLampLit("candle_floor_no_light_90", abLit, false);
SetLampLit("candle_floor_no_light_91", abLit, false);
SetLampLit("candle_floor_no_light_92", abLit, false);
SetLampLit("candle_floor_no_light_93", abLit, false);
SetLampLit("candle_floor_no_light_94", abLit, false);
SetLampLit("candle_floor_no_light_95", abLit, false);
SetLampLit("candle_floor_no_light_96", abLit, false);
SetLampLit("candle_floor_no_light_97", abLit, false);
SetLampLit("candle_floor_no_light_98", abLit, false);
SetLampLit("candle_floor_no_light_99", abLit, false);
SetLampLit("candle_floor_no_light_100", abLit, false);
SetLampLit("candle_floor_no_light_101", abLit, false);
SetLampLit("candle_floor_no_light_102", abLit, false);
SetLampLit("candle_floor_no_light_103", abLit, false);
SetLampLit("candle_floor_no_light_104", abLit, false);
SetLampLit("candle_floor_no_light_105", abLit, false);
SetLampLit("candle_floor_no_light_106", abLit, false);
SetLampLit("candle_floor_no_light_107", abLit, false);
SetLampLit("candle_floor_no_light_108", abLit, false);
SetLampLit("candle_floor_no_light_109", abLit, false);
SetLampLit("candle_floor_no_light_110", abLit, false);
SetLampLit("candle_floor_no_light_111", abLit, false);
SetLampLit("candle_floor_no_light_112", abLit, false);
SetLampLit("candle_floor_no_light_113", abLit, false);
SetLampLit("candle_floor_no_light_114", abLit, false);
SetLampLit("candle_floor_no_light_115", abLit, false);
SetLampLit("candle_floor_no_light_116", abLit, false);
SetLampLit("candle_floor_no_light_117", abLit, false);
SetLampLit("candle_floor_no_light_118", abLit, false);
SetLampLit("candle_floor_no_light_119", abLit, false);
SetLampLit("candle_floor_no_light_120", abLit, false);
SetLampLit("candle_floor_no_light_121", abLit, false);
SetLampLit("candle_floor_no_light_122", abLit, false);
SetLampLit("candle_floor_no_light_123", abLit, false);
SetLampLit("candle_floor_no_light_124", abLit, false);
SetLampLit("candle_floor_no_light_125", abLit, false);
SetLampLit("candle_floor_no_light_126", abLit, false);
SetLampLit("candle_floor_no_light_127", abLit, false);
SetLampLit("candle_floor_no_light_128", abLit, false);
SetLampLit("candle_floor_no_light_129", abLit, false);
SetLampLit("candle_floor_no_light_130", abLit, false);
SetLampLit("candle_floor_no_light_131", abLit, false);
SetLampLit("candle_floor_no_light_132", abLit, false);
SetLampLit("candle_floor_no_light_133", abLit, false);
SetLampLit("candle_floor_no_light_134", abLit, false);
SetLampLit("candle_floor_no_light_135", abLit, false);
SetLampLit("candle_floor_no_light_136", abLit, false);
SetLampLit("candle_floor_no_light_137", abLit, false);
SetLampLit("candle_floor_no_light_138", abLit, false);
SetLampLit("candle_floor_no_light_139", abLit, false);
SetLampLit("candle_floor_no_light_140", abLit, false);
SetLampLit("candle_floor_no_light_141", abLit, false);
SetLampLit("candle_floor_no_light_142", abLit, false);
SetLampLit("candle_floor_no_light_143", abLit, false);
SetLampLit("candle_floor_no_light_144", abLit, false);
SetLampLit("candle_floor_no_light_145", abLit, false);
SetLampLit("candle_floor_no_light_146", abLit, false);
SetLampLit("candle_floor_no_light_147", abLit, false);
SetLampLit("candle_floor_no_light_148", abLit, false);
SetLampLit("candle_floor_no_light_149", abLit, false);


SetLampLit("candle_floor_1", abLit, false);
SetLampLit("candle_floor_2", abLit, false);
SetLampLit("candle_floor_3", abLit, false);
SetLampLit("candle_floor_4", abLit, false);
SetLampLit("candle_floor_5", abLit, false);
SetLampLit("candle_floor_6", abLit, false);
SetLampLit("candle_floor_7", abLit, false);
SetLampLit("candle_floor_8", abLit, false);
SetLampLit("candle_floor_9", abLit, false);
SetLampLit("candle_floor_10", abLit, false);
SetLampLit("candle_floor_11", abLit, false);
SetLampLit("candle_floor_12", abLit, false);
SetLampLit("candle_floor_13", abLit, false);
SetLampLit("candle_floor_14", abLit, false);
SetLampLit("candle_floor_15", abLit, false);
SetLampLit("candle_floor_16", abLit, false);
SetLampLit("candle_floor_17", abLit, false);
SetLampLit("candle_floor_18", abLit, false);
SetLampLit("candle_floor_19", abLit, false);
SetLampLit("candle_floor_20", abLit, false);
SetLampLit("candle_floor_21", abLit, false);
SetLampLit("candle_floor_22", abLit, false);
SetLampLit("candle_floor_23", abLit, false);
SetLampLit("candle_floor_24", abLit, false);
SetLampLit("candle_floor_25", abLit, false);
SetLampLit("candle_floor_26", abLit, false);
SetLampLit("candle_floor_27", abLit, false);
}

//The collapsing rocks
void TimerAreaRock(string &in asTimer)
{
int iRand = RandInt(1, 6);

PlaySoundAtEntity(asTimer+iRand, "24_rock.snt", asTimer+iRand, 1, false);

StartScreenShake(0.007f, 0.0f, 4.0f, 2.0f);
SetRadialBlurStartDist(0.8f);
FadeRadialBlurTo(0.1f, 0.03f);

AddTimer("EndRadial", 4.0f, "TimerEndRadial");
AddTimer(asTimer, RandFloat(15.0f, 30.0f), "TimerAreaRock");
}
void TimerEndRadial(string &in asTimer)
{
FadeRadialBlurTo(0.0f, 0.1f);
}

//The brute/grunt helpers

//bool asActive = if the monsters are triggered
//string& asName = if a monster name is in there and active it will chase the player, if empty nothing happens

void InitiateGruntBrute(bool asActive, string& asName)
{
SetEntityActive("nomusic_brute_1", asActive);
SetEntityActive("nomusic_grunt_1", asActive);

ShowEnemyPlayerPosition(asName);
}


//--------------------------------------------------------------

void GruntPatrolNode(string& asName)
{
AddEnemyPatrolNode(asName, "PathNodeArea_27", 0, "");
AddEnemyPatrolNode(asName, "PathNodeArea_21", 0, "");
AddEnemyPatrolNode(asName, "PathNodeArea_18", 0, "");
AddEnemyPatrolNode(asName, "PathNodeArea_31", 0, "");
AddEnemyPatrolNode(asName, "PathNodeArea_17", 0, "");
AddEnemyPatrolNode(asName, "PathNodeArea_14", 0, "");
AddEnemyPatrolNode(asName, "PathNodeArea_8", 0, "");
AddEnemyPatrolNode(asName, "PathNodeArea_4", 0, "");
}
void LoopGruntPatrol(string &in asParent, string &in asChild, int alState)
{
AddEnemyPatrolNode("nomusic_grunt_1", "PathNodeArea_27", 0, "");
AddEnemyPatrolNode("nomusic_grunt_1", "PathNodeArea_21", 0, "");
AddEnemyPatrolNode("nomusic_grunt_1", "PathNodeArea_18", 0, "");
AddEnemyPatrolNode("nomusic_grunt_1", "PathNodeArea_31", 0, "");
AddEnemyPatrolNode("nomusic_grunt_1", "PathNodeArea_17", 0, "");
AddEnemyPatrolNode("nomusic_grunt_1", "PathNodeArea_14", 0, "");
AddEnemyPatrolNode("nomusic_grunt_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("nomusic_grunt_1", "PathNodeArea_4", 0, "");
}


//--------------------------------------------------------------


void BrutePatrolNode(string& asName)
{
AddEnemyPatrolNode(asName, "PathNodeArea_8", 0, "");
AddEnemyPatrolNode(asName, "PathNodeArea_14", 0, "");
AddEnemyPatrolNode(asName, "PathNodeArea_17", 0, "");
AddEnemyPatrolNode(asName, "PathNodeArea_30", 0, "");
AddEnemyPatrolNode(asName, "PathNodeArea_18", 0, "");
AddEnemyPatrolNode(asName, "PathNodeArea_21", 0, "");
AddEnemyPatrolNode(asName, "PathNodeArea_27", 0, "");
AddEnemyPatrolNode(asName, "PathNodeArea_1", 0, "");
}
void LoopBrutePatrol(string &in asParent, string &in asChild, int alState)
{
AddEnemyPatrolNode("nomusic_brute_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("nomusic_brute_1", "PathNodeArea_14", 0, "");
AddEnemyPatrolNode("nomusic_brute_1", "PathNodeArea_17", 0, "");
AddEnemyPatrolNode("nomusic_brute_1", "PathNodeArea_30", 0, "");
AddEnemyPatrolNode("nomusic_brute_1", "PathNodeArea_18", 0, "");
AddEnemyPatrolNode("nomusic_brute_1", "PathNodeArea_21", 0, "");
AddEnemyPatrolNode("nomusic_brute_1", "PathNodeArea_27", 0, "");
AddEnemyPatrolNode("nomusic_brute_1", "PathNodeArea_1", 0, "");
}

//------------------------------------------

///////////////////////////////////////////
// TRIGGER LOOPING MONSTERS
////////////////////////////////////////////

//------------------------------------------

//Start general helpers
void CollideStartMonsters(string &in asParent, string &in asChild, int alState)
{
InitiateGruntBrute(true, "");
GruntPatrolNode("nomusic_grunt_1");
BrutePatrolNode("nomusic_brute_1");

PlaySoundAtEntity("Gspawn", "grunt/enabled.snt", "Player", 0, false);
PlaySoundAtEntity("Bspawn", "brute/enabled.snt", "Player", 0, false);
}

//------------------------------------------

///////////////////////////////////////////
// STENCIL PUZZLE
////////////////////////////////////////////

//------------------------------------------

//Pick up the stencils
void PickStencil(string &asEntity, string& asType)
{
StencilPicked(1);
}

void StencilPicked(int asAmount)
{
AddLocalVarInt("StencilCount", asAmount);

//Start a scare script when player has picked up two
if(GetLocalVarInt("StencilCount")==2){
SetEntityActive("AreaGuardianScare", true);
}

//When picked up three, start another scare script
if(GetLocalVarInt("StencilCount")==3){
SetEntityActive("AreaGuardianScare_1", true);
}
}


////////////////////////////
// Run first time starting map
void OnStart()
{
SetMapDisplayNameEntry("DungeonHalls");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
PlayMusic("dungeon_halls_amb.ogg", true, 0.8, 0.1, 1, true);
AddTimer("AreaRock_", RandFloat(3.0f,10.f), "TimerAreaRock");

//Collide callback
AddEntityCollideCallback("Player", "AreaStartGruntBrute", "CollideStartMonsters", false, 1);
AddEntityCollideCallback("nomusic_grunt_1", "AreaGruntLoopPatrol", "LoopGruntPatrol", false, 1);
AddEntityCollideCallback("nomusic_brute_1", "AreaBruteLoopPatrol", "LoopBrutePatrol", false, 1);

//Init stuff
LitHallCandles(true);
InitiateGruntBrute(false, "");
}


////////////////////////////
// Run when leaving map
void OnLeave()
{

}

----------------------------------------------
Nevermind, I fixed it. But I got another problem instead. Now when I start it, it crashes. No idea what causes it.
-----------------------------------------------
Nevermind again, I fixed it. Just one of my own entities that got screwed up.
(This post was last modified: 09-01-2013, 09:42 PM by Neelke.)
09-01-2013, 09:28 PM
Find


Messages In This Thread
Script problem, help - by Neelke - 09-01-2013, 09:20 PM
RE: Script problem, help - by PutraenusAlivius - 09-02-2013, 08:52 AM
RE: Script problem, help - by Adrianis - 09-02-2013, 09:28 AM
RE: Script problem, help - by PutraenusAlivius - 09-02-2013, 12:31 PM
RE: Script problem, help - by Tomato Cat - 09-02-2013, 01:01 PM



Users browsing this thread: 1 Guest(s)