You are here

Adding new BaseItem / New Weapon Entries

23 posts / 0 new
Last post
Trinital
Adding new BaseItem / New Weapon Entries

Can you create custom new weapons or only override the existing ones?

I tried creating a new entry and updating everything.. No success..

  • up
    50%
  • down
    50%
kevL's

you *can* create new BaseItems ... but there's, issues. Many of the stock scripts won't look for it, when checking for melee_weapon, eg. Have a look at

Picks!

(i haven't looked at it, but having a sense of what goes into custom baseitems if they covered all the bases it deserves double kudos)

  • up
    100%
  • down
    0%
Trinital

Holy Shit.. This is amazing... Exactly what I needed!

(Assuming this works)

 

EDIT:

I don't think ranged weapons can be changed in the same way.. It seems you have to override..

  • up
    50%
  • down
    50%
Vanya Mia
The gun packs used by D20 modern override yes, but I have never been sure why. I have always assumed there was good reason though. It could be because of all the feats and abilities changes needed otherwise, but perhaps because some aspects of the AI are hard coded in to certain lines in the same way that you cannot create new classes that use the spell selection screens.

"I took Skill Focus: Craft Disturbing Mental Image as my feat last level." Belkar, OOTS

  • up
    50%
  • down
    50%
Trinital

What is D20 Modern?

 

I really think Crossbows / Bows / Slings are hardcoded in some manner. If anyone else has any information let me know, but I know if I copy my overriding weapon into a new row it stops showing up in-game.

  • up
    50%
  • down
    50%
kamal

D20 modern is a nwn1 project to implement the d20 modern rules and stuff to allow for present day adventures. It has guns, cars, and tilesets for modern cities for example.

  • up
    50%
  • down
    50%
Trinital

So the way I see.. I have two approaches..

 

1) Approach One - Override Slings

  • A New "Just Works" weapon, You find it, equip it and make sure you have bullets equipped.
  • Easier solution
  • No More Slings - Nobody uses slings anyways
  • Requires a lot of overriding of all the existing sling blueprints and the Dialogue.TLK

 

2) Create a "Dummy" Weapon that can be equipped but only has "OnUse" Ability

  • More variety in Animations you can use, I only wanted to override Slings so that means rifles / arbequis needs to use the same animation as a flintlock pistol - but that can be fixed by firing a script off the OnUse
  • More control over VFX's / Scripting
  • The weapon would be a mellee weapon.. seems kind of stupid..? Maybe just make it a OnUse Item and apply a VFX to the player?
  • Don't need to override the Dialogue.TLK to replace "Sling" with "Firearm" for feats / naming
  • Allows people to keep using Slings

 

Hmm..

 

  • up
    50%
  • down
    50%
Ubai

Hello,

Shortly before the old NWN2 forums shut down I (with a lot of help from the forum regulars) had made some black powder weapons using the melee weapon method. I haven't pursued it due ot a lack of interest but I'd be happy to post what I did on the vault if it will help. The way mine works is it keeps track of ammo and unequips the item when you run out of bullets and won't let you wield it again until you reload.

 

Regards,

Matt

  • up
    50%
  • down
    50%
Trinital

Sure I'd be interested to see how you implemented it!

  • up
    50%
  • down
    50%
kamal
@kevl Was the lack of new ammo types a hardcoded thing or just that the UI only has three spots for ammo? That second thing could theoretically be fixed.
  • up
    50%
  • down
    50%
kevL's

i bet that new ammo types (as baseitems) can be added, with the only hardcoded restriction being that they'd be designed to fit in one of the ammo-slots (bullets, arrows, bolts). You could of course make "ammo" that doesn't go in an ammo slot ... although in the context of BaseItems.2da, "ammo" is by definition what equips into an ammo-slot. (this is done by setting a bitfield in the .2da)

