Hello everyone. I'm new here, and to coding in general, though I've been toying with the idea of making a game in AGS since about 2007 or so. Forgive me if my question seems obvious.
Okay, in my scenario the character (cDummy) is supposed to pick up a bit of bamboo and an empty Jetpack. Nearby he finds a Crater with radioactive waste inside. The puzzle involves combining the inventory item iBamboo with iJetpackEmpty to make the new combined item iBambooJetpack, which can then be used on the Crater to siphon the waste to use as jetpack fuel. Once this is done the inventory item iBambooJetpack will be replaced with iJetpackFull.
The catch is that I don't want the player to be able to combine any of the items until after they have tried to use either the bamboo (iBamboo) or the empty Jetpack (iJetpackEmpty) on the Crater (hCarter1).
At the moment, I have this in my global script:
And this in my room script:
The game launches and everything works up to a point. The inventory items can be used on the crater and cDummy will say what he is supposed to, but if I try to combine the bamboo with the Jetpack AFTER using the items on the crater, I simply get the response "Why would I want to do that?". My assumption is the problem has something to do with "iBambooOrJetpackUsedOnCrater" and the fact it's written in both the global and the room script, but that's just my gut feeling. I really don't know. I thought maybe if I put all the code surrounding the crater in the global script?
Any help is greatly appreciated.
EDIT---
Sorry everyone. Figured it out as soon as I posted.
I got it working by removing "bool iBambooOrJetpackUsedOnCrater == false;" from room script, before putting this into the global script:
...and finally I put this in the Global HeaderScript:
Now it works flawlessly.
PS I've never really used a forum before and don't know the proper etiquette. Guess I'll leave this here for others with a similar problem to see?
Okay, in my scenario the character (cDummy) is supposed to pick up a bit of bamboo and an empty Jetpack. Nearby he finds a Crater with radioactive waste inside. The puzzle involves combining the inventory item iBamboo with iJetpackEmpty to make the new combined item iBambooJetpack, which can then be used on the Crater to siphon the waste to use as jetpack fuel. Once this is done the inventory item iBambooJetpack will be replaced with iJetpackFull.
The catch is that I don't want the player to be able to combine any of the items until after they have tried to use either the bamboo (iBamboo) or the empty Jetpack (iJetpackEmpty) on the Crater (hCarter1).
At the moment, I have this in my global script:
And this in my room script:
The game launches and everything works up to a point. The inventory items can be used on the crater and cDummy will say what he is supposed to, but if I try to combine the bamboo with the Jetpack AFTER using the items on the crater, I simply get the response "Why would I want to do that?". My assumption is the problem has something to do with "iBambooOrJetpackUsedOnCrater" and the fact it's written in both the global and the room script, but that's just my gut feeling. I really don't know. I thought maybe if I put all the code surrounding the crater in the global script?
Any help is greatly appreciated.
EDIT---
Sorry everyone. Figured it out as soon as I posted.
I got it working by removing "bool iBambooOrJetpackUsedOnCrater == false;" from room script, before putting this into the global script:
...and finally I put this in the Global HeaderScript:
Now it works flawlessly.
PS I've never really used a forum before and don't know the proper etiquette. Guess I'll leave this here for others with a similar problem to see?