Intricate Game Design (Please Assist)

Storyteller
05 Jul 2013, 02:14
So, I'm having some trouble putting together some code for a portion of the game I'm currently in the process of developing. It's got some mechanics that I don't understand how to implement, but I'd really like to have them. If there is any way someone could explain to me how to do it through the GUI(so I can learn, rather than just copy/paste,) I'd be very thankful.

(Each subject will be color-coated, as to not cause confusion.)



As you can see, the "Inventory" pane has been replaced with a "Hands" pane in the in-game interface. I've done this so that the player can hold only two objects at one time. However, I'd like to add backpacks throughout the game that can be worn, and increase the inventory size temporarily(items can be taken from/put in.) I want this to add another pane to the interface, which says "Backpack." If this is possible, could someone explain it to me?

The hands will only be able to hold two things at once... Also, if it's possible with more intricate coding, I'd like some objects to count as two objects, so that the player can't be holding something very large at the same time as something else. If this is possible, I'd greatly appreciate assistance.

The flashlight in my game does not work correctly. When turned on, the flashlight starts a timer which slowly depletes the battery. This works fine, and it's set to slowly count down to zero. When it hits zero, it's supposed to turn off the brightness of the flashlight, and make the room dark again if it was dark originally. Unfortunately, the room remains illuminated, even when the flashlight is off. However, if I activate the "Switch Off" command in the menu, THEN it makes the room dark. But, that's not how it should work.

      <onswitchon type="script">
play sound ("flon.wav", false, false)
SetObjectLightstrength (fl1, "strong")
EnableTimer (Batteries)
SetTimerScript (Batteries) {
set (fl1, "batteries", fl1.batteries - 1)
if (fl1.batteries = 0) {
msg ("The batteries in your flashlight have run out.")
DisableTimer (Batteries)
SetObjectLightstrength (fl1, "")
SetDark (player.parent)
}
}
</onswitchon>
<onswitchoff type="script">
play sound ("floff.wav", false, false)
DisableTimer (Batteries)
SetObjectLightstrength (fl1, "")
</onswitchoff>


Thank you all for any and all assistance!

jaynabonne
05 Jul 2013, 20:18
There is another thread where I had attempted to add a second inventory pane. I'd have to go back and look at that to see to what extent that got developed. (My memory ain't what it used to be.)

For the second issue, can you use an item's volume? (e.g. you can set different numbers for it). Otherwise, you can have some sort of "weight" or "slots taken" attribute, where some would be 1 and some would be 2.

I think the flashlight issue is being addressed elsewhere.

Storyteller
05 Jul 2013, 21:13

For the second issue, can you use an item's volume? (e.g. you can set different numbers for it). Otherwise, you can have some sort of "weight" or "slots taken" attribute, where some would be 1 and some would be 2.

I think the flashlight issue is being addressed elsewhere.




1. I'm sure I could, I just have no idea how to myself, so I'd need someone to explain it. I'm still learning how to use some of the Quest functions, and I'd like to learn to do it myself, in case I want to use it again in the future.


2. A few people TRIED to address the issue, but it just hasn't worked out so far.

HegemonKhan
06 Jul 2013, 06:14
I tried but was unable to help Storyteller as I was just trying to guess with it, having still no actual experience with working with the light~dark feature yet, so maybe you other guys~girls, who know coding well, could maybe give it a look at for storyteller.

jaynabonne
06 Jul 2013, 08:04
There are two properties you need to work with for volume management. (Keep in mind that I have not used them myself but am only basing this on looking through the core code, so I may be missing nuances.)

- "volume": This is an int attribute you assign to an object which can be placed inside a container or taken by the player.
- "maxvolume": This is an int attribute you assign to the player or a "limited container" to specify the maximum amount of stuff you can take or put in it (respectively).

Out of the box, the player has no "maxvolume" attribute, "volume" is 0, and "maxvolume" for a limited container is 100. You can put a lot of 0's in a 100 - as many as you like, in fact. :) But if you change the numbers around a bit, you can set some effective limits for how much you can pick up or put in a container.

Through the Editor interface:

To see some possibilities, create your backpack and make it a limited container on the "Container" tab. Then check some of the values you can set, like max objects and max volume.

For the player, check the "Inventory" tab for similar settings ("Inventory Limitation").

Check the "Inventory" tab under "Volume" to set the volume for an object.

(Regarding light sources, I have no experience with them whatsoever, so I'm afraid I can't help there.)

Pertex
07 Jul 2013, 08:40
I think this "setdark.." should be not necessary, but even with this command your script is working in my game.

Storyteller
07 Jul 2013, 16:24
Pertex wrote:I think this "setdark.." should be not necessary, but even with this command your script is working in my game.


How odd... So, you switch on the flashlight... after a few seconds, you get a message saying "Your flashlight has run out of batteries," and the room gets dark again?

Carrot
08 Jul 2013, 11:18
Storyteller wrote:

"Pertex"

I think this "setdark.." should be not necessary, but even with this command your script is working in my game.



How odd... So, you switch on the flashlight... after a few seconds, you get a message saying "Your flashlight has run out of batteries," and the room gets dark again?


Well I imagine the timer would be turn based, and last a bit longer - but I assume it is trying to get the player to manage their resources.

Pertex
08 Jul 2013, 14:53
Ahh, now I understand. You should add the function call "CheckDarkness" at the timer end


<onswitchon type="script">
play sound ("flon.wav", false, false)
SetObjectLightstrength (fl1, "strong")
EnableTimer (Batteries)
SetTimerScript (Batteries) {
set (fl1, "batteries", fl1.batteries - 1)
if (fl1.batteries = 0) {
msg ("The batteries in your flashlight have run out.")
DisableTimer (Batteries)
SetObjectLightstrength (fl1, "")
CheckDarkness
}
}
</onswitchon>


jaynabonne
10 Jul 2013, 08:47
I've submitted code that creates a second inventory/object pane. I've created a thread in the "Libraries and Code Samples" forum for it. Check it out if you wish to give it a try.

viewtopic.php?f=18&t=3789

HegemonKhan
11 Jul 2013, 02:59
that's awesome, and surely useful for people to now have a library~code for adding~creating more panes, thank you Jayna!