Jump to content

Scripting melee combat with guns


TrooperScooperMKII

Recommended Posts

OK, so this has been floating around in my head for a while now, but:

there's a grenade hotkey, weapon wheels, and all sorts of other FPS-style mods, but what about melee?

The Geck wiki lists AnimGroups which can be played via script, so getting a player (or character) to swing a rifle etc. like a club seems rather simple; I assume that you'd experiment with the various animations (e.g. different swing styles, up, left, etc.) to aesthetically match a given weapon. I'm completely clueless, though.

 

There are other functions that could check for the target's armor, damage the weapon and hurt the target... but I'm not clear on how to do this.

First, I assume that you'd use the ref-id (?) of the equipped player weapon, I assume the object has a collision mesh/boundary box thing to tell whether or not it hit something? How would I check, via script, if the weapon hit the target? There is a get-distance function which would probably work, but is that the best solution?

 

I'm utterly lost with the "game effect" function types, I assume that these would be akin to weapon enchantments, which I suspect would be somewhat useful, in that it would presumably let me apply damage/knockback etc. to a weapon directly upon hitting something...

 

In general, is there a good place to "start" with scripts? I have loaded up the GECK and copy-pasted into Notepad ++ but it's really hit and miss, as I can't easily find a working example of the animation function types etc...

Link to comment
Share on other sites

The easiest way would be to just use a script to change the skill/type of the weapon. Make it a melee weapon, change the attack animation, etc. The Range value in the weapon form controls what the hit distance of a weapon is, not the weapon havok data. (You can have fun with that, make a police baton with a range of 20).

 

NVSE has a bunch of functions specifically for altering weapon values. You can change most of the important ones, but not the attack sounds, so you'd be beating someone with your rifle and it would still sound like a gunshot when swung. No way around that short of making all new weapon forms (see HH and Joshua Graham's Pistol Whipin' gun).

 

Go check out the NVSE Get/SetWeaponXXX functions. They might give you some ideas. I had actually used them to make a 9mm pistol that could be swapped at will between semi-and full automatic mode. Not overly useful, I was just playing around with things. It requires changing the animation type (the GECK wiki has them wrong, btw. You'll have to play with the numbers), the fire rate, etc. But it was neat.

 

NVSE Docs

Link to comment
Share on other sites

Hey TrooperScooperMKII, I think the direction your going with this one is just gonna be a major headache. Gribbleshnibit8 had mentioned Joshua Graham and his pistol melee weapon, and I honestly think that's the way to go. It's relatively painless, just work toward a hotkey to swap out the two weapons. As far as teh actual mesh you can put almost anything in there. You can replace a lead pipe mesh with a teddy bear if you wanted, doesn't matter.....you just need to find a weapon with a animation that would be similar to how your new weapon would be swung. Just like the bottles as weapons thread in this forum.

 

I wanted to do a rifle butt smash, but didn't run across a good animation, before I got distracted on other projects. So my suggestion is let the game engine handle the melee weapon damage, reach, weapon health etc, just like normal, instead of trying to recreate it via script. Just work on swapping the two weapons (firearm vs melee) out seamlessly.

 

I can put up a few examples for you if you'd like

Edited by devinpatterson
Link to comment
Share on other sites

yeah, that sounds like a simpler way of doing things, (you could prevent the melee versions from appearing in-game except via script, right?) then a "cowboy" type perk to up melee damage would be trivial...

there's a "set weapon health percent" command (presumably would carry health back & forth between the melee and gun versions) but swapping the weapons seamlessly is the big question mark...

Link to comment
Share on other sites

yeah, that sounds like a simpler way of doing things, (you could prevent the melee versions from appearing in-game except via script, right?)

 

You want to think of them as being two separate weapons, so you wouldn't need/want a script to prevent them from appearing in game. For example lets use a Ranger Sequoia, it's a 4lb chunk of iron. Great for shutting up little buttmonkeys that aren't worth wasting ammo on.

 

So you have a 2nd version of the Sequoia, completely separate weapon, a melee weapon. It's hidden from inventory (if possible), just like I did with the brushgun (don't know if it will work the same with a weapon as it does with an armor). Then use NVSE to have a hotkey. The hotkey switches out the Sequoia for the melee Sequoia and initiates an attack, then switches the normal Sequoia back (the equipitem and unequipitem commands will use the hide message flag).

 

If it's done instantly it's bang, bang, smack, bang bang. You could also use NVSE's weapon health (or might even be in vanilla geck) to sink the weapon healths between teh two weapons.

 

Now that's the way I was going about it, but other people may have better ideas. I havn't gotten a chance to finish it yet, but it's an advanced cowboy perk for the sunset mod. In addition I want to add firing two revolvers simultaneously and a

(but a hell of a lot faster than the guy in the vid), that doubles your fire rate but increases spread. I figure those are worthy gunslinger perks.

 

then a "cowboy" type perk to up melee damage would be trivial...

 

Actually be careful on that. You want to use an addtoformlist. Just dropping it in the cowboy perk will overwrite every change to the cowboy perk from every mod that loads before it. Modders are always doing this and it's a clusterf*ck.

 

there's a "set weapon health percent" command (presumably would carry health back & forth between the melee and gun versions) but swapping the weapons seamlessly is the big question mark...

 

Yep, but I think it'd do-able. I have some requests to finish up and I want to continue work on my power armor trauma suits (they'r really turning out well, perfect timing for Halloween), but I'll try to make a sample melee mod this weekend with a Sequoia or my new Peacemaker (which I'm really, really liking) and we'll how workable my method is......

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...