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
Candle's off!
anzki Offline
Member

Posts: 88
Threads: 6
Joined: Apr 2010
Reputation: 1
#1
Tongue  Candle's off!

SetLampLit("Candle01", [], []);
How does that function work, when I want to unlit candle's. I've tried every possible combination[Unless I missed some Confused) of true's and false's but still it doesn't work.

[Image: 2qnr5av.png]
09-20-2010, 05:22 PM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#2
RE: Candle's off!

SetLampLit(string& asName, bool abLit, bool abEffects);

SetLampLit("Candle01", false, true);

But you should probably post your script, I don't think the problem lies within that line.

09-20-2010, 05:24 PM
Find
anzki Offline
Member

Posts: 88
Threads: 6
Joined: Apr 2010
Reputation: 1
#3
RE: Candle's off!

(09-20-2010, 05:24 PM)Pandemoneus Wrote: SetLampLit(string& asName, bool abLit, bool abEffects);

SetLampLit("Candle01", false, true);

But you should probably post your script, I don't think the problem lies within that line.

void OnStart()
{
//Smthing... Not affecting this one
SetEntityPlayerInteractCallback("CookKey", "CookKeyTaken", true);
//Then I think it is the line above
}

void CookKeyTaken(string &in asEntity)
{
    SetLampLit("Candle01", false, true);
    SetLampLit("Candle02", false, true);
    SetLampLit("Candle03", false, true);
}

EDIT: And entity name's are right.

[Image: 2qnr5av.png]
09-20-2010, 05:27 PM
Find
Thomas Offline
Frictional Games

Posts: 2,634
Threads: 184
Joined: Apr 2006
Reputation: 68
#4
RE: Candle's off!

CookKeyTaken(string &in asEntity)
should be
CookKeyTaken(string &in asEntity, string &in asType)
09-20-2010, 05:29 PM
Find
anzki Offline
Member

Posts: 88
Threads: 6
Joined: Apr 2010
Reputation: 1
#5
RE: Candle's off!

Hmm... Still not working... Here's full code considering the candles or the key:
void OnStart()
{
    AddUseItemCallback("useexit1", "CookKey", "CookDoor", "UseKey1",true);
    SetEntityPlayerInteractCallback("CookKey", "CookKeyTaken", true);
}

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

void CookKeyTaken(string &in asEntity, string &in asType)
{
    SetLampLit("Candle_1", false, true);
    SetLampLit("Candle_2", false, true);
    SetLampLit("Candle_3", false, true);
}
Did I miss something?

[Image: 2qnr5av.png]
09-20-2010, 05:39 PM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#6
RE: Candle's off!

Thomas is actually wrong. Tongue
If you use SetEntityPlayerInteractCallback the function to call only needs (string &in asEntity).
I don't see what's wrong with your code, would you please bother uploading your map + script file? Smile
And you should use AddDebugMessage("Message", false); to see if every function works.

09-20-2010, 07:24 PM
Find
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#7
RE: Candle's off!

You should not use SetEntityPlayerInteractCallback for this. Instead use the level editor and enter a callback in the first input field for an entity. If you look at the tool tip you can see it can be used for things like OnPickup, which is what you do in this case.

And when you do this the correct is CookKeyTaken(string &in asEntity, string &in asType)
09-20-2010, 08:04 PM
Website Find
Thomas Offline
Frictional Games

Posts: 2,634
Threads: 184
Joined: Apr 2006
Reputation: 68
#8
RE: Candle's off!

I was right in a wrong way Big Grin

(or wrong in a right way??)
(This post was last modified: 09-20-2010, 08:40 PM by Thomas.)
09-20-2010, 08:40 PM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#9
RE: Candle's off!

(09-20-2010, 08:04 PM)jens Wrote: You should not use SetEntityPlayerInteractCallback for this. Instead use the level editor and enter a callback in the first input field for an entity. If you look at the tool tip you can see it can be used for things like OnPickup, which is what you do in this case.

And when you do this the correct is CookKeyTaken(string &in asEntity, string &in asType)

Sorry, oh mighty Jens. Tongue
I just saw that I used SetEntityCallbackFunc(string& asName, string& asCallback); in my script, which has the same effect as what you described.

09-20-2010, 08:53 PM
Find
anzki Offline
Member

Posts: 88
Threads: 6
Joined: Apr 2010
Reputation: 1
#10
RE: Candle's off!

Thank's for everyone Big Grin Got it working. (But after thinking it, removed it from my current map Undecided.)

[Image: 2qnr5av.png]
09-21-2010, 11:40 AM
Find




Users browsing this thread: 1 Guest(s)