Jump to content


Photo

New Modders: Best Practices?


  • Please log in to reply
12 replies to this topic

#1 Nifft

Nifft
  • Member
  • 3 posts

Posted 22 March 2013 - 12:24 AM

BGEE has rekindled my desire to mod.

 

Can anyone recommend a good "best practices" reference?

 

The WeiDU docs tell me a lot about what I can do, but not as much about what I should do.

 

Thanks! -- N



#2 Kulyok

Kulyok
  • Modder
  • 2450 posts

Posted 22 March 2013 - 12:48 AM

Depending on what you WANT to do. :) You need to be specific if you want to do items, kits, classes, audiovisual things, NPCs, quests, banters, or areas. Or something else, perhaps.

 

Basically, the bulk of tutorials can be found here:

http://www.shsforums...5-ie-tutorials/

http://forums.gibber...hp?showforum=62

http://forums.pocket...board,16.0.html

 

You also need to register a unique prefix here to make your mods "play nice" with others and use your prefix on EVERY file and EVERY variable you create:

http://forums.blackw...pic=113&st=1180

 

Other than that, you need to ask more specific questions, I think.



#3 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 22 March 2013 - 12:58 AM

Yes, specifics help.

 

The basic ones from the top of my head are:

-Register a prefix as mentioned above for new game files as well as variable names

