Frictional Games Forum (read-only)
If player has tinderboxes - 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 player has tinderboxes (/thread-18181.html)



If player has tinderboxes - JPiiONEFOURONE - 09-06-2012

Hey guys,

When interacting with an entity, I only want the function to work if the player has 1 or more tinderboxes in his/her inventory.

I have tried the following, but it doesn't work.


Code:
void MyFunc(string &in asEntity)
{
    if(HasItem("tinderbox"))
    {
        Do something;
    }
}

I understand why it doesn't work, it's because the tinderboxes aren't internally named "tinderbox", so, is there another way I can check if the player has tinderboxes?

Thanks,

JPiiONEFOURONE


RE: If player has tinderboxes - Kiwi2703 - 09-06-2012

I think it should be:

if(HasItem("tinderbox") == true)

edit: Nope, sorry Big Grin


RE: If player has tinderboxes - JPiiONEFOURONE - 09-06-2012

(09-06-2012, 05:40 PM)Kiwi2703 Wrote: I think it should be:

if(HasItem("tinderbox") == true)
I don't think so, it works with other items.


RE: If player has tinderboxes - SilentStriker - 09-06-2012

If I'm not mistaken tinderboxes don't work the same way as other items, but I'm not sure


RE: If player has tinderboxes - Your Computer - 09-06-2012

If you want to keep track of tinderboxes, use a global map variable that increments whenever you interact with a tinderbox, then compare against the global map variable.


RE: If player has tinderboxes - JPiiONEFOURONE - 09-06-2012

(09-06-2012, 05:55 PM)Your Computer Wrote: If you want to keep track of tinderboxes, use a global map variable that increments whenever you interact with a tinderbox, then compare against the global map variable.
You sir, are a genius. rep+

(09-06-2012, 05:55 PM)Your Computer Wrote: If you want to keep track of tinderboxes, use a global map variable that increments whenever you interact with a tinderbox, then compare against the global map variable.
Is there a way I can print the value of this variable to the screen for debugging purposes, or any way I can see the value in-game?


RE: If player has tinderboxes - Robby - 09-06-2012

Well, there's the debug menu in-game. Select the "Player info" or something like that. Looking closely at the "self-updating" wall of text, there's a line. "Tinderboxes: #". The # stands for numbers (0, 1, 2, etc. you get the idea).

Debug menu is F1, I think.


RE: If player has tinderboxes - JPiiONEFOURONE - 09-06-2012

(09-06-2012, 06:33 PM)Nemet Robert Wrote: Well, there's the debug menu in-game. Select the "Player info" or something like that. Looking closely at the "self-updating" wall of text, there's a line. "Tinderboxes: #". The # stands for numbers (0, 1, 2, etc. you get the idea).

Debug menu is F1, I think.
How can I get my own custom variable to show on the player info?


RE: If player has tinderboxes - Robby - 09-06-2012

(09-06-2012, 07:17 PM)JPiiONEFOURONE Wrote:
(09-06-2012, 06:33 PM)Nemet Robert Wrote: Well, there's the debug menu in-game. Select the "Player info" or something like that. Looking closely at the "self-updating" wall of text, there's a line. "Tinderboxes: #". The # stands for numbers (0, 1, 2, etc. you get the idea).

Debug menu is F1, I think.
How can I get my own custom variable to show on the player info?
Well, that is something I do not know. You can try using a debug message in your script.

Code:
AddDebugMessage(string& asString, bool abCheckForDuplicates);

You need a language file (the one used for the custom story)


RE: If player has tinderboxes - Theforgot3n1 - 09-08-2012

(09-06-2012, 07:20 PM)Nemet Robert Wrote:
(09-06-2012, 07:17 PM)JPiiONEFOURONE Wrote: How can I get my own custom variable to show on the player info?
Well, that is something I do not know. You can try using a debug message in your script.

Code:
AddDebugMessage(string& asString, bool abCheckForDuplicates);

You need a language file (the one used for the custom story)
AddDebugMessage does not need the language file to operate. Just write like

AddDebugMessage(GetLocalVarString("TinderBoxAmount"), false);

and it'll tell you the exact amount of tinderboxes acquired during the run-through.

Need to set up a debug profile though!