Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need help with a script
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#1
I need help with a script

Got a script here where the problem is Unexpected end of file. Usually a missing bracket or something. But I can't find it. Can someone find it for me?

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

///////////////////////////////////////////
// THE HUNGRY WORM
////////////////////////////////////////////

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

//Use meat to feed the worm
void UseMeatOnDoor(string &in asItem, string &in asEntity)
{
RemoveItem(asItem);
SetEntityActive("fresh_meat_static", true);

PlaySoundAtEntity("meetworm", "worm_distant.snt", "Player", 0.0f, true);
AddTimer("", 5.0f, "TimerWormEatFlesh");
}
//The Worm is hungry
void TimerWormEatFlesh(string &in asTimer)
{
AddLocalVarInt("Worm", 1); //What step to play in the event
float fEventSpeed = 0.5f; //The default time between steps in an event

switch(GetLocalVarInt("Worm")) {
case 1:
PlaySoundAtEntity("meetworm", "worm_distant.snt", "Player", 0.0f, true);
float fEventSpeed = 2.0f;
break;
case 2:
SetEntityActive("hungry_worm", true);
float fEventSpeed = 3.3f;
break;
case 3:
SetEntityActive("hungry_worm", false);
break;
}

if(GetLocalVarInt("Worm") < 3) AddTimer("", fEventSpeed, "TimerWormEatFlesh");
}
//Some stuff to make sure he doesn't go through objects
void CollideBoardWorm(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("wooden_boards_block_1", 0);
}
void CollideBreakDoor(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("fresh_meat_static", false);
SetPropHealth("cellar_wood01_3", 0);
}
//If player feels like standing in the way of the worm
void CollideWormPlayer(string &in asParent, string &in asChild, int alState)
{
FadeOut(0.5f)
AddTimer("", 5.0f, "TimerPlayerEaten");

CheckPoint("", "PlayerStartArea_2", "JustInCase", "Hints", "PlayerEaten");
}
void TimerPlayerEaten(string &in asTimer)
{
//Kill player without making a sound
DisableDeathStartSound();
AddPlayerHealth(-200);
}
void JustInCase(string &in asParent, string &in asChild, int alState)
{
//Not sure if everything works as it should if you die
SetEntityActive("cellar_wood01_3", false);
SetEntityActive("hungry_worm", false);
SetEntityActive("fresh_meat_static", false);
}
//-----------------------------------------

///////////////////////////////////////////
// LABORATORY PUZZLE
////////////////////////////////////////////

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

//Start off with placing the chemical container on the burner
void ContainerOnBurner(string &in asItem, string &in asEntity)
{
SetEntityActive("container_1", true);
RemoveItem(asItem);
PlaySoundAtEntity("", "puzzle_place_jar", "special_burner", 0.0f, true);
SetLocalVarInt("ContainerPlaced", 1);

//Allow the player to attach the acid bottle now
SetEntityActive("StickyArea_1", true);
}
//Attach the bottle
void PourAcidBottle(string &in asStickyArea, string &in asBodyName)
{
PlaySoundAtEntity("water_s", "25_water_stream", "special_burner", 1.0f, false);
AddTimer("", 2.0f, "TimerDetach");
SetLocalVarInt("MixCombined", 1);
SetEntityActive("StickyArea_2", true);
}
void TimerDetach(string &in asTimer)
{
StopSound("water_s", 3.0f);
DetachFromStickyArea("StickyArea_1");
AddAttachedPropToProp("acid_machine_bottle_grab", "StickyArea_2", "acid_machine_bottle01.ent", float afPosX, float afPosY, 0, float afRotX, 90.0f, float afRotZ);
}
//Cook the mixture together
void TurnSpecialBurner(string &in asEntityName, int alState)
{
if(alState == 1)
{
PlaySoundAtEntity("bruner_on","26_burner_ignite.snt", "AreaBurner", 0, false);

CreateParticleSystemAtEntity("burnerfire", "ps_fire_lab_burner.ps", "AreaBurner", true);

PlaySoundAtEntity("burnerfire","26_burner_loop.snt", "AreaBurner", 1, true);

AddTimer("burnerfullspeed",2, "TimerBurnerFullSpeed");
}
else if(alState == -1)
{
PlaySoundAtEntity("bruner_off","26_burner_ignite.snt", "AreaBurner", 0.15f, false);

DestroyParticleSystem("burnerfire");
StopSound("burnerfire", 1);

RemoveTimer("burnerfullspeed");

SetLocalVarInt("BurnerReady", 0);
}

AddDebugMessage("Burner state: "+ alState, false);
}
void TimerBurnerFullSpeed(string &in asTimer)
{
SetLocalVarInt("BurnerReady", 1);

//Check if the other stuff above is completed
CheckCompleteSubstance();
}

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

