Frictional Games Forum (read-only)

Full Version: Need help with scripting
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello, I am quite new to the whole scripting thing and need some help.

First thing solved
Thanks!

Second

I have put out this particle ps_pipe_flow_medium.ps as a leak on a pipe.
And there is 3 levers and 1 wheel around it that I want so you have to use all of them to make it stop. When the leak stops it will also open a secret stone wall door same one that is used in the original game.
Well, both CollideCallbacks refer to the same function. If the function is called, it does what you've written in it. And now look, what did you write in it?
do you mean remove item? how can I make it seperate then so both dont get removed
When you execute that function, EVERYTHING in it will be executed. Meaning both doors will be unlocked. And you call that function when you use either key, so it will always unlock the 2 doors.
You will have to use a separate function per door in order for it to work.

(or 1 function that checks which key you have equipped and then unlocks that door.. but never mind about this, make 2 functions.)
I tried doing like this but it gives me unexpected error when starting the custom story??


void OnStart()
{
AddUseItemCallback("", "machine", "castle_4", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_4", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_4", 0, false);
RemoveItem("machine");
}

{
AddUseItemCallback("", "hall", "castle_2", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_2", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_2", 0, false);
RemoveItem("hall");
}

void onEnter()
{

}


void OnLeave()
{

}
a little bump. I have tried different combinations but i only get unexpected errors
(01-12-2011, 03:24 PM)Cakefirst Wrote: [ -> ]a little bump. I have tried different combinations but i only get unexpected errors

please post the errors.

Code:
void OnStart()
{
AddUseItemCallback("", "machine", "castle_4", "KeyOnDoor", true);
AddUseItemCallback("", "hall", "castle_2", "KeyOnDoor1", true);
}


void onEnter()
{

}


void OnLeave()
{

}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_4", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_4", 0, false);
RemoveItem("machine");
}


void KeyOnDoor1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_2", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_2", 0, false);
RemoveItem("hall");
}

Try this, I have not tested it myself but it could work.
I only got unexpected token {because of the wrong combinations I did. But I am happy to say that yours worked! Thank you! I also didn't have a clue about having to put a number infront of KeyOnDoor to specifiy if you have more doors, thanks!
(01-12-2011, 03:45 PM)Cakefirst Wrote: [ -> ]I only got unexpected token {because of the wrong combinations I did. But I am happy to say that yours worked! Thank you! I also didn't have a clue about having to put a number infront of KeyOnDoor to specifiy if you have more doors, thanks!

The reason for that is because you had two named "void KeyOnDoor" So I just changed the name, and moved it out from void OnStart() I guess when you put it there it triggers when you start the map the first time? I don't know. But I like to keep everything out there except for triggers on the map that I want to trigger only once.
(01-11-2011, 06:17 PM)Cakefirst Wrote: [ -> ]I have put out this particle ps_pipe_flow_medium.ps as a leak on a pipe.
And there is 3 levers and 1 wheel around it that I want so you have to use all of them to make it stop. When the leak stops it will also open a secret stone wall door same one that is used in the original game.

This one is interesting. So you have 3 levers and a turning wheel and the player has to use all of the to stop the leak?

Well, that's where variables come in. And if statements. And ConnectionStateChangeCallbacks. It's still a pretty simple script, but you better get used to the syntax or it will be a pain in the ass to script for you.
Pages: 1 2