Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with scripts for level editor,please help.
ezra627 Offline
Junior Member

Posts: 5
Threads: 5
Joined: Sep 2014
Reputation: 0
#1
Problem with scripts for level editor,please help.

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
09-25-2014, 01:26 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: Problem with scripts for level editor,please help.

Did you add the UseItem callback for the key and door?

09-25-2014, 06:58 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#3
RE: Problem with scripts for level editor,please help.

Also:
The script line you're using should be used like this:

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

So in your case:
PHP Code: (Select All)
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: (Select All)
AddUseItemCallback(stringasNamestringasItemstringasEntitystringasFunctionbool abAutoDestroy); 

So with your setup it will look like this:

PHP Code: (Select All)
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()

Trying is the first step to success.
09-25-2014, 08:27 AM
Find
Viper85626 Offline
Junior Member

Posts: 46
Threads: 6
Joined: Apr 2013
Reputation: 2
#4
RE: Problem with scripts for level editor,please help.

Flawless pretty much got it. Just relax and follow his instruction. It'll work. Good luck! Smile
09-26-2014, 06:18 AM
Find




Users browsing this thread: 1 Guest(s)