Frictional Games Forum (read-only)
If the lamp is lit, monster deactivates ? - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: If the lamp is lit, monster deactivates ? (/thread-20588.html)



If the lamp is lit, monster deactivates ? - Nice - 03-02-2013

Hey all, so i've run into a little problem..

what would the script look like if i wanted to make it that when the player lits a candle, it deactivates a monster ?

i dont think SetEntityPlayerInteractCallback would work, because then the player would deactivate the monster just by clicking on the candle without setting it lit (no tinderboxes)

i'm preety basic with scripting so... i have no idea how to make it work.

edit: so i tried messing around with the "if statement" to see if i could use it but all i got was a bunch of errors xD this is what i tried

void warning(string &in asTimer) //candle off in opozorilo
{
PlaySoundAtEntity("", "guardian_activated.snt", "Player", 0, false);
SetLampLit("candlestick01_1", false, true);
StartScreenShake(0.1f, 0.1f, 1.0f, 1.0f);
if(SetLampLit("candlestick01_1") == false)
{
SetMessage("DONTKNOWIFWORKS", 10);
}
else
{
SetEntityActive("closetgrunt", true);
ShowEnemyPlayerPosition("closetgrunt");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("closetgrunt1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_9", 0, "");
AddTimer("", 10, "open");
}
}

so yeah, here i wanted to test i know how to use "if statement".. what i wanted to achieve was that if the candle was NOT lit i get the message "DONTKNOWIFWORKS" otherwise.. well you can see the rest Smile


RE: If the lamp is lit, monster deactivates ? - PutraenusAlivius - 03-02-2013

I don't even know what is wrong. Btw, why did you use show player position? This WILL make the patrol nodes useless.
EDIT:
Btw, how do i make multiple lamps lit/unlit?


RE: If the lamp is lit, monster deactivates ? - No Author - 03-02-2013

Can you show the full script for the lamp ?

(03-02-2013, 12:40 PM)JustAnotherPlayer Wrote: I don't even know what is wrong. Btw, why did you use show player position? This WILL make the patrol nodes useless.
EDIT:
Btw, how do i make multiple lamps lit/unlit?
Here :
PHP Code:
SetLampLit("///NAME////"falsetrue); 
To turn off lamp.
PHP Code:
SetLampLit("///NAME///"truetrue); 
To turn on lamp.


RE: If the lamp is lit, monster deactivates ? - FlawlessHappiness - 03-02-2013

I suppose this is only going to happen once?
That sounds pretty easy. What you need is a function for when the monster spawns (Which you already has) and a function for despawning it.

Good. So spawn the monster and unlit the candle when you want to in the script.
Then, create a callback function called: SetEntityCallbackFunc.
This function is pretty cool.

Good so in your script you make it like this:

void CALLBACKFUNC(string &in asEntity, string &in asType)
{
if(asType == OnIgnite)
{
//Despawn monster
}
}