JPiiONEFOURONE
Junior Member
Posts: 13
Threads: 4
Joined: Sep 2012
Reputation:
0
|
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 |
|
Kiwi2703
Junior Member
Posts: 27
Threads: 5
Joined: Sep 2012
Reputation:
2
|
RE: If player has tinderboxes
I think it should be:
if(HasItem("tinderbox") == true)
edit: Nope, sorry
(This post was last modified: 09-06-2012, 05:43 PM by Kiwi2703.)
|
|
09-06-2012, 05:40 PM |
|
JPiiONEFOURONE
Junior Member
Posts: 13
Threads: 4
Joined: Sep 2012
Reputation:
0
|
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 |
|
SilentStriker
Posting Freak
Posts: 950
Threads: 26
Joined: Jul 2011
Reputation:
43
|
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 |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
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.
|
|
09-06-2012, 05:55 PM |
|
JPiiONEFOURONE
Junior Member
Posts: 13
Threads: 4
Joined: Sep 2012
Reputation:
0
|
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 |
|
Robby
Posting Freak
Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation:
47
|
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 |
|
JPiiONEFOURONE
Junior Member
Posts: 13
Threads: 4
Joined: Sep 2012
Reputation:
0
|
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 |
|
Robby
Posting Freak
Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation:
47
|
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 |
|
Theforgot3n1
Member
Posts: 192
Threads: 20
Joined: Apr 2012
Reputation:
6
|
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!
|
|
09-08-2012, 12:35 AM |
|
|