A question, another not so simple question, and a weird problem with the map.

TL;DR : Should I use a move script for stairs, how do I make a working bag and how do I solve this weird thing where upper and lower floors won't fade?
Oh and most of what I ask is simply theoretical, obviously. Result : some things I say might pure bs lol.

First question : how do I make stairs?

I want the player to both move south (or any other direction, but in this case it's south) and down when getting in the lower half of the stairs, should I use a move script for this? Or is there another way to do it?

Second question : I want my character to start the game already wearing something like a bag or satchel, which would be used as inventory instead of the player's. What I have is the satchel being worn, but when I go and take an object, I can't figure for the life of me how to automatically put picked up things in the currently equipped inventory item.

Believe me, I tried, and that's a problem present since the second room of the game. It could also be a big one for later on as I want players to be able to buy better bags and either sell or store their current bag away, the pc's room (a.k.a. the starting room) would hold a chest or maybe closet since that would make more sense for them to put extra bags away. I would settle the limit to either three bags, or two bags and three satchels (somewhat jerk move from my part, some items will only be transportable in a satchel) of course I already know how to settle the max volume and object quantity, I just need to figure out how to limit said storage capacity to specific objects, at least in a way that isn't obnoxiously long and complicated to the point I can't remember what to do.
Worse, when they buy a new bag, I would, ideally, make it so either they are asked to or automatically put all their belongings in the new bag.

And now, the map. You know how different floors are suppose to fade when going up or down? Well, my map doesn't do that anymore. Maybe that has to do with how I made my stairs, in which case that would probably then tie back to my first question, but I doubt it (one move down, then another south).

Ps : can I make a quote in quote "overworld" by making the outside fade when in a building and vice versa (first, the overworld, which would fade when in town or a building, the town map would show the buildings, but fade when going in one of them)? Still about the map, since I want to later have enemies (when I have a working map and proper buy/sell and combat mechanics in), if I made enemies that are randomly generated every move while the player is in their spawn area (a chance between 0 and 2 foes generated every step and within a set group of enemies each with their own chance of being chosen for spawn, even if the result of the current turn is 0 (to save a bit of time on my part) for example), could I prevent them coming in towns if I limited their movements to a set area? Better yet, could, if overpopulation is possible, could I make it so that when the player exits their zone, the enemies in it despawn (or an alternative, where as long as the player is outside their zone, they can no longer spawn, but can also disappear, that way players can play it safe and avoid having clusters of enemies in large areas by waiting for them to vanish)? I know that was way off the subject, but I just had to ask for later (so I won't have to ask a million things in a million different topics).


I want the player to both move south (or any other direction, but in this case it's south) and down when getting in the lower half of the stairs, should I use a move script for this? Or is there another way to do it?

For an "up" or "down" exit, it looks like you can give the exit numeric attributes grid_offset_x and grid_offset_y, which allow you to move the destination room right and down on the map respectively. So for an exit that goes both down and south, you'd want to give the exit an attribute grid_offset_y with the value 30.

These attributes used to be on the 'Map' tab of exits, but they seem to have been removed from the editor in a recent update. I can't find out why, so it's possible some of this code may be broken.

I'll suggest experimenting with those attributes, and seeing if they work.

If you have a 'down' exit with that attribute, I'd suggest giving it aliases (in the alt stringlist attribute) "south", "s", and "stairs" as well, in case a player looking at the map/description types "south" or "go stairs" and expects it to work.

EDIT: "You can't post that here"
I hate this forum sometimes.


Here's the second answer, if it will let me post it.

when I go and take an object, I can't figure for the life of me how to automatically put picked up things in the currently equipped inventory item.

As it stands, this isn't at all easy. You would need to change the function of the built-in "take" command.

If you're on the desktop editor, you can find the core function DoTake and modify it. My suggestion would be to find the lines

              object.parent = game.pov
              if (takemsg = null) {
                takemsg = DynamicTemplate("TakeSuccessful", object)
              }

and change it to

              message = AddToInventory (object)
              if (takemsg = null or not Contains (game.pov, object)) {
                takemsg = message
              }

Then you can modify the AddToInventory function (meaning that you can use it elsewhere in the script to give the player an object, rather than duplicating the code).

The AddToInventory function, I'd suggest replacing with something like:
(code snipped, to see if the forum will let me post it)

I'm assuming that you have a type 'inventorybag' for these bags. If you're identifying them by some attribute, just replace FilterByType with FilterByAttribute as appropriate.

Note that I've modified AddToInventory to return a string; which will either tell the player that the object is in their bag, or an error message if the bag is full.
In the case of other scripts which add an object to the player's inventory, such as an NPC giving them something, you would want to check that the object is actually in the player's inventory to make sure it didn't run into a bag-full condition.

This function loops over a list of bags. In a game where the player can only equip one bag at a time, this is a list that only ever contains one item; and using foreach is just as fast as using ListItem to get the single element, so it doesn't matter whether your game is going to allow none, one, or multiple bags.

You will probably want to have a separate function for when the player equips a new bag, which may do stuff like moving their current items into it (if they're only allowed a limited number of bags).

If I've misunderstood a part of your request, please let me know. I'm writign this just by glancing over the Quest core code, so there's a chance I've missed something. If there's a problem here, please let me know and I'll fix it later.


The forum won't let me post it here. So I put the function on my wiki instead.


Uh, sorry, where do I access the function (and yeah, I have the desktop version)? I mean, I see "functions" in the tree thingy on the left, but nowhere do I find something like "DoTake" or even a "core function", am I doing it wrong? I must be, otherwise I' sure I would've found it by now...
At least I think.

I hope we manage to solve this quick, I'm in no hurry, it's just that the faster I understand how to do this, the sooner I can go and finish the puzzle tutorial...
And then the fight tutorial, oh boy (though I want to make a town with a place to buy and sell things, test a few things for NPCs and after that I'll try and make a fight).

Ps : the grid offset is in the attributes, now it works, but... nervous laughs now everything stays faded.
But let's take it positively, that's already half the problem solved.

Pps : I haven't messed with object types until now, but now I've done, I think it will be quite useful.


The core functions are the ones that Quest includes by default. In the desktop version you can change them; in the web editor you can't. I think there's an option somewhere to make them visible so you can edit them, but I'm not sure where it is (I'm on linux, so can't use the desktop editor).

the grid offset is in the attributes, now it works, but... nervous laughs now everything stays faded.

The map should fade out everything whose z coordinate is different from the player's. If it fades out when you go down the stairs but stays faded when you go back up, I'd say make sure that the exit in the other direction is the opposite (so its main type is "up" but it has a negative grid_offset_y).

This is hard for me to test on the web editor, because I don't have the 'Attributes' tab.


Okay, so first : I must be very stupid lately since I just took notice of the "filter" button's existence lmao.

Two : I tinkered around with the positions, and now my map's back to being completely withe, then I did some weird voodoo magic shit and it got back to being fully grey (interesting fact, rooms I go in for the first time will still appear white if I visit them after having gone up or downstairs, though they go grey the moment I go up or down again), and miss Luck threw herself out the window, clearly fed up with my crap, because now, you probably guessed it, it's white again!
I'll see if I can solve this on my own while waiting for a reply.

Three : I modified the DoTake and AddToInventory functions as you showed me, but is it normal that the AddToInventory code is still black? I mean, the function still works (I nearly screamed "IT WORKS, IT WORKS" when I tested it, but I didn't cuz it's like 10 PM lol), I just find it weird that it's all in black when I look in the code (also I hadn't touched at the code itself before, so I was a little uneasy doing it, but I guess it was ok, thank you very much for the help, I'll have SOOOO many things less to worry about now that I have a working inventory).

Ps : I guess that after the puzzle tutorial I'll get going on doing the main part of the overworld and the main town, better doing this then procrastinating on that map fading problem for another couple of hours, and as a plus, writing is a hobby of mine, so I find having to write the description of all these rooms very exciting, it'll be a nice break from the last few days of struggles with learning the different scripts and whatnots.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums