Frictional Games Forum (read-only)
Candle's off! - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Candle's off! (/thread-4619.html)



Candle's off! - anzki - 09-20-2010

Code:
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.


RE: Candle's off! - Pandemoneus - 09-20-2010

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.


RE: Candle's off! - anzki - 09-20-2010

(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.

Code:
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.


RE: Candle's off! - Thomas - 09-20-2010

CookKeyTaken(string &in asEntity)
should be
CookKeyTaken(string &in asEntity, string &in asType)


RE: Candle's off! - anzki - 09-20-2010

Hmm... Still not working... Here's full code considering the candles or the key:
Code:
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?


RE: Candle's off! - Pandemoneus - 09-20-2010

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.


RE: Candle's off! - jens - 09-20-2010

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)


RE: Candle's off! - Thomas - 09-20-2010

I was right in a wrong way Big Grin

(or wrong in a right way??)


RE: Candle's off! - Pandemoneus - 09-20-2010

(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.


RE: Candle's off! - anzki - 09-21-2010

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