Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
If player has tinderboxes
JPiiONEFOURONE Offline
Junior Member

Posts: 13
Threads: 4
Joined: Sep 2012
Reputation: 0
#1
If player has tinderboxes

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.


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
09-06-2012, 05:36 PM
Find
Kiwi2703 Offline
Junior Member

Posts: 27
Threads: 5
Joined: Sep 2012
Reputation: 2
#2
RE: If player has tinderboxes

I think it should be:

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

edit: Nope, sorry Big Grin
(This post was last modified: 09-06-2012, 05:43 PM by Kiwi2703.)
09-06-2012, 05:40 PM
Find
JPiiONEFOURONE Offline
Junior Member

Posts: 13
Threads: 4
Joined: Sep 2012
Reputation: 0
#3
RE: If player has tinderboxes

(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.
09-06-2012, 05:41 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#4
RE: If player has tinderboxes

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

09-06-2012, 05:49 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#5
RE: If player has tinderboxes

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.

Tutorials: From Noob to Pro
09-06-2012, 05:55 PM
Website Find
JPiiONEFOURONE Offline
Junior Member

Posts: 13
Threads: 4
Joined: Sep 2012
Reputation: 0
#6
RE: If player has tinderboxes

(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?
(This post was last modified: 09-06-2012, 06:28 PM by JPiiONEFOURONE.)
09-06-2012, 06:07 PM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#7
RE: If player has tinderboxes

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.

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
09-06-2012, 06:33 PM
Website Find
JPiiONEFOURONE Offline
Junior Member

Posts: 13
Threads: 4
Joined: Sep 2012
Reputation: 0
#8
RE: If player has tinderboxes

(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?
09-06-2012, 07:17 PM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#9
RE: If player has tinderboxes

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

AddDebugMessage(string& asString, bool abCheckForDuplicates);

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

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
(This post was last modified: 09-06-2012, 07:20 PM by Robby.)
09-06-2012, 07:20 PM
Website Find
Theforgot3n1 Offline
Member

Posts: 192
Threads: 20
Joined: Apr 2012
Reputation: 6
#10
RE: If player has tinderboxes

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

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!

Confusion: a Custom Story - Ch1 for play!
http://www.frictionalgames.com/forum/thread-15477.html
About 50% built.
Delayed for now though!
09-08-2012, 12:35 AM
Website Find




Users browsing this thread: 1 Guest(s)