anzki
Member
Posts: 88
Threads: 6
Joined: Apr 2010
Reputation:
1
|
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 ) of true's and false's but still it doesn't work.
|
|
09-20-2010, 05:22 PM |
|
Pandemoneus
Senior Member
Posts: 328
Threads: 2
Joined: Sep 2010
Reputation:
0
|
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 |
|
anzki
Member
Posts: 88
Threads: 6
Joined: Apr 2010
Reputation:
1
|
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.
|
|
09-20-2010, 05:27 PM |
|
Thomas
Frictional Games
Posts: 2,634
Threads: 184
Joined: Apr 2006
Reputation:
68
|
RE: Candle's off!
CookKeyTaken(string &in asEntity)
should be
CookKeyTaken(string &in asEntity, string &in asType)
|
|
09-20-2010, 05:29 PM |
|
anzki
Member
Posts: 88
Threads: 6
Joined: Apr 2010
Reputation:
1
|
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?
|
|
09-20-2010, 05:39 PM |
|
Pandemoneus
Senior Member
Posts: 328
Threads: 2
Joined: Sep 2010
Reputation:
0
|
RE: Candle's off!
Thomas is actually wrong.
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?
And you should use AddDebugMessage("Message", false); to see if every function works.
|
|
09-20-2010, 07:24 PM |
|
jens
Frictional Games
Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation:
202
|
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 |
|
Thomas
Frictional Games
Posts: 2,634
Threads: 184
Joined: Apr 2006
Reputation:
68
|
RE: Candle's off!
I was right in a wrong way
(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 |
|
Pandemoneus
Senior Member
Posts: 328
Threads: 2
Joined: Sep 2010
Reputation:
0
|
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.
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 |
|
anzki
Member
Posts: 88
Threads: 6
Joined: Apr 2010
Reputation:
1
|
RE: Candle's off!
Thank's for everyone Got it working. (But after thinking it, removed it from my current map .)
|
|
09-21-2010, 11:40 AM |
|
|