Author Topic: Hank's Bow  (Read 546 times)

Legacy_Malagant

  • Sr. Member
  • ****
  • Posts: 391
  • Karma: +0/-0
Hank's Bow
« on: February 23, 2014, 11:38:08 pm »


               While I know that dealing with ranged weapons can be finicky, and having never dealt with amunition within CC, I do know it is possible to create different ammo types per Ben Harrison's item property expansion. What I do not know is if it is possible to do so with a unique visual.

The idea (as I had it) was to surprise my son (who has recently discovered the old D&D cartoon), with a quest reward that is a close apporximation of Hank's energy bow. Since I assume "force" likely can't be added as a damage type, my line of thinking was to create an unlimited 2d6 positive energy ammo type / property and set the bow's physical damage to zero per the available option already available in item properties.

The other half of the equation was to perhaps take the projectile visual from Light Weapons & Projectile Rifles1.2 (the crossboy energy rifle) and give the new ammo type that particular visual / audio combination (as seen in their example mod and the top left caption on the LW hak's page) while avoiding creating a new Base Item so that one can maintain the ability to apply relevant feats to the bow.

I had played around with 2das and the existing LW projectile within a test hak but could not get
anything to show up. I tried analyzing both the BH and LW haks to try
and reverse engineer to no avail so my first order of business is to ask if this is even possible as a whole and if it would require tlk modification, then seek suggestions on how I could possibly go about it.

Thanks to anyone who can provide guidance and, if none can be given, thank you for any consideration or clarification.
               
               

               


                     Modifié par Malagant, 23 février 2014 - 11:52 .
                     
                  


            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Hank's Bow
« Reply #1 on: February 25, 2014, 06:57:26 am »


               

Interesting idea.  My older kids just got the D&D cartoon for xmas. '<img'>


 


For the arrow itself, you could replace one of the existing arrow projectile models (perhaps sonic if you don't use it much) with an all-yellow model that is fully self-illuminated.  This would give you the glowing yellow arrow appearance without the visual lag of an emitter-only glow.  You could then add something like the "holy" VFX along the length of the arrow to make it more visible (especially after it hits)...perhaps scrounge it from the longsword VFX model.


 


I've no idea about the arrow sound, but if you go the "replace the sonic arrow" route, the sound file is designated in the ammunitiontype.2da file (line 30).  For custom unlimited ammo, you'll need to make your ammo, then put the blueprint resref (and a .tlk file line for the game to reference) in the iprp_ammocost.2da file.


 


You could even go so far as to add a new bow middle part model (that the one with the animations and bowstring). Duplicate the bowstring.  Either expand the original one slightly or reduce the new one slightly, so that the new one hides inside the old one. Remove the central animation dummy as a bone for the old string (so it's not drawn back during firing).  Replace the texture of the new bowstring with a full yellow one and set it as fully self-illuminated.  In-game, this should cause the glowing bowstring to suddenly become visible when drawn back for firing, but seem to vanish at rest.  The regular dark string would still be visible, but it would likely get the effect desired for your kid.



               
               

               
            

Legacy_Malagant

  • Sr. Member
  • ****
  • Posts: 391
  • Karma: +0/-0
Hank's Bow
« Reply #2 on: February 25, 2014, 07:30:58 pm »


               

Thank you, Amethyst. I didn't even think to look at iprp_ammocost. I'll start looking into your suggestions later in the week when some time frees up and try and figure the best route to go.



               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
Hank's Bow
« Reply #3 on: February 25, 2014, 11:10:25 pm »


               

A quick and dirty alternative would be to use one of the Energy Bows (by dusty.lane) from the new vault.


 


TR



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Hank's Bow
« Reply #4 on: February 26, 2014, 01:11:47 am »


               

yes, dusty's bows are awesome.



               
               

               
            

Legacy_Malagant

  • Sr. Member
  • ****
  • Posts: 391
  • Karma: +0/-0
Hank's Bow
« Reply #5 on: February 26, 2014, 09:11:48 am »


               

While Dusty's bows are nice, they are an entirely different animal from Hank's Energy Bow. Hank's Bow amounts to a composite longbow that fires force missiles; it's the projectile that is energy and not the bow itself. That really isn't a viable alternative for what I was looking to do, which would be along the lines of the aforementioned projectile weapons hak. I do appreciate the suggestion, though; it's just not what I hoped to accomplish.


 


The projectile weapons hak replaced the heavy crossbow, however, and I was looking for a way to avoid going that route while emulating the visual in the top left (with some slight alterations to color) as an unlimited ammo type. I'll be tinkering around with these later in the week.



               
               

               
            

Legacy_Invisig0th

  • Sr. Member
  • ****
  • Posts: 279
  • Karma: +0/-0
Hank's Bow
« Reply #6 on: February 27, 2014, 10:16:12 pm »


               

The feasibility of what you're doing here will depend on exactly what your requirements are.


 


I posted thread on the old Bioware forums documenting in detail my attempt to make some non-replacing laser guns with custom ammo. Some of what I discussed there may be relevant. It's available in the NWN Omnibus (Thread 01323 "Laser guns - notes from trying a new ranged weapon") if you want to download that, but I'll post a few highlights here that may be related to what you're doing. I do realize you're mostly looking at making some custom ammo, but knowing what is and is not possible might allow you to narrow down your options here.


 


You cannot add a fully funtional new ranged weapon. The engine cannot properly manage the relationship between that weapon and its ammo (even if you have configured it exactly as Bioware did in the 2das). When you try to attack (left click) an opponent with such a weapon, you just get a message saying "out of ammo" and nothing more. Whether or not you have the appropriate ammo in your ammo slot is irrelevant -- you still are always told you are "out of ammo" no matter what you do.

Almost all of the various new ranged weapons posted to NWVault, as well as the ones used by d20MM, are fully replacing. That is to say, they replace the models and sounds for one or more of the five existing ranged ammo-based weapons and three types of related ammunition. Other than model changes/additions for weapons, this change is global. So if you change the model for a bolt flying through the air, you have changed the bolt appearance for ALL heavy and light crossbows.

As far as I know, the only non-replacing solution so far posted to NWVault is "Issig Flintlocks" by Daemon Blackrazor. He actually created a new ranged weapon here. With this approach, one must ignore the "out of ammo" errors -- instead of left-clicking on an opponent, one must right-click the item (or use a quickslot) and then "shoot" the target with the scripted ranged spell-like effect. When that fires, all the damage, VFX and sounds are played via scripting. This is a fine attempt at a solution, and probably suitable for many builders. But while it has some advantages (the animations for the PC are correct, shows the weapon properly), I personally find the inability to use the intuitive left-click to attack an opponent to be a huge problem, particulary since it causes the "out of ammo" message every time.

Trying to get these to work by trying to extend the existing ranged weapons was not possible. Although you can easily remove sounds and ammo animations when a ranged weapon is fired, you cannot put those things back in using scripting. This is because there is no scriptabled event triggered when a ranged weapon is fired. You wouldn't be able to do exactly that with an NPC, and with a PC it would be even less of a possibility. That all happens inside the engine, and it's just not accessible to scripting.

The closest option which uses the majority of existing weapons features (left click to attack, uses up existing ammo, correct animations for attacker) would be to give the ammo (not the weapon) an OnHit -> Cast Spell property. However, absolutely nothing would happen on a miss, so that is not a viable solution. If you miss with a laser weapon, one should expect to see the laser beam anyway, just like with arrows and bolts. Again, this is simply inaccessible.

My second attempt was to try to use different ammo with different light crossbow models. Also not possible. There can be one and only one ammo assigned to a given weapon under the RangedWeapon column in baseitems.2da, pointing to another entry for the ammo in that file. So ALL light and heavy crossbows, for example, map to one type of ammo, and that single ammo has a specified model/animation used to show it flying from attacker to target. You can do all sorts of things to change the kind of damage that the bolt does or what the bolts look like in inventory, but that one single model will always be used to show the bolt flying through the air. I suspect you might be able to have light crossbows use one kind of bolt and heavy crossbows use another (although I wouldn't be surprised if you can't), but that doesn't gain me anything here.

The reason I naively thought this was possible is that there are an additional 30 or so types of ammunition listed after the 6 basic types in ammunitiontypes.2da. I presumed these extra types are used somewhere, but I don't see where. However, the one labeled "acidbolt", for instance, does not appear to be used if you have a bolt that has Damage Bonus >> Acid.

My third attempt was almost successful. The options for ammo used for the "Unlimited ammo" weapon property are gathered from the iprp_ammocost.2da file. In that file, ammo is listed by type of damage, and then there are columns for "Arrow", "Bolt" and "Bullet". Those columns do not map to lines in the ammunitiontypes.2da. They are, surprisingly, resrefs for BLUEPRINTS in the module. So I actually created a second "bolt" in baseitems.2da using my new model, and then created a blueprint of that custom type in my module for that ammo, with custom damage (iprp_damagetype.2da). Had this worked, I could have easily scripted "charges" for the special crossbows and destroyed the weapons once they ran out -- and meanwhile, retaining all the built-in benefits of using standard weapons (left click to attack, proper misses, uses ammo, etc.) Using this, I was amazed to find that the custom ammo and custom damage were recognized. However, the model displayed for the ammo flying through the air was the original bolt, as referenced in the line for the crossbows in baseitems.2da. So the engine showed the default bolt model, while using everything else from my custom ammo and damage type correctly. Needless to say, having a wooden stick fly out of a laser weapon is simply not acceptable. But this was much more close to being successful that I had hoped.


So my current plan is to create a custom non-ranged-weapon item type with Cast Spell >> Unique Power and script everything else. which may be harder than it sounds to be convincing. The difficulty is in first displaying the weapon in hand (as a torch or other handheld item, I suspect). There is simply no getting around that these models look cool in the player's hand. See the screenshot for those Issig Flintlocks for an example. Then I have to have a proper animation for the firing. I might not be able to get a pose like when a player fires a crossbow (which is actually almost exactly what I need). However, there is some murmurings of some custom animations in d20MM for NWN. Custom animations, I suspect, may be a lot more accessible (and scriptable) than the built-in NWN animations. There is, for example, a "xbowshot" (crossbow shoot) animation built into the PC models, but the engine handles when to use it based on knowing that a weapon of type crossbow is currently equipped and in use in combat. AFAIK, you cannot do anything with it using scripting. If I could somehow fake the engine into using the proper animations with another item, that would be sweet. If not, perhaps I could duplicate the necessary animations either as replacements for little-used, scriptable existing PC animations or as part of a new phenotype.


 



I will also try to see what I can do about creating crossbow-like non-standard items in baseitems.2da. There are apparently several columns (3+) which, when combined, define whether or not an item is treated as a missle weapon. If I'm very lucky, the functions of these columns may be distinct enough to allow for hybrids. If I could, for example, create a custom base item which uses no ammo, but which DOES register as a crossbow, that might be enough to get some of the PC animations I need without getting a sword-icon when hovering over an enemy. Highly unlikely, but worth looking into, just in case.

 


Hope this helps in some way. Good luck!

 



               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Hank's Bow
« Reply #7 on: February 28, 2014, 12:14:25 am »


               

We actually added force damage, though it required some sneakiness to do it. I'll post code when I get home, if I can remember to. Are you using NWNX?


 


Funky



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Hank's Bow
« Reply #8 on: February 28, 2014, 01:13:59 am »


               

That sounds interesting, Funky. I'd like to see that bit of trickery.



               
               

               
            

Legacy_Malagant

  • Sr. Member
  • ****
  • Posts: 391
  • Karma: +0/-0
Hank's Bow
« Reply #9 on: February 28, 2014, 09:03:37 pm »


               

Invisig0th: Thank you for that. I havent had the time to get to this yet. From what I can gleen from your excerpts, the issue I would run into would be the third attempt where one can get the game to recognize the property and damage but the game will still pull the visual accompaniment from the baseitems.2da which is the standard arrow visual (unless one changes that particular model/reference, in which case it becomes a global change for all weapons pertaining to that baseitem).


 


I was looking at Rubies' arrows from the May 2012 CCC, but I assume there were direct replacements for already existing models and that no new ones can be created and referenced.


 


Funky: That would be amazing and, if all else fails, we could at least use your NWNX method for something.



               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Hank's Bow
« Reply #10 on: March 01, 2014, 09:28:15 am »


               

Here's our general orb script, written by acaos. In it, you can see how we apply special damage types, like force (orb of force), as compared to normal types:


 


orb script


 


It relies mainly on ApplyDirectDamage, the functino for which is here:


 


ApplyDirectDamage


 


It bases immunity and resistance to the damage types on other damage types. You could basically fudge the GetTrueDamageImmunity check


 


The SetEffectInteger used to alter temp hit point counts requires nwnx_structs, but may be fungible depending on your circumstances. The only one you can't really do without is the ModifyCurrentHitpoints, or an analogue like SetCurrentHitPoints (nwnx_funcs).


 


The last bit, where it Executes fky_ai_6ondamage, just ensures that our ondamaged code fires, since we're not technically applying any damage.


 


Funky



               
               

               
            

Legacy_Invisig0th

  • Sr. Member
  • ****
  • Posts: 279
  • Karma: +0/-0
Hank's Bow
« Reply #11 on: March 04, 2014, 06:03:54 am »


               

Yep, any change like that would apply to ALL weapons of that type globally. Sorry. Honestly, your best bet is probably a fairly standard VFX on a standard arrow, like AD mentioned at the start of the thread. That would probably be close enough and shouldn't break anything.


 


Personally, I would never install and run NWNX just to get one custom bow working. Talk about overkill. But YMMV.