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
Help me with this script
HollowRiku13 Offline
Member

Posts: 93
Threads: 15
Joined: Dec 2011
Reputation: 2
#1
Sad  Help me with this script

I'm creating a machine room, but whenever I try the script, I get this message:


[Image: k54ra9.jpg]

Here is the script:

Spoiler below!
void OnStart()
{
AddEntityCollideCallback("Cog1", "CogArea_1", "ActiveCog1", true, 1);
AddEntityCollideCallback("Cog2", "CogArea_2", "ActiveCog2", true, 1);
AddEntityCollideCallback("Cog3", "CogArea_3", "ActiveCog3", true, 1);
AddUseItemCallback("", "Rod_1", "UseRod_1", "UseRod1", true);
AddUseItemCallback("", "Rod_2", "UseRod_2", "UseRod2", true);
AddUseItemCallback("", "Rod_3", "UseRod_3", "UseRod3", true);
InteractConnectPropWithMoveObject("safety_normal_vert_valve_1", "valve_iron_rusty_1", "safety_normal_vert_valve_1", true, false, -1);
InteractConnectPropWithMoveObject("safety_normal_vert_valve_1", "valve_iron_rusty_3", "safety_normal_vert_valve_1", true, false, -1);
}

void ActiveCog1(string &in asParent, string &in asChild, int alState)
{
SetPropActiveAndFade("Cog1", false, 0.5);
SetPropActiveAndFade("CogMounted1", true, 0.5);
}

void ActiveCog2(string &in asParent, string &in asChild, int alState)
{
SetPropActiveAndFade("Cog2", false, 0.5);
SetPropActiveAndFade("CogMounted2", true, 0.5);
}

void ActiveCog3(string &in asParent, string &in asChild, int alState)
{
SetPropActiveAndFade("Cog3", false, 0.5);
SetPropActiveAndFade("CogMounted3", true, 0.5);
}

void UseRod1(string &in asItem, string &in asEntity)
{
SetPropActiveAndFade("RodStatic_1", true, 0.5);
GiveSanityBoostSmall();
}

void UseRod2(string &in asItem, string &in asEntity)
{
SetPropActiveAndFade("RodStatic_2", true, 0.5);
GiveSanityBoostSmall();
}

void UseRod3(string &in asItem, string &in asEntity)
{
SetPropActiveAndFade("RodStatic_3", true, 0.5);
GiveSanityBoostSmall();
}

void PullStartLever(string &in asEntity, int alState)
{
if(alState == -1) AddDebugMessage("Lever Min", false);
else if (alState == 1) StartMachine(asEntity);
}

void StartMachine(string sEntity)
{
if(GetEntityExists("CogMounted1")
(GetEntityExists("CogMounted2")
(GetEntityExists("CogMounted3")
(GetEntityExists("RodStatic_1")
(GetEntityExists("RodStatic_2")
(GetEntityExists("RodStatic_3") == true) {
PlaySoundAtEntity("", "13_ignite.snt", "elevator_machine_2", 0, true);
PlaySoundAtEntity("", "13_press_done.snt", "elevator_machine_2", 0, true);
PlaySoundAtEntity("", "13_machine_run.snt", "elevator_machine_2", 1, true);
RotatePropToSpeed("elevator_machine_cog_small_2", 1, fSpeed2*3, 0, 0, 1, false, "");
RotatePropToSpeed("elevator_machine_cog_small_1", 1, fSpeed1*3, 0, 0, 1, false, "");
RotatePropToSpeed("elevator_machine_cog_small_3", 1, fSpeed2*3, 1, 0, 0, false, "");
RotatePropToSpeed("elevator_machine_cog_main_1", 1, fSpeed1, 1, 0, 0, false, "");
RotatePropToSpeed("elevator_machine_cog_small_1", 1, fSpeed1*3, 0, 0, 1, false, "");
RotatePropToSpeed("elevator_machine_cog_small_3", 1, fSpeed2*3, 1, 0, 0, false, "");
RotatePropToSpeed("elevator_machine_cog_main_1", 1, fSpeed1, 1, 0, 0, false, "");
RotatePropToSpeed("CogMounted1", 1, fSpeed2, 0, 0, 1, false, "");
RotatePropToSpeed("CogMounted2", 1, fSpeed1, 0, 0, 1, false, "");
RotatePropToSpeed("CogMounted3", 1, fSpeed2, 0, 0, 1, false, "");
SetLightFlickerActive("SpotLight_1", false);
}
else if
{
PlaySoundAtEntity("", "13_machine_fail.snt", "elevator_machine_2", 0, true);
PlaySoundAtEntity("", "13_press_fail.snt", "elevator_machine_2", 0, true);
SetMessage("Messages", "MachineNotFixed", 3);
}
}

void PickedUpOil(string &in entity)
{
AddEntityCollideCallback("Player", "AppBrute", "App", true, 1);
}

void App(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", true);
AddEntityCollideCallback("Weapon", "servant_brute_1", "Kill", true, 1);
AddEntityCollideCallback("noweapon_0"+i, "servant_brute_1", "EpicFail", true, 1);
CheckPoint("checkGruntDeath1", "PlayerStartArea_2", "CheckPointFor", "DeathHints", "Carry");
}

void Kill(string &in asParent, string &in asChild, int alState)
{
StartEffectFlash(0.5, 1, 0.5);
PlaySoundAtEntity("", "hit_generic.snt", "servant_brute_1", 0, true);
PlaySoundAtEntity("", "attack_claw.snt", "servant_brute_1", 0, true);
AddTimer("", 0.5, "Kill1");
}

void Kill1(string &in asTimer)
{
SetEntityActive("servant_brute_1", false);
SetEntityActive("BruteRagDoll_1", true);
}

void EpicFail(string &in asParent, string &in asChild, int alState)
{
SetEnemyDisableTriggers("servant_brute_1", false);
ShowEnemyPlayerPosition("servant_brute_1");
}

I don't know how to fix it. I appreciate the help.
02-17-2012, 10:08 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Help me with this script

You misused the if and else if statement. Do research on how to properly construct an if statement. Also, the variable i in the App function hasn't been declared.

Tutorials: From Noob to Pro
(This post was last modified: 02-17-2012, 10:31 PM by Your Computer.)
02-17-2012, 10:28 PM
Website Find
HollowRiku13 Offline
Member

Posts: 93
Threads: 15
Joined: Dec 2011
Reputation: 2
#3
RE: Help me with this script

You could explain it better? The problem is that this is the first time I use the if and else if estatement, and the variable i and I don't know how to use them.
02-17-2012, 11:02 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: Help me with this script

(02-17-2012, 11:02 PM)HollowRiku13 Wrote: You could explain it better? The problem is that this is the first time I use the if and else if estatement, and the variable i and I don't know how to use them.

I know that's the problem, that's why i told you to research it. (Hint: http://www.angelcode.com/angelscript/sdk...ments.html)

Tutorials: From Noob to Pro
02-17-2012, 11:09 PM
Website Find
HollowRiku13 Offline
Member

Posts: 93
Threads: 15
Joined: Dec 2011
Reputation: 2
#5
RE: Help me with this script

(02-17-2012, 11:09 PM)Your Computer Wrote:
(02-17-2012, 11:02 PM)HollowRiku13 Wrote: You could explain it better? The problem is that this is the first time I use the if and else if estatement, and the variable i and I don't know how to use them.

I know that's the problem, that's why i told you to research it. (Hint: http://www.angelcode.com/angelscript/sdk...ments.html)
Thanks, I gonna read it.
02-17-2012, 11:18 PM
Find




Users browsing this thread: 3 Guest(s)