Trouble with Maximums, Clothes and Doors.

KReed92
30 Jul 2013, 12:03
Hello again :) I'm having a little bit of trouble with a few things and once I've sorted them out, I can FINALLY leave the first room of my game and start actually having fun designing the rest of it, lol!

FIRST: STATS
I'm having an issue with some of my stats in the game; namely restoring them. I'm sort of a Quest veteran but it's only recently that I'm using a new type of health (i.e using my own health stat instead of the in-built one.) This is namely because I have numerous characters each with their own max health and I also like the larger freedom you have with your own stats.

It was very easy to set up damage, stat loss and dying using things like the following:

HEALTH: 4/100
The enemy hits you! You take 5 damage.
(Set health -5. If health is less than 1, player dies, end game etc.)

So that was really simple as always.

However, when RESTORING health, I ran into this problem:
HEALTH: 75/100
You drink the potion. Health +30
(Set health +30)
HEALTH: 105/100
Oh dear... ^ that's not supposed to happen.

Now I HAVE found a way around this, which is this:
(IF... health is less than 71, then Set health +30, Else... set health =100)

This makes sure that it doesn't exceed the maximum, but that is a bit of a pain to have to have TWO seperate responses to drinking it and I feel like I'm taking the long way around something that most of you probably have an easier method for that I'm too braindead to work out today. Unfortunately I'm stumped. I can keep doing it my way fairly easily. It's not a huge problem but it'd be nice if I could find even a slightly easier way to do it :)

SECOND: CLOTHES
This is in relation to the brilliant 'wearables' library. My two characters are an adult and a child and all of the clothes I make have "adult size" or "child size" in the descriptions. I want to make it so that neither character can wear the wrong size.
I.e: if a player is controling the child and tries to wear an adult size clothing, the child will respond with "that won't fit" and will not wear the item. Unfortunately this doesn't seem possible in the scripting and may not be possible at all. It's a minor issue and one that only detail-whores like myself (and the friend I am creating the game for) would probably bother about lol, but I think it would be very bizarre if both characters could wear anything they found regardless of size and it takes the seriousness away from the game if the player is too busy laughing at that. This isn't Dead Rising after all... hehe.

THIRD: DOORS
I have two issues with this at the moment and it relates to literally being able to leave the room as mentioned earlier. I want to make it so that a player has to open a physical door in order to be able to leave through the exit (and if they try to leave without opening the door, the game will say "the door is closed" or something along those lines). I can't figure that out yet unforunately. I think what I need is some kind of 'reveal exit when door is open' kind of things but I'm not sure where I go script-wise.

My second problem is preventing the players from leaving WITHOUT locking the door to do so because they don't need a key.
When the game begins, I want the player to perform specific actions before they can open the afformentioned door. In this instance, I want them to dress the character and pick up a bag. If they haven't done those things and try to open the door, I want the character to say "I'm not going out there naked..." or "I don't have my bag". If they ARE dressed and carrying the bag, then they will be able to leave as normal. I think I can set this up with flags (I already use a 'bag' flag) but I'm not sure if it's the door or the exit that needs the script and indeed if I can script anything like that at all because there doesn't seem to be a 'run script' option for ATTEMPTING to open the door.

Hopefully some of this is doable :) Thank you for taking the time and patience to read this admittedly long post and I greatly appreciate anybody who can come up with a solution to these little problems. Like last time, I apologise for not including my game file but I wish to keep it private until it is finished. x

Pertex
30 Jul 2013, 14:49
FIRST: STATS
If think you can do something like
IF... health >100, then Set health =100

Liam315
30 Jul 2013, 20:39
Pertex wrote:FIRST: STATS
If think you can do something like
IF... health >100, then Set health =100

When you go to the attributes tab and highlight one, you'll notice a button (next to the add attribute button) labelled "add change script." Like the name implies, this is a script that will run every time the attribute you have selected changes. On your health attribute, add a change script like the one Pertex suggested above. You could add your script for dying when health < 1 here also, rather than manually adding it to every script that decreases health.