-When altering existing files, always code the changes and leave the smallest mark possible (e.g. if you want to change one value in an effect, don't scrub the whole effect). Never overwrite.

-Be aware of possible compatibility issues. This one is tricky because it requires some experience and knowledge about existing mods. I wouldn't worry about this too much if you are just starting out.


--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#4 Nifft

Nifft
  • Member
  • 3 posts

Posted 22 March 2013 - 01:27 AM

Thanks for the quick replies!

Here are some specific questions:

 

- I want to add a bunch of kits, and that means re-using "usability flags". If I want a kit to use the same usability flag as the base class, do I just zero-out the usability flag field?

 

- Some new kits (Shadowdancer etc.) seem to all have the same usability flag. What's up with that? Is it some new thing I need to watch out for?

 

- What's the best way to over-write the usability flags on all appropriate items?

 

- Some of my kits are intended to replace existing kits. What's the best way to do this? The old kits will be broken by the usability flag changes, so it doesn't seem useful to keep them around in any form.

 

- It looks like the best practice for a shape-changing class ability is to put the abilities in a custom item (a weapon), which applies the transformation effects when wielded. What's the cleanest way to do that? Should the weapon be "stuck" in the character's inventory? What's the best way to upgrade the weapon when the character levels up?

 

- How do I ensure my new spells are used by monsters?

 

- Is there anything I can do to make my new spells easy for mods like SCS to find and use?

 

- What's the best way to remove a spell from the Cleric or Druid's list? For example, I want to remove Animate Dead from the general Cleric list, then give it as a bonus spell to most neutral or evil Clerics, but never to Priests of Lathander, and never to Paladins.

 

Thanks! -- N



#5 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 22 March 2013 - 04:32 AM

- I want to add a bunch of kits, and that means re-using "usability flags". If I want a kit to use the same usability flag as the base class, do I just zero-out the usability flag field?
- Some new kits (Shadowdancer etc.) seem to all have the same usability flag. What's up with that? Is it some new thing I need to watch out for?
- What's the best way to over-write the usability flags on all appropriate items?

Well, the usability flags are the hex sum of the other usability flags. The base class'es usability flag is determined in the KITLIST.2DA, the first number is the base classes flag, while the later number is the class number:
~0x00004000 2~
This is the base "fighter kit". This all is also pretty well explained in the kit creation tutorial.

Then Shadowdancer can use the normal assassins weapons(~0x00040000 4~)... it has no special restrictions or allowances in that respect to the Assassin kit, but it doesn't have the same as the base "Thief" -kit . The new thing is which you need to watch out is the fact that there are more than a single mod that edits the items which are the base data of the restrictions, as every individual item can be restricted on the base of the others.

Overwriting the usability flags is the very idea of bad practice... unless you make it a tweak component instead of a kit (with the inherited item component).

- It looks like the best practice for a shape-changing class ability is to put the abilities in a custom item (a weapon), which applies the transformation effects when wielded. What's the cleanest way to do that? Should the weapon be "stuck" in the character's inventory? What's the best way to upgrade the weapon when the character levels up?

It depends on the item... and what you are trying to archive with it... but usually you put the item to the magical weapon slot and sign it to have the same effects as the rest of the spell.

- Is there anything I can do to make my new spells easy for mods like SCS to find and use?

Well, other than asking from DavidW... not really.
 

- What's the best way to remove a spell from the Cleric or Druid's list? For example, I want to remove Animate Dead from the general Cleric list, then give it as a bonus spell to most neutral or evil Clerics, but never to Priests of Lathander, and never to Paladins.

Well, you edit the spell ...

 

But really, you should move away from the overwriting aspects and make a kit that is unique in other dimensions, nor restrictions.. well other than say you wish to give the kit a magical armor... which is both a blessing and a curse.


Edited by Jarno Mikkola, 22 March 2013 - 04:58 AM.

Deactivated account. The user today is known as The Imp.


#6 Almateria

Almateria

    most garbage person

  • Modder
  • 969 posts

Posted 22 March 2013 - 06:35 AM

-Register a prefix as mentioned above for new game files as well as variable names

Is it really such a big deal for the variable names? Serious question, I've never used prefixes like that.


Edited by Almateria, 22 March 2013 - 06:36 AM.


#7 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 22 March 2013 - 07:38 AM


-Register a prefix as mentioned above for new game files as well as variable names

Is it really such a big deal for the variable names? Serious question,


Well, if you intent to make a compatible mod ... the answer is kinda yes. Besides it's just a few changes in the .tp2 code that you need to change, nothing major, so why not ?

Deactivated account. The user today is known as The Imp.


#8 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 22 March 2013 - 08:09 AM

Hey, some mods use resources and variable names all over the shop.

Certainly using your prefix will significantly minimise risk of variable overlap.


--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#9 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 22 March 2013 - 10:52 AM

Hey, some mods use resources and variable names all over the shop.
Certainly using your prefix will significantly minimise risk of variable overlap.

Well, in few cases it would hinder to make everything uniform-ally use the makers prefix(see the case of you going off the board and reinvented these... :devil: ), but in most cases it's good practice, especially on the smaller side of mods. Of course there are also the cases off it being undo-able as the engine is what it is... .spl name-ing...


Deactivated account. The user today is known as The Imp.


#10 Eric P.

Eric P.

    Journeyman Modder

  • Member
  • 1178 posts

Donator

Posted 23 March 2013 - 08:19 AM

I begin every variable in my mod with my modder prefix, as I agree that it's good practice, and makes modding life easier, especially when troubleshooting unwanted behavior.


Working and playing on a Mac Pro 6,1 running Mac OS X 10.13.6 High Sierra, and a Mac Pro 3,1 running Mac OS X 10.11.6 El Capitan.

~Buion na 'ell! I serve with joy! Your eyes and ears I shall be. Let us hunt together!~
- Erysseril Gwaethorien: a joinable, romanceable NPC mod for BGII - SoA/ToB, in sporadic development.

A female elf warrior of nature and a Bhaalspawn cross paths during their quests, joining forces to share adventure and companionship. Will they find more?


#11 Nifft

Nifft
  • Member
  • 3 posts

Posted 23 March 2013 - 11:09 PM


Overwriting the usability flags is the very idea of bad practice... unless you make it a tweak component instead of a kit (with the inherited item component).

If there are more kits than usability flags, the only options are:

- share

- overwrite

 

If re-using is a bad idea, please do tell me what a good idea would be.

 

"Make it a tweak component"... I guess you mean that I would have to do the item mods along with the kit mods?

Yes, of course. That's the plan.

 

 

- It looks like the best practice for a shape-changing class ability is to put the abilities in a custom item (a weapon), which applies the transformation effects when wielded. What's the cleanest way to do that? Should the weapon be "stuck" in the character's inventory? What's the best way to upgrade the weapon when the character levels up?

It depends on the item... and what you are trying to archive with it... but usually you put the item to the magical weapon slot and sign it to have the same effects as the rest of the spell.

Using the magical weapon slot (like the existing shape-change effects do) is not at all what I'm talking about. That's not something which can be wielded or unwielded, it's just stuck as wielded until the duration expires.

 

I mean a special item which takes up a regular weapon slot.

 

I've seen mods which do things like this, and I'm curious what the current state of the art is.



#12 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 24 March 2013 - 07:13 AM

If re-using is a bad idea, please do tell me what a good idea would be.
It's unequivocally: don't use item restrictions for you new kit. At least not unless Beamhaul come up with something better than the ITM flags (and you make your mod EE-only).
 I've seen mods which do things like this, and I'm curious what the current state of the art is.

Depending on whether Beamhaul has implemented the undispellable-magical-weapon flag, the best thing to do is either an undispellable magical weapon (with or without duration) and a revert-to-normal spell, or a spell that creates a real weapon (the "equippable paw") in the caster's inventory, which has the shapeshift effects as on-equip effects. The first way is generally superior, since you can shift back and forth as many times as you have spells (and you can have an unlimited number if you are so inclined) and is generally robust, were it not for the dispel thing.The second way requires the player to re-cast the item-creating spell each time they are eligible for a better item. You can make the spell destroy one or more copies of the old item(s) before creating a new one, to help with inventory management by not leaving stuff behind, basically. There is no way of making it "stuck" in the caster's inventory, perhaps short of creating an undroppable item in the players weapon slot and nuking whatever else is there.

#13 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 26 March 2013 - 05:40 AM

Can anyone recommend a good "best practices" reference?

The WeiDU docs tell me a lot about what I can do, but not as much about what I should do.
You can do whatever mod you want to. However, there is no guarantee that many (or any) players will use it. Therefore, it depends heavily on what you wish to achieve with that. If you want to make several mods for your own play, then by all means, go ahead and do anything.

If you want to establish yourself firmly on the modding scene, then your mods are better be real good to attract any attention among hundreds of non-outstanding works. This is especially true if you intend to overwrite existing content (kits or item usabilities), not in the least because you'll have to either compete or be compatible with other top-rated mods.

Consider not tossing different content categories (quests, NPCs, kits, spells, items etc.) into one heap, but keep them modular and as much independent of each other as possible. Trying the "10 new cool Xs, 20 new cool Ys, 30 new cool Zs" approach is just a recipe for disaster, unless you're developing a new game. You probably do not want to become an Improved Anvil-like mod, which is good in what it does, but is incompatible with just about everything and has the player base of 3.5 people.

- I want to add a bunch of kits, and that means re-using "usability flags". If I want a kit to use the same usability flag as the base class, do I just zero-out the usability flag field?

- Some new kits (Shadowdancer etc.) seem to all have the same usability flag. What's up with that? Is it some new thing I need to watch out for?

- What's the best way to over-write the usability flags on all appropriate items?

- Some of my kits are intended to replace existing kits. What's the best way to do this? The old kits will be broken by the usability flag changes, so it doesn't seem useful to keep them around in any form.
I would stay away from tinkering with usability flags for now. If your need is dire, use 180 and 181 opcodes instead to prohibit specific items.

- How do I ensure my new spells are used by monsters?

- Is there anything I can do to make my new spells easy for mods like SCS to find and use?
Integration with SCS has been made fairly simple, so you only need to provide a list of spells and their descriptions. See below, though.

- What's the best way to remove a spell from the Cleric or Druid's list? For example, I want to remove Animate Dead from the general Cleric list, then give it as a bonus spell to most neutral or evil Clerics, but never to Priests of Lathander, and never to Paladins.
Spell's restriction flags allow to prohibit it from specific alignments.

You may want to post your spell-related suggestions to Spell Revisions' forum on G3, instead of starting a new spell mod. In particular, we will do exactly that with Animate Dead for v4.

Retired from modding.