(06-26-2012, 05:04 PM)ApeCake Wrote: You got summer holidays... dangit. I have still one week exams left D:
Anyway, in my very first map (it was a test map) I had some trouble regarding levers. They wouldn't stay up if I pulled them and same story when I pulled them down. I know I can change some part of that in the entity section of the lever - but I still couldn't figure it out. Any advice? I do have the script set out already... copied from the wiki.
void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var1", 1);
func01();
}
}
void func_shelf_1(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var1", 1);
func01();
}
}
void func01()
{
if(GetLocalVarInt("Var1") == 2)
{
SetMoveObjectState("shelf",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf", 0, false);
}
}
However, here's my REAL question; is there any way of detecting if a lamp is lit or not? In script sense, that is.
I have a better version of that script, in the script you use there is an really annoying bug. Try this instead:
void func_shelf(string &in asEntity, int alState)
{
if(alState == 1){
SetLocalVarInt("Lever1", 1);
}
}
void func_shelf_1(string &in asEntity, int alState)
{
if(alState == 1){
SetLocalVarInt("Lever2", 1);
}
}
void func01()
{
if(GetLocalVarInt("Lever1") ==1 && GetLocalVarInt("Lever2") == 1){
SetMoveObjectState("shelf",1.0f); PlaySoundAtEntity("", "quest_completed.snt", "shelf", 0, false);
}
}
Yes there is, you can use LocalVarInt's like:
void LitLamp(string &in asParent, string &in asChild, int alState)
{
SetLampLit("Lamp1", true, false);
SetLocalVarInt("Lamp1", 1);
}
Then you can check with "GetLocalVarInt".
Any questions?