Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with scripting
Author Message
Cakefirst Offline
Junior Member

Posts: 8
Joined: Jan 2011
Reputation: 0
Post: #1
Need help with scripting
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.
(This post was last modified: 01-12-2011 03:57 PM by Cakefirst.)
01-11-2011 06:17 PM
Find all posts by this user Quote this message in a reply
Frontcannon Offline
Senior Member

Posts: 538
Joined: Jul 2010
Reputation: 0
Post: #2
RE: Need help with scripting
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?


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
01-11-2011 06:33 PM
Find all posts by this user Quote this message in a reply
Cakefirst Offline
Junior Member

Posts: 8
Joined: Jan 2011
Reputation: 0
Post: #3
RE: Need help with scripting
do you mean remove item? how can I make it seperate then so both dont get removed
01-11-2011 06:47 PM
Find all posts by this user Quote this message in a reply
Tottel Offline
Senior Member

Posts: 307
Joined: Nov 2010
Reputation: 0
Post: #4
RE: Need help with scripting
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.)
01-11-2011 07:02 PM
Find all posts by this user Quote this message in a reply
Cakefirst Offline
Junior Member

Posts: 8
Joined: Jan 2011
Reputation: 0
Post: #5
RE: Need help with scripting
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()
{

}
(This post was last modified: 01-11-2011 07:36 PM by Cakefirst.)
01-11-2011 07:36 PM
Find all posts by this user Quote this message in a reply
Cakefirst Offline
Junior Member

Posts: 8
Joined: Jan 2011
Reputation: 0
Post: #6
RE: Need help with scripting
a little bump. I have tried different combinations but i only get unexpected errors
01-12-2011 03:24 PM
Find all posts by this user Quote this message in a reply
Seragath Offline
Junior Member

Posts: 34
Joined: Jan 2011
Reputation: 0
Post: #7
RE: Need help with scripting
(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.

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.
(This post was last modified: 01-12-2011 03:37 PM by Seragath.)
01-12-2011 03:34 PM
Find all posts by this user Quote this message in a reply
Cakefirst Offline
Junior Member

Posts: 8
Joined: Jan 2011
Reputation: 0
Post: #8
RE: Need help with scripting
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
Find all posts by this user Quote this message in a reply
Seragath Offline
Junior Member

Posts: 34
Joined: Jan 2011
Reputation: 0
Post: #9
RE: Need help with scripting
(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-12-2011 04:10 PM
Find all posts by this user Quote this message in a reply
Frontcannon Offline
Senior Member

Posts: 538
Joined: Jul 2010
Reputation: 0
Post: #10
RE: Need help with scripting
(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.


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
01-12-2011 05:20 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)