magic bag request
magic bag request
Hello there,
does someone already think to do some kind of magic bag?
a bag that his weight is 0 lb, and everything you put in don"t increase the weight.
Is this possible to script?
does someone already think to do some kind of magic bag?
a bag that his weight is 0 lb, and everything you put in don"t increase the weight.
Is this possible to script?
- JohnWordsworth
- Posts: 1397
- Joined: Fri Sep 14, 2012 4:19 pm
- Location: Devon, United Kingdom
- Contact:
Re: magic bag request
Not as easy as you might hope. Unfortunately, I don't think you can alter the weight of any object once the dungeon has started, nor can you alter the maxLoad statistic for the player (without increasing their strength, that doesn't really make sense).
So, how could you do it? Well, the answers I can think of are not simple, I will present two here for discussion - but each would be a lot of code.
1. For each bag of holding, you would have a bag of holding object stuffed away somewhere inaccessible in the dungeon. Using an onDrawInventory hook, every time an item is added to the bag of holding you would actually put the real item in the hidden bag of holding. Then, in the real bag of holding, you would add a copy of that object that has weight zero. This means having a copy of every item in the game that also has weight zero. While this sounds like a lot of work, it wouldn't be - as you could write your own defineObject/cloneObject methods that call the original define/clone object calls twice (once for the normal item, once for the 'weight_zero' version).
2. You could have a custom GUI appear on the onDrawInventory hook again. This method also uses a fake bag hidden away somewhere. Using the real bag would present a text list of all of the items inside the bag (no icons, unfortunately, as we cannot draw a sub-rect of the icon atlas texture using the GUI system). Dropping an item on the list would actually put the item in the fake bag and add that item to the list. Getting an item would involve clicking on it's name from the list. I guess this is kind of D&D like, in the sense that you cannot see the items in the bag - you have to simply request what you want and it comes out.
Both are a lot of work unfortunately. There might be an easier way, but I can't think of one off the top of my head!
So, how could you do it? Well, the answers I can think of are not simple, I will present two here for discussion - but each would be a lot of code.
1. For each bag of holding, you would have a bag of holding object stuffed away somewhere inaccessible in the dungeon. Using an onDrawInventory hook, every time an item is added to the bag of holding you would actually put the real item in the hidden bag of holding. Then, in the real bag of holding, you would add a copy of that object that has weight zero. This means having a copy of every item in the game that also has weight zero. While this sounds like a lot of work, it wouldn't be - as you could write your own defineObject/cloneObject methods that call the original define/clone object calls twice (once for the normal item, once for the 'weight_zero' version).
2. You could have a custom GUI appear on the onDrawInventory hook again. This method also uses a fake bag hidden away somewhere. Using the real bag would present a text list of all of the items inside the bag (no icons, unfortunately, as we cannot draw a sub-rect of the icon atlas texture using the GUI system). Dropping an item on the list would actually put the item in the fake bag and add that item to the list. Getting an item would involve clicking on it's name from the list. I guess this is kind of D&D like, in the sense that you cannot see the items in the bag - you have to simply request what you want and it comes out.
Both are a lot of work unfortunately. There might be an easier way, but I can't think of one off the top of my head!
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Re: magic bag request
Ok, sounds very complicated to do, too much work then.
Just curious to know if there was some easy way.
Just curious to know if there was some easy way.
- JohnWordsworth
- Posts: 1397
- Joined: Fri Sep 14, 2012 4:19 pm
- Location: Devon, United Kingdom
- Contact:
Re: magic bag request
Hopefully in LOG 2 we will be able to alter more properties of objects / items 'live' so that it would just be as simple as calculating the weight of all of the contents and then using 'setWeight(-contents)' to counter out the weight of the contents. Unfortunately though, this is not the case!
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Re: magic bag request
has anyone tried an item with negative weight, does that even work?
Finished Dungeons - complete mods to play
- JohnWordsworth
- Posts: 1397
- Joined: Fri Sep 14, 2012 4:19 pm
- Location: Devon, United Kingdom
- Contact:
Re: magic bag request
I'm pretty sure you can have an item with negative weight (that reduces your load when in your inventory), but the amount of negative weight is fixed and will always decrease how much weight you're carrying in total by the same amount.
I guess you could effectively increase the character's load by giving them a "Load Stone" or something, with a -10 mass?
I guess you could effectively increase the character's load by giving them a "Load Stone" or something, with a -10 mass?
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Re: magic bag request
So that's my idea, have around 1000 custom magic bags, each with a 0.1 variance of negative weight, and have it count all the weight of the items placed inside, destroy them all, make a new bag with exactly the opposite total, create all new items to populate the bag, and presto! Or make it easy and just make 100 bags and call it the closest KG
The very easiest would be to have a bag/stone combo, and just have the bag calculate the weight and swap out the appropriate stone. The stone could even go inside the bag.
The very easiest would be to have a bag/stone combo, and just have the bag calculate the weight and swap out the appropriate stone. The stone could even go inside the bag.
Finished Dungeons - complete mods to play
- JohnWordsworth
- Posts: 1397
- Joined: Fri Sep 14, 2012 4:19 pm
- Location: Devon, United Kingdom
- Contact:
Re: magic bag request
I like the stone idea. You could probably stash it in 'slot 7' of your 6 slot bag so that the user never actually sees it. I think one main point about a solution is that you don't want to destroy/recreate the items as that will reset properties on the items like their remaining charges and fuel. You might be able to serialise all of that in tables via getters/setters but I'm not 100% every property has a getter/setter.
The stones should work though (in hidden slot #7). I think you would still want an onDrawInventory hook to scan for changes in the bags contents too as there are no insert/remove item hooks for containers.
Would be a cool item, but I don't think I have the spare time at the moment I'm afraid just to make it for fun!
The stones should work though (in hidden slot #7). I think you would still want an onDrawInventory hook to scan for changes in the bags contents too as there are no insert/remove item hooks for containers.
Would be a cool item, but I don't think I have the spare time at the moment I'm afraid just to make it for fun!
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Re: magic bag request
Why not make the bag have a fixed weight ~up to a maximum virtual weight... Like a decorative bag that weighs 5 pounds ~empty, but can hold 35 pounds of stuff; @5pounds weight.
There could be bigger bags ~they could hold 75pounds, and always weigh 10 pounds.
Or Instead of fixed weights... Have a few bags that swap out after they enclose more than a certain amount of weight. Have the bags weight a constant % of a certain maximum, before doubling in weight ~with a new limit, double the previous limit.
There could be bigger bags ~they could hold 75pounds, and always weigh 10 pounds.
Or Instead of fixed weights... Have a few bags that swap out after they enclose more than a certain amount of weight. Have the bags weight a constant % of a certain maximum, before doubling in weight ~with a new limit, double the previous limit.
Re: magic bag request
I know you guys aren't looking for ways to make it more complex, but this might be a nice workaround regarding weights, hooks, and moving items:
Make it a "Portable Hole". To use it, you drop it in front of you. You see a medium sized "hole" appear in the square in front of the party (Not large enough for a person to fall into,perhaps even a blocker object). and it spawns an invisible teleporter to a "Secret closet". A way to log and retrieve the items, then whala! 0 weight, and the actual item gets teleported back to the square when you want it.(Not in inventory, just on the square next to the hole. I THINK it's all doable,but by someone far smarter than myself. Anything you guys can think of in this that can't be done in the engine?
Make it a "Portable Hole". To use it, you drop it in front of you. You see a medium sized "hole" appear in the square in front of the party (Not large enough for a person to fall into,perhaps even a blocker object). and it spawns an invisible teleporter to a "Secret closet". A way to log and retrieve the items, then whala! 0 weight, and the actual item gets teleported back to the square when you want it.(Not in inventory, just on the square next to the hole. I THINK it's all doable,but by someone far smarter than myself. Anything you guys can think of in this that can't be done in the engine?
Currently conspiring with many modders on the "Legends of the Northern Realms"project.
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
