Jump to content

Overriding a single property


nDervish

Recommended Posts

Does the modular mods system allow for overriding only a single property of a complex entity?

From reading the description of MODMERGEATTRIBUTE in the modular mods thread, I presumed that this was the purpose of the "update" setting, but, alas, it was not so (or at least, if it is so, I wasn't able to divine the correct incantation). As a simple change, I tried making frag grenades explode immediately by setting up my own custom mod with a weapons_gc.xml containing:

<Weapon MODMERGEATTRIBUTE="update" name="weapon.grenade.frag"> <props explodeAtTurnEnd="0" /></Weapon>

However, rather than updating explodeAtTurnEnd and leaving everything else about the grenade untouched, this completely broke frag grenades, presumably by clearing all settings and leaving explodeAtTurnEnd=0 as its only attribute. In order to get a working frag grenade which explodes immediately on impact, I had to copy the complete definition from assets/weapons_gc.xml, which doesn't seem right.

Link to comment
Share on other sites

Heyho!

I rather (because i know that just works) would use 'replace' (or 'update') instead of MODMERGEATTRIBUTE. Just make the 'explodeAtTurnEnd="0" and use this:

<Weapon MODMERGE="replace" name="weapon.grenade.frag">

And take the complete Grenade-Section. But iam not a big or great modder, i just use the simplest of simplest things. Dont want to make it more complex as it is. Think that replacing a whole section is just better, but thats my opinion.

Maybe someone here knows there trick

Stay crunchy.

Link to comment
Share on other sites

Don't know if this is the only problem, but what you've done there won't work. The MODMERGE commands in the first line should be:

MODMERGEATTRIBUTE="name" MODMERGE="update"

I.e. it should be:

<Weapon MODMERGEATTRIBUTE="name" MODMERGE="update" name="weapon.grenade.frag"> <props explodeAtTurnEnd="0" /></Weapon>

Try with that correction and see if it works.

Link to comment
Share on other sites

And take the complete Grenade-Section. But iam not a big or great modder, i just use the simplest of simplest things. Dont want to make it more complex as it is. Think that replacing a whole section is just better, but thats my opinion.

There are, IMO, two problems with replacing the whole section:

1) If you only specify the things which are changed, it's clear to see at a glance what you've customized. If you copy the entire section, there's no way to tell what's changed and what isn't. (Unless you add comments saying what changes you made.)

2) If you later install a weapons pack mod which adjusts grenade settings, copying the whole section would mean that you'll still be using the original game's grenades instead of the weapons pack's grenades, unless you remember to copy the new version and reapply your local changes. If you specify only the changed parts, then you'll transparently get the weapons pack's grenades with your customized impact fuses.

The down side is that you don't have the full definition in one place, but I consider that a small enough price to pay for the above advantages.

Don't know if this is the only problem, but what you've done there won't work. The MODMERGE commands in the first line should be:

MODMERGEATTRIBUTE="name" MODMERGE="update"

That's odd, given that copying the whole block and using MODMERGEATTRIBUTE="update" worked fine and generated no warnings/errors in the log.

I.e. it should be:
<Weapon MODMERGEATTRIBUTE="name" MODMERGE="update" name="weapon.grenade.frag"> <props explodeAtTurnEnd="0" /></Weapon>

Try with that correction and see if it works.

Yep, that works just the way I wanted. Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...