Frictional Games Forum (read-only)

Full Version: Problem with scripts for level editor,please help.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Guys AHHHH GODDD!!!This script is confusing me,how to use this line to make level doors work?My key says when it is used "No object to use item on!"
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("Key1", "Doorlvl1");
}AngryExclamationHuhDodgy
Did you add the UseItem callback for the key and door?
Also:
The script line you're using should be used like this:

PHP Code:
SetLevelDoorLocked("NameOfDoor"false); 
You put false or true in there to make the door unlocked or locked.

So in your case:
PHP Code:
void UseKeyOnDoor(string &in asItemstring &in asEntity)
{
SetLevelDoorLocked("Doorlvl1"false);


You already had the parameters right! That's great!
But if you only have what you just wrote (Which I'm going to assume since you didn't write anything else)
then you're gonna need a void OnStart()

In this void OnStart() you're gonna use (as Mudbill said) an AddUseItemCallback.

It looks like this:
PHP Code:
AddUseItemCallback(stringasNamestringasItemstringasEntitystringasFunctionbool abAutoDestroy); 

So with your setup it will look like this:

PHP Code:
void OnStart()
{
AddUseItemCallback("""Key1" "Doorlvl1""UseKeyOnDoor"false);


Remember, if you already have a void OnStart(), don't just copy mine and paste it in your script. You cannot have 2 void OnStart()! THen just copy the script line, AddUseItemCallback, and put it in your void OnStart()
Flawless pretty much got it. Just relax and follow his instruction. It'll work. Good luck! Smile