I'm really sorry if this is already answered or/and is a simplest question but I did go through the manual. I have followed the tutorial twice and I have checked the knowledge base. I wanted to ask some questions here but was (and still am)afraid of the rules. I searched the help file with different terms and I couldn't find the solution. Maybe this post would get locked or deleted after I post it but I really couldn't find the solution. :(
I wanted to know what should I do to get another message on a hotspot after the inventory item is used. For e.g I have this cupboard in the game that I was making which is locked and so I set the message "it's locked" but once it is unlocked with the key it should display another message and I don't know how to do that. The "conditional-if inventroy was used" works on inventory and not interaction. :-[
From the front page of the BFAQ:
Quote
NOTE: Please keep the following in mind. Most of our problems can be easily solved using variables. Need to change a hotspot's state in another room? Use variables! Need an object to be used only once? Use variables! You can either use Global Integers and Global Strings (look inside the AGS manual for these) or custom variables. Look at the solution to that problem HERE (http://americangirlscouts.org/agswiki/index.php/Scripting%2C_Code_%26_Interaction#Working_with_variables:_the_basics) under "Scripting, Code & Interaction".
And a variable is what you want. Follow the link in the above quote (this one (http://americangirlscouts.org/agswiki/index.php/Scripting%2C_Code_%26_Interaction#Working_with_variables:_the_basics)) for more details about them, but basically when you use the key change teh value of a variable (GlobalInt, Scripted variable or one of the Interaction Editor variables - whichever you prefer), and then check that variable in the Hotspot interaction, e.g.:
if (unlocked == 0) Display("You can't open the door."); // Before you've used the key
else if (unlocked == 1) Display("The cupboard opens, but is empty."); // After you've used the key
Thanks a lot Ashen. I'm sorry if it was another annoying question that was already answered. I really don't want to disrepect your rules but I couldn't find that solution. I'll try that.
Edit: I'm doing something wrong. I don't know how to insert a variable. The link you gave me is really nice but how am I supposed to change a variable. It doesn't work. Can you please tell me how to do it?
The cupboard is my hotspot 5 and it displays the message "it's locked" even after the inventry is used. How do I change the message to "there's nothing usefull in it now" after the inventory was used. If I change the variable I get a message like 'not a valid message number'
Can you show exactly what interactions you've got? It might be easier to take a screenshot of the Interaction Editor and post that. You should have something like (assuming you've got no other interactions set):
Hotspot 5 (Cupboard)
Player stands on hotspot (obsolete)
Look at hotspot
Interact hotspot
-? Conditional - If variable is set to a certain value (0,0)
- Game - Display Message (0)
-? Conditional - If variable is set to a certain value (0,1)
- Game - Display Message (1)
Use Inventory on hotspot
-? Conditonal - If inventory item was used (1)
- Game - Set variable value (0,1)
(The variable, item and message numbers might be different.)
If you were using script, you'd add a 'Run script' interaction under 'Interact hotspot', and put the code I mentioned in there. (You'd also need to have created the
unlocked variable - see the BFAQ entry.)
Also:
Quote
If I click on change and change varialble, the engine tells me that it's not a proper message.
What are you trying to do? Can you be a little clearer, please, and also post the exact wording of the error.
EDIT:
QuoteIf I change the variable I get a message like 'not a valid message number'
Are you trying to display the value of the variable? (E.g. if the varaible is 0, display message 0, if it's one, display message 1) I can't see why else changing the variable would generate a 'message number' error. Have you actually created the 'nothing useful' message in the editor?
Again - post the interactions you're using.
After following the steps that you have mentioned about interactions, I was finally able to do it after trying and chagning the variables. I was giving different names to variable rather than same or numbers. Instead of naming a variable 0 I was naming it 'lkd' and the other one unlkd'. This time I named it zero and only changed the values. It worked. Thanx
However there's another thing that I needed to ask.
I read in the help file "IMPORTANT: When the "If inventory item was used" conditional is met, the player will lose the inventory item, UNLESS "do not lose inventory items" is checked in the General Settings pane."
I didn't lose the key after I used it and that option is not in the general settings. The version of AGS is 2.70. So does this mean that I have to manually add "remove an item"?
That's correct. Add the lose invetory inside the conditional