Skip to content

Help for a novice modder

SirK8SirK8 Member Posts: 527
edited April 2014 in General Modding
Hail and well met. I'm looking for a bit of help on some customization I'm doing to the game for a friend of mine. Basically I've created an innate shapeshifting ability for him so his barbarian can turn into a bear. I've figured out how to grant an innate ability on shift and how to remove it (so that shifting back and forth works properly).

What I can't figure out though is how to clear a memorized instance of an innate ability. What I want to do is give an ability only usable while he is in bear form. I can grant it as an innate ability when he shifts into a bear, but the problem is, even if I set it to be removed when he shifts back into natural form, the memorization is not removed. Meaning he can then use it in human form, and just as bad if he keeps shifting back and forth w/out using it up it stacks memorizations.

Does anyone know how I can force the memorization to be cleared on the shift back to natural form, or an alternative approach to granting the ability only while in bear form. I can post my files if anyone is interested. Thanks.
Post edited by SirK8 on

Comments

  • CrevsDaakCrevsDaak Member Posts: 7,155
    If you are using paws as items to shapeshift, put over them the give innate ability effect opcode, if you are using something different you could also add a remove innate ability opcode to the Shape-shift to Natural Form spell.
    If you upload the files it would help a lot since right now I am only guessing.
  • SirK8SirK8 Member Posts: 527
    edited April 2014
    @CrevsDaak‌ - Yeah, I guess I should have just uploaded in the first place :)

    I couldn't find the opcode for remove innate ability, just remove spell, which I have added to the shapeshift to natural spell. It seems to work, it does remove the innate ability (meaning if I expend it in bear form, shift back and rest, I don't get it refreshed). However, it does not remove the memorization of the ability. So what happens is if the "roar" isn't used in bear form, then it remains usable in human form. Even though technically the innate ability was removed, the memorization of that ability is still available (checking in EEKeeper also confirms that the innate ability is removed, even if it is still "memorized" and available to cast). If you shift back into bear, it gives the ability back and stacks another memorization.

    Edit: I'm using DLTCEP to do the edits btw.
  • SirK8SirK8 Member Posts: 527
    *Bump* - I'd really like to get some help on this if anyone is willing. I've figured out how to make this into a fighter kit so I don't have to mess up the barbarian class. However I can't figure out how to solve the problem with that innate ability. I'm sure I'm missing something simple, or maybe there's just a plain better way to tackle it.
  • ErgErg Member Posts: 1,756
    @SirK8 I don't know if it will work, as I didn't test it, but maybe you can do something like:

    1) add your custom innate spell to SPELL.IDS
    2) use opcode 265 or opcode 309 to modify a global or local variable based on whether the innate ability should be available or not
    3) check the variable from (2) in a script and eventually use RemoveSpell().

    From IESDP (slightly edited by me for clarity):
    147 RemoveSpell(I:Spell*Spell)
    147 RemoveSpellRES(S:RES*)
    This action removes one memorised instance of the specified spell from
    the spellbook of the active creature. The spell can be an innate ability,
    a priest spell or a wizard spell, but must be listed in spell.ids.

    Example:

    IF
    Global("KR_ANTI_PALADIN_CHANGE","LOCALS",1)
    THEN
    RESPONSE #100
    RemoveSpell(PALADIN_LAY_ON_HANDS)
    RemoveSpell(PALADIN_DETECT_EVIL)
    RemoveSpell(PALADIN_PROTECTION_FROM_EVIL)
    SetGlobal("KR_ANTI_PALADIN_CHANGE","LOCALS",2)
    END
  • SirK8SirK8 Member Posts: 527
    @Erg - Thank you so much for your reply. This is beyond my current understanding but has given me exactly the direction I need. I'll try this out later. Thank you again!
  • kjeronkjeron Member Posts: 2,368
    Opcode(172) is a very confusing one to work with for Innate Abilities. From my experience its actual effect depends on which program you use to create the file.

    Created with Weidu, it will remove 1 used-up instance of the given ability per use. This is fine if it needs to remove just 1 instance of itself, since it will remove the instance that was just used, without affecting any remaining uses of it. However, it doesn't work when removing other abilities, or when you need to remove all instances of the ability from someone.
    This is what your's is doing, it will remove the Natural Form just fine, as long as you only have 1 instance of it, but it will remove 1 instance of the Roar ability only if you have a spent use of it. If you haven't used the Roar before reverting it will just keep stacking the memorization's, and never be able to fully remove it.

    Created with Near Infinity, it will remove all instances of the given ability, regardless of whether they've been used or not. I just wish I knew why it does this.

    Another option: You could just make the Roar an Item-slot Magical Ability for the bear claws. No extra ability to add or remove.
  • WispWisp Member Posts: 1,102
    Erg said:


    1) add your custom innate spell to SPELL.IDS

    Involving spell.ids is unnecessary (and a added headache) for almost everything. Virtually all spell-related script actions have a RES variant that takes a resource reference instead of a spell.ids entry. All opcodes also take resource references.

    Opcode 172 should remove 1 instance of the referenced spell (i.e., if you want to remove 3 instances, you need to invoke it 3 times), including the memorised spell. That's how it's used in the vanilla back-to-human spells used in shapeshifting.

    @SirK8‌
    You may want to create a Avenger or something and see if you are having the same problems with e.g., the salamander shape and its fire-breathing innates. If you don't, have a look at spin127.spl and spin122.spl (or the spells used by whatever vanilla shapeshifting you test).

  • ErgErg Member Posts: 1,756
    edited April 2014
    Wisp said:

    Erg said:


    1) add your custom innate spell to SPELL.IDS

    Involving spell.ids is unnecessary (and a added headache) for almost everything. Virtually all spell-related script actions have a RES variant that takes a resource reference instead of a spell.ids entry. All opcodes also take resource references.
    @Wisp‌ thanks for pointing out my mistake :)

    My proposed solution was based on what the IESDP site says about RemoveSpell() and RemoveSpellRES():
    The spell can be an innate ability, a priest spell or a wizard spell, but must be listed in spell.ids
    and about Opcode 172:
    Removes the spell specified by the resource key from the targeted creature(s) spellbook ( but does not affect spells already memorised).
    but, as I said, I never actually tested it.
    Post edited by Erg on
  • WispWisp Member Posts: 1,102
    edited April 2014
    Yeah, the IESDP is good, but does contain the occasional mistake. Some of them have been corrected, while the public copy has yet to be updated. And the descriptions frequently apply to the non-RES versions, or the most prominent of several variations, or stuff like that. A lot of the (known) errata can be found in the IESDP forum.

    (And on further thought, I'm uncertain if opcode 172 only removes a single instance or really removes all instances.)
  • SirK8SirK8 Member Posts: 527
    Thank you all very much for your responses. I am truly a novice when it comes to modifying my game and so every bit of new information helps. It's been a rather busy day at work today so I haven't had the time to try any of this, but I'll let you know how it turns out.

    @Wisp - thanks for the tip on the Avenger, I've never played any of the druid classes (aside from Jaheira) so I didn't realize there was an existing example of what I want to do!
  • SirK8SirK8 Member Posts: 527
    Update: I think I've finally got it. Thank you to all that helped me out. I first tried using the fire salamander shape as my template (thanks @Wisp) and made my edits in NearInfinity (thanks @kjeron‌). At first it still wasn't working, even though I was only making very minor changes (substituting my ability for the ones in the fire salamander shape).

    Next I started looking at the spell.ids (thanks @Erg for pointing me to this file), even though @Wisp‌ mentioned it wasn't needed (which is true), I was frustrated that my simple edits didn't result in the same behavior, so I was going to try putting the spell in the spell.ids just in case, which led me to this link - http://www.pocketplane.net/tutorials/simscript.html (since I googled on how to add spells to the spell.ids). At the top of that page it talks about spell naming conventions, which to be honest I had no idea mattered so much. I updated my spells to use those conventions and now it is working.

    I did all of my edits in NearInfinity based on @kjeron's post above, but I don't know if it was necessary in the end (I'll have to test the same thing in DLTCEP). Thank you again everyone for your help on this!

    I still have some things I want to do with this mod that I'll likely need to ask for help on, but I'll open separate threads for those if needed.
  • CrevsDaakCrevsDaak Member Posts: 7,155
    I apologize I could not help, I couldn't get to the computer until now.
  • SirK8SirK8 Member Posts: 527
    @CrevsDaak‌ - no worries, I have things mostly figured out for now thanks to everyone's help
  • kjeronkjeron Member Posts: 2,368
    @Wisp
    I think I've figured out what determines what type of spell removal effect it applies to innate abilities. My previous statement was just a coincidence resulting from different naming conventions I use when creating items through Weidu or Near Infinity, they have nothing to do with the outcome.

    Opcode 172 : Remove Spell:
    Target spell filename 8 characters long = remove only spent instances of spell
    Target spell filename <8 characters long = remove all, remaining or spent

    Certainly an interesting way to decide the effect, but a shame too.
  • WispWisp Member Posts: 1,102
    @kjeron‌
    I can't imagine it's intentional (it's pretty damn silly), but IIRC I've read elsewhere that the length of the resref matters, so you are probably right that it is the exhibited behaviour.
  • SirK8SirK8 Member Posts: 527
    @kjeron‌ = Thanks for that info, I was under the assumption I had to follow the naming conventions of SPIN or SPCL, etc, because anytime I deviated from it the remove opcode wouldn't work the way I wanted it to. Now that I think about it though, when I was deviating I was using 8 characters.

    I've finished the kit mod now, and it seems to be working ok so far, I have some kinks to work out and somethings I might do differently. With that info about the length of the spell name I will probably go back and rename those spells to avoid potential conflict with other mods.

    @Wisp - is there a (relatively) easy way to use WeiDU to patch all my existing spells and update references? I can do it through DLTCEP manually, but if there's an automated way that would be nice.

    Thanks again to everyone for helping me with this. This is an awesome community. I've attached the mod if anyone wants to take a peek and offer feedback.
  • WispWisp Member Posts: 1,102
    SirK8 said:


    is there a (relatively) easy way to use WeiDU to patch all my existing spells and update references? I can do it through DLTCEP manually, but if there's an automated way that would be nice.

    Yes, there is. How you'd do it depends on what you mean by "update references".
  • SirK8SirK8 Member Posts: 527
    @Wisp - sorry, I'm probably using wrong terms :) Basically for my kit I have spells and abilities that reference each other, such as give innate ability opcode and remove spell opcode. Since I named them all as SPCLXXX or SPINXXX thinking they had to be that way, I would now like to give them all new names based on @kjeron‌ shared. I'm hoping to avoid potential conflict with other mods or future new content by not using that namespace.

    With new names I was hoping there was some easier way than manually updating each spell, something like a search and replace - search for X in these files and replace it with Y. I've read through the WeiDU readme, but I'm not much of a programmer, and pretty inexperienced with the application so if it's in there I've missed it.
  • WispWisp Member Posts: 1,102
    @SirK8
    For a literal search and replace solution, you can use
    COPY ~yourmod/some.spl~ ~override/new.spl~ REPLACE_TEXTUALLY old_ref new_ref (8)
    This will place the fixed files in the override for as long as the mod is installed. If you wish to update the files in your mod folder, you can copy them from the override before you uninstall the mod. There are numerous other ways of doing it, but this is perhaps straightforward enough.

    For a lighter touch you can walk the file structure and only replace the bits you want, but it doesn't sound like you need that.
  • SirK8SirK8 Member Posts: 527
    Thanks @Wisp, that looks like what I need.
  • lansounetlansounet Member Posts: 1,182
    edited March 2015
    Sorry for bumping this thread but I have a similar issue.

    I have this vanilla item that I want to give an ability when it's equipped, with all the mods that modify items around I can't just add an equipped effect to grant the ability so I went with an extension of baldur.bcs.
    When the item is equipped it runs a block that casts a spell on the character equipping the item to grant him an innate ability through opcode 171. Until now all is working fine, character equips the weapon, he gets the innate (for testing purpose only 1 use, many uses in final form). Then the script has more blocks to remove to remove the ability but RemoveSpellRES does nothing.

    So what is going on? What's the point of using RESREF if I have to add the spell to the spell.ids file as IESDP states? Or as @Wisp suggested that's not needed but then why is it not working? I can tell the block is running because it sets a var back to 0 (set to 1 when item is equipped).

    Am I stuck with using another spell using opcode 172 while making my spell name less than 8 characters?
    kjeron said:


    Opcode 172 : Remove Spell:
    Target spell filename 8 characters long = remove only spent instances of spell
    Target spell filename less than 8 characters long = remove all, remaining or spent

    EDIT : Not working with custom spell with opcode 172 either apparently... Also 171 only adds 1 charge to the ability no matter how many I set in the actual ability (which is not working anyway). Any good spell making tutorials around?
    Post edited by lansounet on
  • AstroBryGuyAstroBryGuy Member Posts: 3,437
    edited March 2015
    IIRC, RemoveSpell and RemoveSpellRES remove a *memorized* instance of a spell/innate. They don't remove the spell from the spellbook entirely. So, using RemoveSpellRES would remove a memorized instance of the innate (as if it were cast), but the innate would be regained after a rest.

    See this topic at G3: http://gibberlings3.net/forums/index.php?showtopic=3596
  • [Deleted User][Deleted User] Posts: 0
    edited March 2015
    The user and all related content has been deleted.
  • lansounetlansounet Member Posts: 1,182
    edited March 2015
    @subtledoctor you're missing something that I explained in my previous post and now I'm not overthinking this. Thanks though.

    Gonna check how Refinements does this as suggested in the thread Astro linked.

    Looks like I can't cound, opcode 172 works with max 7 characters spell name. Now I need to get that spell working~
    Post edited by lansounet on
  • The user and all related content has been deleted.
  • lansounetlansounet Member Posts: 1,182
    @subtledoctor Because the item may very likely be overwritten by a hundred item mods?...
  • The user and all related content has been deleted.
  • lansounetlansounet Member Posts: 1,182
    Nah it's ok I made it work, it's just sad that the charges field in spl ability headers in unused whereas item ability headers can use it
  • The user and all related content has been deleted.
  • lansounetlansounet Member Posts: 1,182
    Thanks I know all of this, it's just that the mod I'm maintaining is a quest mod that has been included in the Big World for a while so I'm not gonna make them change the install order drastically. It can also benefit from SCS scripting and tweaks mods which are usually installed towards the end
Sign In or Register to comment.