For clothes, add attributes to the players that distinguish them as adult and child. If these are the only two sizes then a boolean attribute should be sufficient. Add the same attribute to the clothes, then on your commands that control wearing clothes, use something along the lines of if ((game.pov.adult and clothing_item.adult) or (not game.pov.adult and not clothing_item.adult). Using object types may be useful if there are going to be more than a few pieces of clothing.

The last thing with doors is also doable. If you select the exit in the object tree you will see a checkbox for running a script instead of moving automatically. From here you can add all the if scripts you need to prevent the player from going through.

KReed92
31 Jul 2013, 08:08
Thank you both for those answers :) They look great and I'll be trying them out in a bit. I am very pleased that the door thing will work and can't believe I never saw that checkbox before when it was right in front of me! lol.

Again I can't believe I ever noticed the change script! It won't really work for what I'm doing because I'm using unique death messages based on all kinds of factors (such as what killed them and such) but it's good to know for future reference and might come in handy for my other stats.

The only thing I'm still stumped on now is the clothing things. I can set up the attributes but I'm not sure how to make it so that a character will not wear the clothes. Would something like, "If not game.pov.adult then callfunction remove clothing_name"? work to force the character to take it off again? There doesn't seem to be a way of preventing them from wearing it (because of how the library works) so I'd settle for having them automatically remove it (using some clever wording to make it SOUND like they never put it on lol) It seems like such a silly thing to have a problem with and I'm tempted to just have the characters go naked to save the trouble lol! :lol:

*EDIT* New Problem With Doors
I have it set so that opening the door will reveal the exit and closing it will hide it again. But for some reason when I type 'open door' whilst it's already open, I don't get the 'it's already open' message, but I DO if I try to close it whilst it's closed. I haven't change or given any open/close messages so it's not that that's messed up :S

Oh! How can I make it print a "you can go..." thing after opening the door?

Like
> Open door
You open the door.
You can go south (with south being clickable to move there)?

Thank you again for your help and advice. :)

HegemonKhan
01 Aug 2013, 02:07
Chase (nor Pixie) have implemented your "clothes_size_player_size" conditional into their coding~library files. You'll have to figure it out (and then if you want to go even further, create the Tabs for the GUI~Editor~Inteface for it too, hehe). Though, it shouldn't be too hard to do, if you (and I too, lol) can do coding decently.

----------------

for the clothes, conceptually in it's simpliest form (you probably would want to expand upon it though), it can be like this:

Equip_Command_and_or_Verb:

if (player.adult=true and clothes_item_name.adult_size=true) {
-> equip_function
} else {
-> msg ("Sorry, but those clothes aren't meant to be worn by you.")
}

remove, doesn't need to be adjusted, when you want to remove something, you just remove it, who cares about whether you are an adult or child and your clothes are adult or child size, removing is removing, lol. The only way that I can think of there being conditionals for removal, is with the equipment_layer (it's hard to remove your undergarmets when you've got clothing on top of them, lol) as is in Chase's Wearables library already, and with "cursed" (non-removeable, except by a clergyman at a church as it often is implemented) equipment like in many RPGs. Lastly, wearing (and not wearing) the proper clothes will be determined by the equip_function, so you shouldn't have the wrong clothes equipped, anyways, lol. If the clothes are wrong, then you just simply don't ever equip them to begin with, so no need to worry about how to remove wrong clothes to body.

[edit: I just realized, that if you were to change your body_size, such as "growing up", from child to adult, then indeed, you'd need coding to check for what your body size is and what size your clothes are, and then to remove them if they don't match]

but, for now, I'll leave how to actually code it, for you to try to figure out. If you still need help with the coding, then I can try to help you with it (I'm still trying to learn to code too, hehe ~ as I'm still trying to learn equipment coding myself).

------------

Exits and their needed "Door" Objects have been causing a lot of people difficulties. There's a debate about whether having a single object, act as both a door and exit, or having two separate objects: Exit objects~elements and "door" objects.

the "open" script (which I believe would be a child attribute ~attached~ to your "door" object), should have an option box for a message or "choose_script" for "upon~when opening", which you can then add your comment message to it.