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
Why does my SetSwingDoorLocked no effect?
Raymond Offline
Member

Posts: 126
Threads: 24
Joined: Feb 2011
Reputation: 0
#1
Why does my SetSwingDoorLocked no effect?

I try to use the key on it but it says " Cannot use this item away". My code is like this:
void Onstart()
{
AddUseItemCallback("", "prisonkeylight_1", "mansion_3", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem("prisonkeylight_1");
}

It doesn't have any errors it just doesn't seem to work. Did i put something wrong Huh.

One World To Another [DEMO] coming soon.
03-19-2011, 05:56 AM
Find Reply
Danny Boy Offline
Posting Freak

Posts: 2,718
Threads: 85
Joined: Mar 2011
Reputation: 81
#2
RE: Why does my SetSwingDoorLocked no effect?

think the name of it must be in the first "" but i'm noob on scripting so i don't realy know =/ but check out this http://wiki.frictionalgames.com/hpl2/tutorials/start this might help.
(This post was last modified: 03-19-2011, 12:01 PM by Danny Boy.)
03-19-2011, 11:58 AM
Website Find Reply
Raymond Offline
Member

Posts: 126
Threads: 24
Joined: Feb 2011
Reputation: 0
#3
RE: Why does my SetSwingDoorLocked no effect?

I followed "the Make a key unlock a specific door" but still not working.

One World To Another [DEMO] coming soon.
03-19-2011, 02:35 PM
Find Reply
Danny Boy Offline
Posting Freak

Posts: 2,718
Threads: 85
Joined: Mar 2011
Reputation: 81
#4
RE: Why does my SetSwingDoorLocked no effect?

oh! i think i found it!
in the
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
you missed ; at the end!

void UsedKeyOnDoor(string &in asItem, string &in asEntity);
this is the correct one... i hope it helps
03-19-2011, 02:42 PM
Website Find Reply
Linus Ågren Offline
Senior Member

Posts: 309
Threads: 58
Joined: Jan 2011
Reputation: 5
#5
RE: Why does my SetSwingDoorLocked no effect?

(03-19-2011, 02:42 PM)Danarogon Wrote: oh! i think i found it!
in the
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
you missed ; at the end!

void UsedKeyOnDoor(string &in asItem, string &in asEntity);
this is the correct one... i hope it helps

Callbacks aren't supposed to have ;'s at the end.
Is the door named "mansion_3" and the key prisonkeylight_1?

Creator of The Dark Treasure.
03-19-2011, 03:07 PM
Website Find Reply
Raymond Offline
Member

Posts: 126
Threads: 24
Joined: Feb 2011
Reputation: 0
#6
RE: Why does my SetSwingDoorLocked no effect?

(03-19-2011, 02:42 PM)Danarogon Wrote: oh! i think i found it!
in the
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
you missed ; at the end!

void UsedKeyOnDoor(string &in asItem, string &in asEntity);
this is the correct one... i hope it helps

The video didn't tell me to put the ";". Besides, when i put the ";" it gives me an error said "Unexpected {".

One World To Another [DEMO] coming soon.
03-19-2011, 03:16 PM
Find Reply
Danny Boy Offline
Posting Freak

Posts: 2,718
Threads: 85
Joined: Mar 2011
Reputation: 81
#7
RE: Why does my SetSwingDoorLocked no effect?

oh... right sorry i haven't noticed i didn't had it either in my own code... well so the best thing i can tell you is that try to save the map before you test it... sometimes stupid stuff like thus happens because i fergot to save the map. or you cold try to make code from scratch again and if it does not work i hope someone whit more knolage about scripting than me helps you out.
03-19-2011, 03:40 PM
Website Find Reply
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#8
RE: Why does my SetSwingDoorLocked no effect?

You wrote Onstart().
It has to be OnStart().
Noticed the difference?

03-19-2011, 04:17 PM
Find Reply
Nye Offline
Senior Member

Posts: 250
Threads: 8
Joined: Jan 2011
Reputation: 2
#9
RE: Why does my SetSwingDoorLocked no effect?

(03-19-2011, 04:17 PM)Pandemoneus Wrote: You wrote Onstart().
It has to be OnStart().
Noticed the difference?

In case you don't notice the difference, it needs to be capitalised 100% accurately. Scripting is very case sensitive, so be careful in future! Sleepy

03-19-2011, 07:54 PM
Find Reply
Raymond Offline
Member

Posts: 126
Threads: 24
Joined: Feb 2011
Reputation: 0
#10
RE: Why does my SetSwingDoorLocked no effect?

(03-19-2011, 07:54 PM)Nye Wrote:
(03-19-2011, 04:17 PM)Pandemoneus Wrote: You wrote Onstart().
It has to be OnStart().
Noticed the difference?

In case you don't notice the difference, it needs to be capitalised 100% accurately. Scripting is very case sensitive, so be careful in future! Sleepy

I see the difference. Onstart = OnStart, i forgotten the capital S.
Thanks.

One World To Another [DEMO] coming soon.
03-20-2011, 04:06 AM
Find Reply




Users browsing this thread: 1 Guest(s)