Page 1 of 5
Released: Quick Action Bar
Posted: Sat May 25, 2013 1:07 pm
by JohnWordsworth
I recently started Grimrock again on Hard mode for the fun of playing it through again. I have a bow-based rogue and found it a little annoying to have to load the inventory to switch weapons often. This led to a chat this afternoon on Skype about the idea of a quick action bar.
Download:
http://grimrock.nexusmods.com/mods/262/
Demonstration:
http://m.youtube.com/#/watch?feature=yo ... 3Dyoutu.be
What it does...
1. Drag and drop it where you like on the screen (it's position is saved with your game).
2. Press ',' to toggle it on/off.
3. Select the current focus character and then you can...
a. Swap whatever is in your hands with whatever is in the first two slots of your backpack.
b. Tap the health potion to use a potion from your pack on the active character. Takes the first one it finds from any character pack - but not a sack / container (that seems a step too far!).
C. Tap the energy potion to use an energy potion on the active character.
So, LoG unfortunately doesn't provide 'light' mods or loading of scripts outside of the current dungeon (so you can't load this into a dungeon unless you have the source), but I wanted to mock the idea up anyway.
Uses:
1. if you are making a mod, and would like to include this, it's really easy to drop in. Let me know and I will put on the Nexus.
2. I hope AH consider something like this for LoG2 - that would be cool.
3. Thanks to Komag, I plan on downloading the source for his excellent remake(s), adding this code locally and playing it through

.
Re: Proof of Concept: Quick Action Bar
Posted: Sat May 25, 2013 1:20 pm
by Neikun
Super super cool, John.
Re: Proof of Concept: Quick Action Bar
Posted: Sat May 25, 2013 1:59 pm
by Komag
Wow, that's very impressive! I assume it works by destroying/recreating in the correct slots. The only unsolvable issue I've found with that method is that treasures behave like a new one, adding to your treasure count if you set them down and pick them up again afterwards. That's not a game breaker/deal breaker by any means though, since some of the other stats (like iron doors or Toorum notes) don't work properly in mods anyway.
Both Remake and Master Quest have the console print messages enabled/disabled by pressing z and x together, so making this z I suppose isn't a problem. Although I use z in editor to open doors (IIRC is that the default?), so it might be a slight issue for mod authors to implement and test, but that's just a simple matter of making it a different key if desired.
I'd be interested to look into this more in the future (too busy right now), and possibly implement it into both Remake and Master Quest officially with new updates.
EDIT - How do the potions work? I don't hear drink sounds, so I assume you destroy potion, create empty flask in place, and heal character by code? For master quest my potions are scaled, so I would have to code in a scale of healing amounts for this approach (shouldn't be a problem)
I think it would be nicer if sounds were added, maybe the equip sound or something similar for the item swap, and certainly the drink sound for potions (you probably were already going to do this)
But yeah, this is awesome, well done!
Re: Proof of Concept: Quick Action Bar
Posted: Sat May 25, 2013 3:52 pm
by msyblade
You're a wrecking machine, John!
Re: Proof of Concept: Quick Action Bar
Posted: Sat May 25, 2013 9:59 pm
by JohnWordsworth
Thanks for the positive comments guys! Some feedback on your suggestions Komag;
1. Re: Weapon Swap - Here it doesn't destroy / create any items. It uses getItem() on the inventory and backpack to pull the items into local variables, and then it removes the item from the character and then inserts them back into the new positions. This should mean that weapon charges etc all remain as they were. Will test though!
2. Re: Potions - Yup, it destroys the potions and recreates a flask in code, and then applies the healing effect separately. Great point about the sound effects (I made this last night with my wife in the room, so had it muted). Also, the amount of health that you get from the potions can be defined as functions (which by default will just return 50, but in your mod you can change it to do whatever you like!). Will add that today

.
3. Keyboard Commands - Good point, I didn't think to check which keys were used in the editor beyond WASD and K. They key is just a variable at the top of the script though, so can easily be changed.
Thanks for the comments, sounds like this could have a place in a mod or two, so I will tidy up as above and then add to the Nexus for anyone that would like to use it. Adding it to your mod is simply a case of dropping the graphics in, copying and pasting a script entity into your dungeon and adding 3 lines of code to your onDrawGui party hook.
Re: Proof of Concept: Quick Action Bar
Posted: Sat May 25, 2013 10:13 pm
by Komag
sounds great. I sort of promised myself I wouldn't add any more features to MQ, but this is so tempting/awesome I don't think I can resist

Re: Proof of Concept: Quick Action Bar
Posted: Sun May 26, 2013 6:54 am
by JohnWordsworth
I have added version 0.9.0 of the Quick Action Bar to the Grimrock Nexus. Hopefully I have stripped everything out correctly to make the download as minimum as possible. There is a sample dungeon so that you can have a play just by downloading the sample dungeon and exporting it or playing it full screen in the editor. Note that there are some oddities with onDrawGui at tiny resolutions, so for this to work correctly in the editor you have to play it full screen in the editor (as opposed to in a tiny preview window) - it should work when exported to the game however.
http://grimrock.nexusmods.com/mods/262/
Enjoy!
Re: Released: Quick Action Bar
Posted: Sun May 26, 2013 1:41 pm
by Komag
Wow, the coding looks pretty genius! I'm quite impressed - it's pretty far beyond my ability to script.
My only concern at this point is that it appears that it searches everyone's "shallow" inventory (I agree with that reasoning to not look in containers) EVERY FRAME of gui, which I anticipate will affect performance with everything else I have going on. I've spent time reducing such checks as much as possible in MQ. I haven't plugged this in yet, but maybe it could be altered to only update the potion counts every so often, such as every 50th frame or something (plus whenever a potion is used, picked up, equipped, etc, via hooks).
Re: Released: Quick Action Bar
Posted: Sun May 26, 2013 7:24 pm
by JohnWordsworth
Hi Komag, good thinking. I'd like to keep it really easy to drop in to any mod, so I think I prefer the 'every N frames' solution best. Good thing is, that will only take about 5 lines of code - so I will add that at some point today!
I will make it a parameter. I will probably make to 20-30 frames between checks by default, but you can change it to any number you like

.
Re: Released: Quick Action Bar
Posted: Sun May 26, 2013 11:35 pm
by Drakkan
wow, impressive work. Hope Log2 will have this implemented
