Hey again, I'm trying to get it so that a door only opens when all three keys are used but it keeps giving me a fatal error: unexpected end of script. I'm not sure if my script even works but it wont even load so I can test it. Please someone look over it
Thank you very much! Only it was a moot point as the code itself doesn't do what I want it too. Which brings up my next question: does anyone know how to code a level door so that it requires three keys to work?
Nepenthe- WIP
(This post was last modified: 10-29-2013, 08:25 PM by 3gamers.)
(10-29-2013, 05:51 PM)3gamers Wrote: Thank you very much! Only it was a moot point as the code itself doesn't do what I want it too. Which brings up my next question: does anyone know how to code a level door so that it requires three keys to work?
This seems a bit complicated, and I'm not sure does it work, but it should:
}
void key1(string &in asItem, string &in asEntity)
{
if(GetLocalVarInt("doorpuzzle" == 2)
{
SetLevelDoorLocked("door1", false);
}
else if(GetLocalVarInt("doorpuzzle" != 2)
{
AddLocalVarInt("doorpuzzle", 1);
}
}
void key2(string &in asItem, string &in asEntity)
{
if(GetLocalVarInt("doorpuzzle" == 2)
{
SetLevelDoorLocked("door1", false);
}
else if(GetLocalVarInt("doorpuzzle" != 2)
{
AddLocalVarInt("doorpuzzle", 1);
}
}
void key3(string &in asItem, string &in asEntity)
{
if(GetLocalVarInt("doorpuzzle" == 2)
{
SetLevelDoorLocked("door1", false);
}
else if(GetLocalVarInt("doorpuzzle" != 2)
{
AddLocalVarInt("doorpuzzle", 1);
}
}
------------------------------
That basically says, everytime you use 1 of these keys, it checks the VarInt. If it's already 2 (=you used 2 keys already and this is last) it unlocks the door. If it isn't 2 yet (=you haven't used 2 yet) it just adds one to the VarInt. So it's simple as that. And also, you can find codes here: wiki.frictionalgames.com/hpl2/amnesia/script_functions
(This post was last modified: 10-29-2013, 09:44 PM by Omenapuu.)
(10-29-2013, 05:51 PM)3gamers Wrote: Thank you very much! Only it was a moot point as the code itself doesn't do what I want it too. Which brings up my next question: does anyone know how to code a level door so that it requires three keys to work?
This seems a bit complicated, and I'm not sure does it work, but it should:
}
void key1(string &in asItem, string &in asEntity)
{
if(GetLocalVarInt("doorpuzzle" == 2)
{
SetLevelDoorLocked("door1", false);
}
else if(GetLocalVarInt("doorpuzzle" != 2)
{
AddLocalVarInt("doorpuzzle", 1);
}
}
void key2(string &in asItem, string &in asEntity)
{
if(GetLocalVarInt("doorpuzzle" == 2)
{
SetLevelDoorLocked("door1", false);
}
else if(GetLocalVarInt("doorpuzzle" != 2)
{
AddLocalVarInt("doorpuzzle", 1);
}
}
void key3(string &in asItem, string &in asEntity)
{
if(GetLocalVarInt("doorpuzzle" == 2)
{
SetLevelDoorLocked("door1", false);
}
else if(GetLocalVarInt("doorpuzzle" != 2)
{
AddLocalVarInt("doorpuzzle", 1);
}
}
------------------------------
That basically says, everytime you use 1 of these keys, it checks the VarInt. If it's already 2 (=you used 2 keys already and this is last) it unlocks the door. If it isn't 2 yet (=you haven't used 2 yet) it just adds one to the VarInt. So it's simple as that. And also, you can find codes here: wiki.frictionalgames.com/hpl2/amnesia/script_functions
I put in your code and had to fix a couple of things like missing parathesis but now its giving me an error that I'm not sure how to fix or even what it means. I included a picture of the errors.
Thank you so much for your help, I REALLY appreciate it.
And I checked out the wiki and have been using it for other codes but I just couldn't find anything on this.
(10-29-2013, 05:51 PM)3gamers Wrote: Thank you very much! Only it was a moot point as the code itself doesn't do what I want it too. Which brings up my next question: does anyone know how to code a level door so that it requires three keys to work?
This seems a bit complicated, and I'm not sure does it work, but it should:
}
void key1(string &in asItem, string &in asEntity)
{
if(GetLocalVarInt("doorpuzzle" == 2)
{
SetLevelDoorLocked("door1", false);
}
else if(GetLocalVarInt("doorpuzzle" != 2)
{
AddLocalVarInt("doorpuzzle", 1);
}
}
void key2(string &in asItem, string &in asEntity)
{
if(GetLocalVarInt("doorpuzzle" == 2)
{
SetLevelDoorLocked("door1", false);
}
else if(GetLocalVarInt("doorpuzzle" != 2)
{
AddLocalVarInt("doorpuzzle", 1);
}
}
void key3(string &in asItem, string &in asEntity)
{
if(GetLocalVarInt("doorpuzzle" == 2)
{
SetLevelDoorLocked("door1", false);
}
else if(GetLocalVarInt("doorpuzzle" != 2)
{
AddLocalVarInt("doorpuzzle", 1);
}
}
------------------------------
That basically says, everytime you use 1 of these keys, it checks the VarInt. If it's already 2 (=you used 2 keys already and this is last) it unlocks the door. If it isn't 2 yet (=you haven't used 2 yet) it just adds one to the VarInt. So it's simple as that. And also, you can find codes here: wiki.frictionalgames.com/hpl2/amnesia/script_functions
I put in your code and had to fix a couple of things like missing parathesis but now its giving me an error that I'm not sure how to fix or even what it means. I included a picture of the errors.
Thank you so much for your help, I REALLY appreciate it.
And I checked out the wiki and have been using it for other codes but I just couldn't find anything on this.
Oh, instead of
----
if(GetLocalVarInt("doorpuzzle" == 2)
----
type if(GetLocalVarInt("doorpuzzle") == 2
and
----
else if(GetLocalVarInt("doorpuzzle" != 2)
----
type if(GetLocalVarInt("doorpuzzle") != 2)
That should help.
But going to sleep now, hope it worked.