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
Script Help Error at unlocking door with an item
KingCrimson Offline
Junior Member

Posts: 45
Threads: 14
Joined: Jul 2012
Reputation: 0
#1
Error at unlocking door with an item

It says:

"FATAL ERROR: main (21,23) : ERR : Expected identifier"

This is a copy of the .hps file:


Quote:////////////////////////////
// Run when the map starts
void OnStart()
{
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door2", true, true);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false);

PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(5.0f, true);
}

AddUseItemCallback("", "secret1", "lckd", "unlock", true);

void unlock(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(lckd, false, true);
PlaySoundAtEntity("", "unlock_door", door, 0, false);
RemoveItem(secret1);
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
secret1 = Key name
lckd = Locked door name

PS: I don't know if it might have something to do with the error. But the key you must use, you get it on the level before this one.

Current Projects:
DADDY - 10%
07-07-2012, 10:34 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#2
RE: Error at unlocking door with an item

AddUseItemCallback("", "secret1", "lckd", "unlock", true);
It's in no function. It will never be called(that's why that error is there).

Think, before you speak Google, before you post
(This post was last modified: 07-07-2012, 10:40 PM by Cruzore.)
07-07-2012, 10:40 PM
Find
KingCrimson Offline
Junior Member

Posts: 45
Threads: 14
Joined: Jul 2012
Reputation: 0
#3
RE: Error at unlocking door with an item

(07-07-2012, 10:40 PM)FastHunteR Wrote: AddUseItemCallback("", "secret1", "lckd", "unlock", true);
It's in no function. It will never be called(that's why that error is there).
I don't understand. I've already been nearly thirty minutes trying to fix this script and i think i'll get mad. Would you please correct my script and paste it in a reply?

Thanks in advance

Current Projects:
DADDY - 10%
07-07-2012, 11:08 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#4
RE: Error at unlocking door with an item

I have no idea when you plan to add that callback, since I can't read your mind. Cut that line of it out and paste it, I assume under OnStart().

Think, before you speak Google, before you post
07-07-2012, 11:10 PM
Find
KingCrimson Offline
Junior Member

Posts: 45
Threads: 14
Joined: Jul 2012
Reputation: 0
#5
RE: Error at unlocking door with an item

I finally could make it work. Thanks, what you said was right, but i didn't understand it well. So the problem's solved. Thanks again for the help

Current Projects:
DADDY - 10%
07-07-2012, 11:32 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: Error at unlocking door with an item

also
RemoveItem(secret1); should be
RemoveItem("secret1"); shouldn't it?

Trying is the first step to success.
07-08-2012, 12:11 AM
Find
KingCrimson Offline
Junior Member

Posts: 45
Threads: 14
Joined: Jul 2012
Reputation: 0
#7
RE: Error at unlocking door with an item

(07-08-2012, 12:11 AM)beecake Wrote: also
RemoveItem(secret1); should be
RemoveItem("secret1"); shouldn't it?
I've actually left it as
Quote: RemoveItem(asItem);
and it's working perfectly

Current Projects:
DADDY - 10%
07-08-2012, 12:15 AM
Find




Users browsing this thread: 2 Guest(s)