Frictional Games Forum (read-only)
Can using a Laudanium call a callback? - 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: Can using a Laudanium call a callback? (/thread-8636.html)



Can using a Laudanium call a callback? - Hardarm - 06-16-2011

Hi. Can someone call a callback using a laudanium? (obviously to myself);
Just using a normal laudanium.
here's the part of the code:
Code:
void fade1(string &in asTimer)
{
SetEntityPlayerInteractCallback("potion_health_1", "TakeIt", true);
FadeIn(1.0);
StartPlayerLookAt("potion_health_1", 10, 1, "");
SetMessage("Global", "Hint02", 4);
SetPlayerActive(true);
}

void TakeIt(string &in asEntity)
{
SetMessage("Global", "Hint03", 3);
SetEntityActive("rock_debris_brown01_1", true);
SetEntityActive("rock_debris_brown02_1", true);
StartScreenShake(0.3, 2, 0.5, 0.5);
PlaySoundAtEntity("", "break_stairs.snt", "ScriptArea_4", 0, false);
AddUseItemCallback("", "potion_health_1", "Player", "fade2", false);
}

void fade2(string &in asItem, string &in asEntity)
{
ExitInventory();
SetInventoryDisabled(true);
FadeOut(2.0);
AddTimer("", 4, "fade3");
}

I tried this, map does start, but fade2 doesn't work. help please? Sad


RE: Can using a Laudanium call a callback? - Tanshaydar - 06-16-2011

Interaction callbacks are being called the moment you pick the item, not the moment you use them. You can check player health instead whenever it opens or closes inventory.


RE: Can using a Laudanium call a callback? - Hardarm - 06-16-2011

(06-16-2011, 10:28 AM)Tanshaydar Wrote: Interaction callbacks are being called the moment you pick the item, not the moment you use them. You can check player health instead whenever it opens or closes inventory.

In fact you fall down in a really big descent. and the health must be 99, but if someone's smart can just sit there and wait, and take the laudanium later


Help please i need it to continue the script of my map :/ Shall I edit the inventory.hps?


RE: Can using a Laudanium call a callback? - Russ Money - 06-16-2011

(06-16-2011, 10:34 AM)Hardarm Wrote:
(06-16-2011, 10:28 AM)Tanshaydar Wrote: Interaction callbacks are being called the moment you pick the item, not the moment you use them. You can check player health instead whenever it opens or closes inventory.

In fact you fall down in a really big descent. and the health must be 99, but if someone's smart can just sit there and wait, and take the laudanium later


Help please i need it to continue the script of my map :/ Shall I edit the inventory.hps?

Editing the inventory.hps wouldn't do anything, I believe that's mainly used for combinations. If you anticipate the player would use the Laudanium when they got it, you could set a short timer that after they pick it up, it would fade to black. Otherwise I cannot think of a way besides checking their health to see if it "stablized" meaning they used the Laudanium.


RE: Can using a Laudanium call a callback? - Hardarm - 06-16-2011

But how to call a callback when they use it; i mean. They use the Laudanium, and inventory will exit and there's a series of action, as you can see on fade2. But i can't make that function work....


RE: Can using a Laudanium call a callback? - nemesis567 - 06-16-2011

Loop Timer, 1 sec duration. When the player landanum count reduces by 1, that is called since the only way for the player to loose the landanum is to use it.



RE: Can using a Laudanium call a callback? - Hardarm - 06-16-2011

Can you paste the code please? I'm kind of noob on that.


RE: Can using a Laudanium call a callback? - nemesis567 - 06-16-2011

http://pastebin.com/MCE1rWbW


RE: Can using a Laudanium call a callback? - Hardarm - 06-16-2011

Thank you that worked! Shy