(11-25-2015, 01:26 AM)Romulator Wrote: Well, the Omnitool is essentially a trigger for scripts to occur - similar to how a Player walks through an area in order for scripts to actually begin.
The area I'm thinking of would be theta_labs (I believe), since there is an elevator in that map. Look at the code they used for when you press a button in the elevator to close the doors. The Omnitool can do the same thing when it is used on a panel - since the "trigger" can be the Omnitool's animation as opposed to a button press.
Sorry that I'm not being much help about saying "what code is actually needed", but a good skill about learning is to see how it has been done before. It's most likely a Swingdoor, since SwingDoors are the doors which open and close. You can always try using code that you think may work, and if it doesn't, experiment with other similar codes in order to get your desired result.
I was just thinking, that instead, I could have the omnitool plug into a terminal in order to unlock an elevator button and have another on the inside. That to me would make for a better puzzle, but I know it'd take a lot longer to script.
EDIT: Heheh, just solved the problem... The scripting for the functions were correct, I was just using them in the same exact parameters but in a different event. Obviously I had to put the functions under the same in the same event as I did the last, but I think that was about my main issue with it. I had to mess around with different parts though to figure out how to trigger the event.
My only problem with the second omnipanel is that the return false; doesn't count for it or something, because I can use it again (not having any effect on the doors) when it says return false when both functions are in the same body. I don't know exactly how to say the code is written so here it is:
bool omnitool_CanBeUsed(const tString &in asTool, const tString &in asEntity)
{
if(asEntity == "omnipanel_finaldoor" && mbFinalDoorOpened == false) return true;
if(asEntity == "omnipanel_elevator" && mbFinalDoorOpened == true) return true;
return false;
}
bool omnitool_OnUse(const tString &in asTool, const tString &in asEntity)
{
if(asEntity == "omnipanel_finaldoor")
{
cLux_AddDebugMessage("Use omnitool");
CathTool_UseOnPanel("omnitool","omnipanel_finaldoor");
mbFinalDoorOpened = true;
}
if(asEntity == "omnipanel_elevator")
{
cLux_AddDebugMessage("Use omnitool again");
CathTool_UseOnPanel("omnitool","omnipanel_elevator");
SlideDoor_SetClosed("finaldoor",true);
}
return false;
}