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
Script Help Script Error 3.0
GoranGaming Offline
Member

Posts: 183
Threads: 30
Joined: Feb 2012
Reputation: 7
#1
Script Error 3.0

The music on my custom story was messing. So I added a few lines. But I got an error:

[Image: 0f8Rl.png]


Here is my script:


//Crowbar

void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
{
StartPlayerLookAt("crowbar_joint_1", 4, 1, "");
AddTimer("CrowStopLookTimer", 1, "CrowStopLookTimerFunc");
AddTimer(asEntity, 0.2, "TimerSwitchShovel");
PlaySoundAtEntity("pickupcrow","player_crouch.snt", "Player", 0.05, false);

RemoveItem(asItem);
GiveSanityDamage(10, false);

}

void CrowStopLookTimerFunc(string &in Timer)
{
StopPlayerLookAt();
}

void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("attachshovel","puzzle_place_jar.snt", asTimer, 0, false);

SetEntityActive("crowbar_joint_1", true);
}

void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
GiveSanityBoostSmall();

//PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);

SetSwingDoorLocked("CrowDoor", false, false);
SetSwingDoorDisableAutoClose("CrowDoor", true);
SetSwingDoorClosed("CrowDoor", false,false);

PlaySoundAtEntity("break","break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("breakps", "ps_hit_wood", "AreaBreakEffect", false);
AddPropImpulse("CrowDoor", -3, 0, 0, "world");//-3

SetEntityActive("crowbar_joint_1", false);
SetEntityActive("crowbar_dyn_1", true);

AddTimer("pushdoor", 0.1, "TimerPushDoor");

AddDebugMessage("Break door!", false);
}

void TimerPushDoor(string &in asTimer)
{
AddPropImpulse("CrowDoor", -1, 2, 4, "world");//-1
AddTimer("doorclose", 1.1, "TimerDoorCanClose");
}

void TimerDoorCanClose(string &in asTimer)
{
SetSwingDoorDisableAutoClose("CrowDoor", false);
}
//End of Crowbar

//Chemicals
void PickChemical(string &in asEntity, string &in asType)
{
FadeLightTo("AquaLight", 0,0,0,0, -1, 2);
}

void PickChemical2(string &in asEntity, string &in asType)
{
FadeLightTo("AquaLight_2", 0,0,0,0, -1, 2);
}
//End of Chemicals

//Monster

void ActivateGrunt1Func(string &in asParent, string &in asChild, int alState)
{
if(HasItem("crowbar_1")){
SetEntityActive("servant_grunt_1", true);

//CheckPoint("checkpoint1","PlayerStartArea_8","CPCall01", "", "");
}
StopMusic(0, 1);
AddTimer("react1", 0.5f, "ReactSound1Timer");
AddTimer("stoplockdoor", 4, "StopLockDoorFunc");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0.0f, "");
}

void RemoveGrunt1Func(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", false);
PlaySoundAtEntity("", "door_level_wood_open.snt", "DoorSpawn", 0, false);
CreateParticleSystemAtEntity("ps_area_fog", "ps_area_fog.ps", "Grunt1Fog", false);
PlayMusic("12_amb.ogg", true, 10, 2, 1, true);
}

void StopLockDoorFunc(string &in Timer)
{
SetEntityActive("LabDoor", false);
}

void ReactSound1Timer(string &in Timer)
{
PlayGuiSound("react_pant1.ogg", 1);
}
//End of Monster

//Areas
void EnableGrunt1Area(string &in Entity)
{
SetEntityActive("EnableGrunt1", true);
}
//End of Areas

//Misc

void StartMusic(string &in Timer)
{
PlayMusic("12_amb.ogg", true, 10, 2, 1, true);
}

void InteractCrowDoor(string &in Entity)
{
SetMessage("Messages", "CrowDoor", 1);
}

void InteractLabDoor(string &in Entity)
{
SetMessage("Messages", "LockedStorage", 1);
AddPropImpulse("LabDoorDoor", 0, 0, 1, "world");//-3
PlaySoundAtEntity("", "locked_door.snt", "LabDoorDoor", 0, false);
}
//End of Misc


void OnStart()
{
//EDITOR
GiveItemFromFile("lantern", "lantern.ent");
for(int i=0;i< 10;i++) GiveItemFromFile("potion_sanity_"+i, "potion_sanity.ent");
//End of EDITOR



//Crowbar
AddEntityCollideCallback("crowbar_joint_1", "BreakDoor", "CollideAreaBreakDoor", true, 1);
AddUseItemCallback("crowbarondoor", "crowbar_1", "CrowDoor","UseCrowbarOnDoor", true);
//End of Crowbar

//Monster
AddEntityCollideCallback("Player", "EnableGrunt1", "ActivateGrunt1Func", true, 1);
AddEntityCollideCallback("servant_grunt_1", "DisableGrunt1", "RemoveGrunt1Func", true, 1);
//End of Monster

//MUSIC
StopMusic(0, 1)
AddTimer("startmusic", 0.1f, "StartMusic");

//End of MUSIC
}

void OnEnter()
{

}

void OnLeave()
{
StopMusic(0, 1);
}

And here is a video where I show the problem:




Can anybody help? Smile

Current projects:

The Dark Prison 85 % (Stopped working on this one)

Unnamed Project 7 %
(This post was last modified: 03-06-2012, 04:18 PM by GoranGaming.)
03-06-2012, 04:13 PM
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Script Error 3.0

StopMusic in OnStart is missing a semicolon.

As for the music "issue," it seems like you don't understand the difference between OnStart and OnEnter.

Tutorials: From Noob to Pro
(This post was last modified: 03-06-2012, 11:45 PM by Your Computer.)
03-06-2012, 11:44 PM
Website Find
GoranGaming Offline
Member

Posts: 183
Threads: 30
Joined: Feb 2012
Reputation: 7
#3
RE: Script Error 3.0

Ohh I do, but now I realise what was wrong. Thanks Smile

Current projects:

The Dark Prison 85 % (Stopped working on this one)

Unnamed Project 7 %
03-07-2012, 06:20 PM
Website Find
Stepper321 Offline
Senior Member

Posts: 263
Threads: 26
Joined: Nov 2011
Reputation: 8
#4
RE: Script Error 3.0

Actually, i would recommend that you do everythign OnEnter... It can result into some bugs.

Signature to awesome to be displayed.
03-07-2012, 07:08 PM
Find




Users browsing this thread: 1 Guest(s)