void CheckCompleteSubstance()
{
if(GetLocalVarInt("BurnerReady")==1 && GetLocalVarInt("ContainerPlaced")==1 && GetLocalVarInt("MixCombined")==1 && GetLocalVarInt("SubstanceCompleted")==0){
SetLocalVarInt("SubstanceCompleted", 1);

PlaySoundAtEntity("bloodboil","puzzle_boil.snt", "container_1", 1, false);

AddTimer("boileffectdone", 3, "TimerBoilEffectDone");
}

void TimerBoilEffectDone(string &in asTimer)
{
StopSound("bloodboil",1);
SetPropActiveAndFade("complete_substance", true, 0.5);
AddTimer("fadeoutblood", 0.3, "TimerBoilEffectFadeOutUseless");

PlaySoundAtEntity("boildone","puzzle_acid", "container_1", 0, false);
}
void TimerBoilEffectFadeOutUseless(string &in asTimer)
{
SetPropActiveAndFade("container_1", false, 0.5);
}
//Picking up the complete substance will enable the player to pull the machinery lever
void PickSubstance(string &in asEntity, string &in asType)
{
GiveSanityBoostSmall();
}

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

//Put complete substance in the machinery, putting it there before hand will give error message
void UseNormalContainer(string &in asItem, string &in asEntity)
{
SetMessage("Ch03Lvl18", "SubstanceNotMade", 0);
}
void UseSubstance(string &in asItem, string &in asEntity)
{
RemoveItem(asItem);
SetEntityActive("substance_notdone", true);
PlaySoundAtEntity("", "puzzle_place_jar", "AreaUseSubstance", 0.0f, true);
SetLocalVarInt("EnableLever", 1);
SetLeverStuckState("lever", 0, false);
}

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

///////////////////////////////////////////
// MACHINERY PUZZLE
////////////////////////////////////////////

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

//First start off with placing stone inside the machinery
void AttachStone(string &in asStickyArea, string &in asBodyName)
{
SetEntityActive("AreaRemoveStone", true);
}
void CollideSubstanceStone(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("stone_substance", false);
AddTimer("", 3.3, "TimerBoilStone");
}
void TimerBoilStone(string &in asTimer)
{
SetEntityActive("stone_substance_burn", true);
SetLocalVarInt("StoneInMachinery", 1);
}

//Pull the lever to activate the fire
void ActivateFire(string &in asEntityName, int alState)
{
if(alState == 1)
{
AddTimer("machinefullspeed",2, "TimerMachineFullSpeed");
}
else if(alState == -1)
{
//Nothing needed, hopefully
}
}
void TimerMachineFullSpeed(string &in asTimer)
{
CheckStone();
}

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

void CheckStone()
{
if(GetLocalVarInt("EnableLever")==1 && GetLocalVarInt("StoneInMachinery")==1 && GetLocalVarInt("FireUsed")==0){
SetLocalVarInt("FireUsed", 1);

for(int i=1;i<=6; ++i) CreateParticleSystemAtEntity("fire", "ps_fire_smoke_epoxy.ps", "AreaFire"+i, true);

for(int i=1;i<=6; ++i) PlaySoundAtEntity("fire", "general_fire_burning", "AreaFire"+i, 0.0f, true);

AddTimer("finishitoff",3, "TimerCompleteSubstance");
}
}
void TimerCompleteSubstance(string &in asTimer)
{
SetPropActiveAndFade("stone_substance_burn", true, 0.5f);
SetEntityActive("substance_notdone", false);
SetEntityAcitve("substance_done", true);

//So that you can pick the substance up, otherwise it's stuck there forever
SetEntityActive("AreaUseSubstance", false);
}
//Picking it up will make the worm hungry
void PickSubstance(string &in asItem, string &in asEntity)
{
SetEntityActive("AreaTriggerWormEvent", true);
}

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

///////////////////////////////////////////
// MISCS
////////////////////////////////////////////

//------------------------------------------
//Pick the note about the worm
void PickWormNote(string &in asEntity, string &in asType)
{
PlayMusic("05_paper_transformation.ogg", false, 0.7f, 0, 10, false);
}
//Interact with machine lever, without having things completed
void InteractTooQuick(string &in asEntity)
{
SetMessage("Ch03Lvl18", "TooQuick", 0);
}

////////////////////////////
// Run first time starting map
void OnStart()
{
SetMapDisplayNameEntry("Ravine");

//Use Item
AddUseItemCallback("", "fresh_meat", "cellar_wood01_3", "UseMeatOnDoor", true);
AddUseItemCallback("", "container", "special_burner", "ContainerOnBurner", true);

//Collide Callback
AddEntityCollideCallback("Player", "hungry_worm", "CollideWormPlayer", false, 0);
for(int i=1;i<=4; ++i) AddEntityCollideCallback("Player", "rockworm_attack_static_"+i, "CollideWormPlayerExt", false, 0);
AddEntityCollideCallback("hungry_worm", "AreaBreakPlanks_2", "CollideBoardWorm", false, 0);
AddEntityCollideCallback("hungry_worm", "AreaBreakDoor", "CollideBreakDoor", false, 0);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
PlayMusic("22_amb", true, 1, 5, 0, true);
}

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

}
(This post was last modified: 08-09-2013, 06:19 AM by Statyk.)
08-07-2013, 03:42 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: I need help with a script

Line 53 must've been
FadeOut(0.5f);

I'm not sure, but Line 102 is wrong.
AddAttachedPropToProp("acid_machine_bottle_grab", "StickyArea_2", "acid_machine_bottle01.ent", float afPosX, float afPosY, 0, float afRotX, 90.0f, float afRotZ);

"Veni, vidi, vici."
"I came, I saw, I conquered."
08-07-2013, 03:56 PM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#3
RE: I need help with a script

Nevermind, fixed it. Really hard to see. Look at row 244.
(This post was last modified: 08-07-2013, 04:22 PM by Neelke.)
08-07-2013, 04:03 PM
Find




Users browsing this thread: 1 Guest(s)