06-12-2012, 08:46 AM
Hi, guys. I'm making a custom story and there's a lever that opens and closes a door. The name of the door is "wooden_slide_door_1". And I have no idea how to script it. Can someone tell me how to do it ?
(06-12-2012, 12:54 PM)TheNoAuthor12 Wrote: [ -> ]Make it better pleaseMaybe, what if you make two levers? another opens, another closes
And BTW does that work for valves ?
(06-13-2012, 06:40 AM)TheNoAuthor12 Wrote: [ -> ]Okay. But, I want to make lever that opens and closes the door. Is that possible ?I think it is.. But its hard, i always just make 2 levers Im not good scripter, started like month ago.
(06-13-2012, 09:48 AM)Putkimato Wrote: [ -> ]I started like a few days ago.(06-13-2012, 06:40 AM)TheNoAuthor12 Wrote: [ -> ]Okay. But, I want to make lever that opens and closes the door. Is that possible ?I think it is.. But its hard, i always just make 2 levers Im not good scripter, started like month ago.
(06-12-2012, 08:46 AM)TheNoAuthor12 Wrote: [ -> ]Hi, guys. I'm making a custom story and there's a lever that opens and closes a door. The name of the door is "wooden_slide_door_1". And I have no idea how to script it. Can someone tell me how to do it ?Take the script he gave you its good and easy to understand if not follow this (this tut is with buttons)
void OnStart()
{
SetEntityConnectionStateChangeCallback("lever", "leverfunc");
SetEntityConnectionStateChangeCallback("lever", "leverfunc2");
}
void leverfunc(string &in asEntity, int alState)
{
if (alState == 1)
SetMoveObjectStateExt("wooden_slide_door_1", 1.0f, 1.0f, 5.0f, 5.0f, true);
//All the numbers on the script above depends on what speed you want it to open. Check out "Engine Scripts" //in the wiki for more information.
}
void leverfunc2(string &in asEntity, int alState)
{
if (alState == -1)
SetMoveObjectStateExt("wooden_slide_door_1", 0.0f, 1.0f, 5.0f, 5.0f, true);
}