Frictional Games Forum (read-only)

Full Version: [HELP] Goddamn levers.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I'm getting a lot of problems with this part of the script:


void chand()
{
if (GetLocalVarInt lever_small01_1 == lever_1_state)
(
CompleteQuest("PerformLeverTaskCompleted", "levertask"));
PlaySoundAtEntity("", "quest_completed.snt", "Player", 0, false);
PlaySoundAtEntity("", "general_chain.ogg", "Player", 0, false);
PlaySoundAtEntity("", "door_level_engine_open.ogg", "Player", 0, false);
SetEntityActive("sadchand", false);
SetEntityActive("happychand", true);
CheckPoint ("", "auto1", "", "", "");
SetEntityActive("block_box_3", true);
SetEntityActive("block_box_4", false);
)
}

The thing is, I pull the lever and the chandelier changes. But the crash is saying that I need to express the value of stuff, and to put some '(' in awkward places. Can you help me?

void chand()
{
if (GetLocalVarInt lever_small01_1 == lever_1_state)
{
CompleteQuest("PerformLeverTaskCompleted", "levertask"));
PlaySoundAtEntity("", "quest_completed.snt", "Player", 0, false);
PlaySoundAtEntity("", "general_chain.ogg", "Player", 0, false);
PlaySoundAtEntity("", "door_level_engine_open.ogg", "Player", 0, false);
SetEntityActive("sadchand", false);
SetEntityActive("happychand", true);
CheckPoint ("", "auto1", "", "", "");
SetEntityActive("block_box_3", true);
SetEntityActive("block_box_4", false);
}
}


I just took a quick glance, works?
(12-07-2011, 01:25 PM)Victor Wrote: [ -> ]I'm getting a lot of problems with this part of the script:


void chand()
{
if (GetLocalVarInt lever_small01_1 == lever_1_state)
(
CompleteQuest("PerformLeverTaskCompleted", "levertask"));
PlaySoundAtEntity("", "quest_completed.snt", "Player", 0, false);
PlaySoundAtEntity("", "general_chain.ogg", "Player", 0, false);
PlaySoundAtEntity("", "door_level_engine_open.ogg", "Player", 0, false);
SetEntityActive("sadchand", false);
SetEntityActive("happychand", true);
CheckPoint ("", "auto1", "", "", "");
SetEntityActive("block_box_3", true);
SetEntityActive("block_box_4", false);
)
}

The thing is, I pull the lever and the chandelier changes. But the crash is saying that I need to express the value of stuff, and to put some '(' in awkward places. Can you help me?

Also, put quotation marks outside of lever_small01_1, that might help.

Now it says that I need a ';' over here:

P;laySoundAtEntity("", "quest_completed.snt", "Player", 0, false);
awkward
If you ask me, it would be easiest just to set up a connectionstatechangecallback.
In the level editor, under the entity tab for the lever, there should be a box with ConnectionStateChangeCallback (or something like that) Just type in whatever you like. As an example, I'll just do LeverPull.
Then, you can do this.
PHP Code:
void LeverPull(string &in EntityNameint alState)
{
    if(
alState == 1)
    {
       
//stuff you want done here
    
}

CompleteQuest("PerformLeverTaskCompleted", "levertask"));
PlaySoundAtEntity("", "quest_completed.snt", "Player", 0, false);

Notice the extra ) after "levertask", thats why it says that you need to put an ; there. You actually don't, just delete the ).
Download Notepad++ (or some similiar coding program), it will help you alot.