baseitems strike me as fairly liberal -- ie, not hardcoded. My argument, if I have one, is that various scripts (#includes) use constants like

// Is item a shield ....
int GetIsShield(object oItem)
{
    switch (GetBaseItemType(oItem))
    {
        case BASE_ITEM_SMALLSHIELD:
        case BASE_ITEM_LARGESHIELD:
        case BASE_ITEM_TOWERSHIELD:
            return TRUE;
    }
    return FALSE;
}


so if you design and implement a new shield-type ( as a new row in BaseItems.2da ), that function won't consider it a shield .... Compare that to this function:

int isShield(object oItem)
{
    int iType = GetBaseItemType(oItem);
    if (StringToInt(Get2DAString(BASEITEMS, "BaseAC", iType)) != 0)
    {
        string sSlots = Get2DAString(BASEITEMS, "EquipableSlots", iType);
        int iSlots = kL_HexStringToInt(sSlots);
        if (iSlots != -1) return (iSlots & 32); // 0x20 (32) is lefthand-slot.
    }
    return FALSE;
}


This pertains to not only shields; all item-types are scripted similarly, using stock constants instead of peering into what the type actually has for its properties. So with new types a bit of care is required vis-a-vis scripts,

  • up
    100%
  • down
    0%
kamal
The UI certainly recognizes what type of item something is to prevent putting items in the wrong slot. Maybe the xml code for the ui could be checked to see what it's doing to identify the "correct" item for a slot. My guess is that it's looking at the baseitems/ammotypes somehow. Theoretically it might be possible to add a new ammo slot to the UI and have it check for a new ammo type. Lance Botelle could probably help with the ui xml i think he knows more about it than most modders with all the ui stuff he's done. Maybe I'll try poking my head into the inventory slot ui, to see if I can make some dummy "ammo slots" or something.
  • up
    50%
  • down
    50%
kevL's

so you want to make a NEW slot? sure it can be drawn on the UI, but I believe the best you could do is duplicate the behavior of one of these slots:

http://nwn2.wikia.com/wiki/Baseitems.2da#Slot_table

those (unique) bitfields are very likely hardcoded, and i'd say another cannot be added [without Xoreos]



here's some UI functions i see:

OnLeftDoubleClick='UIButton_Input_UnequipSlot("SLOT_HEAD")'
OnMouseDropReceived='UIButton_OnDropReceived_SetEquipmentSlot("SLOT_HEAD")'
update="true" OnUpdate='UIButton_OnUpdate_UpdateEquipmentSlot("SLOT_HEAD")'


"SLOT_HEAD" is likely a hardcoded string for baseitem-types of [EquipableSlots]("0x01") etc.

  • up
    100%
  • down
    0%
Trinital

The other issue - and this could just be me, doing somethin retarded.. is if you override say Slings.. and convert them to Firearms in the baseitems.2da.. then cut that exact row and move it to another row number.

The weapons will not show up in game for that baseitem type.

 

So if I override Slings.. no problem.. but if I try to add a new baseitem entry for a ranged weapon.. doesn't work..?

My assumption is there is something hard coded there.

 

ALSO:

When you go to add a item property.. like "Infinite Ammo" you need to specify a type.. and it looks like there are only 3 types available.. Not sure if that dynamically increases..

 

Maybe we can try to override darts or something?

  • up
    50%
  • down
    50%
kevL's

after some experiments,
there appears to be some sort of hardcoded limitation between launchers and ammo.

I copied #61-Sling to a new #91-'Sling' (gave it a different strref so i could tell it apart in the TS), and IG it said "Out of ammo" when using regular #27-Bullets. So I copied #27 to #92-'Bullets' (ditto..) and changed the 'Sling' to use #92 as its ammo but it still said "Out of ammo". Yet the regular Sling would fire Bullets of either type #27 or #92 ... (although technically its type is defined to use only #27)

Ode to ~XOReos~

xoreos, oh xoreos, where art thou?
I been having trouble wit me sling
and haven't a gall-bladdar to stand on;
when wilt thou come, how glorious
shalt thou be,

with the flick of a key
the code has integrity

Have at ye!!


/but the copied sling itself appeared IG and equipped fine. It just wouldn't fire anything ....

  • up
    100%
  • down
    0%
Trinital

What did I do wrong then..  no

  • up
    50%
  • down
    50%
kevL's

in the item's blueprint properties, did you change the "Base type" (.. or whatever it is exactly) to the new .2da row -- which isn't as easy as it sounds because the row# is not explicit in the dropdown list (they're listed by strref )

  • up
    50%
  • down
    50%
Trinital

Yup, I sure did.. and replaced all the blueprints.. I probably did fuck something up though.

  • up
    50%
  • down
    50%
Ubai
I have uploaded my compromise version as a new project called "Black Powder Musket (Arquebus) for NWN2". As of right now the progress bar for reloading the gun isn't working but I will try to fix it.
 
edit: fixed the progress bar, everything works now, more or less. :)
 
Thanks,
Matt
  • up
    100%
  • down
    0%
RegulusV
RegulusV's picture

If I had money to throw at you I would. I have been wanting to use NVN2 as a jumping off point for a steampunk campaign but the lack of real gun mechanics has been a major roadblock for me. You have my support!

  • up
    100%
  • down
    0%
Trinital

Lets hook up over Skype? Send me a PM.

  • up
    50%
  • down
    50%
Switchu

*Archaeologist mode on*

I managed to take this even further. Gave it item property unlimited ammo (bullets). And it works. It shoots proper bullet. Once. And then whole weapon disappears. Log returns "Lost item: Gun". It still doesn't work with normal, equipped ammo. But hey, at least it's somewhat of a progress.

  • up
    50%
  • down
    50%
Trinital

That's really cool - the problem is the gun disappears.. Lol..

  • up
    50%
  • down
    50%