Two Handed Weapons and Dual Wielding

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: Two Handed Weapons?

Post by bongobeat »

wow :shock:
another incredible things! This is amazing!

if you already script this, this interest me! ;)
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
Gradunk
Posts: 54
Joined: Tue Oct 22, 2013 2:26 am
Location: Calgary, Canada

Re: Two Handed Weapons and Dual Wielding

Post by Gradunk »

I haven't yet. When i do figure it out i will post the code :)
Im working on it now and i realized i don't know how to check if an inventory slot is empty. i have

Code: Select all

onEquipItem = function(champion, slot)
   if champion:getItem(7) = ? and champion:getItem(8) = ? then
      -- making sure it's in both hands regardless of which hand you put it in
      champion:insertItem(7, BOOGLY)
      champion:insertItem(8, BOOGLY)
   else
      champion:removeItem(slot)
      setMouseItem(BOOGLY)
   end
end,
onUnequipItem = function(champion, slot)
   -- making sure both hands are empty regardless of which hand you take it from
   champion:removeItem(7)
   champion:removeItem(8)
end,
hows that?
I smell you, i do! You GRADUNK! No be hiding on TORGAL!
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: Two Handed Weapons and Dual Wielding

Post by Isaac »

I have a working two handed sword script. Later tonight, I will polish it up and upload it as a mod/resource on the Nexus.

[Rough proof of concept]
https://www.dropbox.com/s/5hn8nbcudc4gd ... hander.avi
Gradunk
Posts: 54
Joined: Tue Oct 22, 2013 2:26 am
Location: Calgary, Canada

Re: Two Handed Weapons and Dual Wielding

Post by Gradunk »

NNGGAAAAAH!! so jelly. lol. is my code alright though?

and on the nexus?!? laaame
I smell you, i do! You GRADUNK! No be hiding on TORGAL!
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: Two Handed Weapons and Dual Wielding

Post by Grimfan »

I just have to commend you on your work Isaac. I've been a little bit enamoured of your abilities since your one-room dungeon entry and I steal from your scripts and resources liberally, which as you know in the modding world speaks volumes. :)

And this should definitely go on the Nexus. ;)
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: Two Handed Weapons and Dual Wielding

Post by Isaac »

Gradunk wrote:NNGGAAAAAH!! so jelly. lol. is my code alright though?

and on the nexus?!? laaame
I suppose I could put it on Steam. (I use the GoG version, which does not come with the Steam Workshop... but I happen to have gotten a Steam key from AH for the beta map editor, so I should be able to add it there as well. ~afaik)
*But... it's not a game level, it's a resource. Any developer [modder] could get it from Nexus to add to their maps whether using Steam or not. The mod would be a simple room with the weapons in it ~not really worth subscribing to on Steam I'd think.

**Code-wise: I found it very problematic to try deleting an item from its own unEquipItem hook. AFAIK both items would both run the code in the hooks. You would probably need some sort of conditional IF to bypass the removal statements that would likely crash the game if executed.
In the end, I resorted to a 'two_handed_weapon' script object called from a self-killing timer spawned in the weapon hooks to manage their removal.

@Grimfan: Image
*Not all of the scripts in anyone's ORRR2 room are necessarily all their own; Diarmuid was project lead and had a hand in ~at least something~ in almost all of the rooms. A few of my own scripts I'd not recognize, because while I was working on assets, he often went over them to make some save-game-safe, or make better use of the ORRR2 framework.
(Or in some cases... figured out how to get them to work at all.)

If you look closely at the code and formatting (at least in my room), you can indeed see the styles and coding approach flip-flop between its two authors.
User avatar
Allanius2
Posts: 124
Joined: Mon Apr 14, 2014 10:12 pm

Re: Two Handed Weapons?

Post by Allanius2 »

Isaac wrote:
Allanius2 wrote:
Isaac wrote:SetMouseItem(item)
One snag with this idea is that the icon may look great in the hands, but will look odd split apart in the character sheet. Odd looking, but you'd have two handed weapons. 8-)
I believe I've seen this done in another game where the hand the 2H weapon was placed in had the full icon and the other hand was either greyed out or had a semi transparent copy of the icon. This would eliminate the problem of the inventory half icons.
Not really ~unless I'm missing something. The character sheet duplicates the item icon on the paper-doll. So where the two icons would meet on the portrait GUI (in the lower right); those duplicated icons would not meet up in the character sheet/ paper-doll.

The greyed out icon is easy to do as the [off-hand] weapon's icon, but not if it was to be ½ of the weapon image across both hands; it would have to be two swords, one grey-transparent, the other solid (as usual).

**Aside: It seems rather complicated to delete an item in a champion slot from within an onUnEquipItem hook. The item's onUnEquipItem hook is run when you call removeItem(). :shock:
It might have to require a script object on the map for a timer to call to delete both halves of the weapon. :(

I have a script that handles the double item two handed weapon... but deleting both items when the player can arbitrarily pick up either one of them first has been challenging to attempt ~without a spawned timer and separate script object.
Perhaps I was missing something. Does each item have different icons used depending on if it is in hand or in inventory? If so, then your way will work, but if it uses the same icon in all places, the icon you drew would look in inventory like it does in my image's inventory.
Image

But, as I was trying to explain, if you have a single slot image and a greyed out image, it would appear as in my image's hands. Also with the joined icons on the paper doll it will not show correctly.
Image
Gradunk
Posts: 54
Joined: Tue Oct 22, 2013 2:26 am
Location: Calgary, Canada

Re: Two Handed Weapons and Dual Wielding

Post by Gradunk »

ooh. yea i have noticed the onUnequipItem hooks aren't as reliable.
whenever you upload it to the nexus can you put a link up? i just checked lol

he did mention that problem. that's why i mentioned creating a second one of the same item to avoid it.
I smell you, i do! You GRADUNK! No be hiding on TORGAL!
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: Two Handed Weapons?

Post by Isaac »

Allanius2 wrote:...
You can get around the split icons in inventory, but you cannot have differing icons equipped in the hands...(as they are seen in both locations at the same time, and changing one changes the other). So while it can be made to work in the small portraits, it would show up as hilt & point in the weapon slots of the paper-doll menu.

*I might try that anyway though; just to see how it plays normally.

**Edit:
The mod won't be uploaded tonight, I have it running, but there is a bug in it when the player tries to swap the sword for another item ~like a clicking on it with a torch for instance. Whatever that item is, it disappears. I know why it disappears, but the fix is not immediately obvious to me just yet; and I'm out of time for tonight.
Gradunk
Posts: 54
Joined: Tue Oct 22, 2013 2:26 am
Location: Calgary, Canada

Re: Two Handed Weapons and Dual Wielding

Post by Gradunk »

Well that covers two handed weapons. how about the dual wielding part?
Is it possible to give each hand its own cooldown?
I smell you, i do! You GRADUNK! No be hiding on TORGAL!
Post Reply