Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

New Premium Module: Tyrants of the Moonsea! Read More
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

[Questions] Custom Spell Creation

lroumenlroumen Member Posts: 1,924
edited June 2017 in General Modding
Hi all,

I have some question on spell creation. Maybe one of you can figure out what is going on.

I am creating a kit which has innates available. All of them create a list of spells to cast, similar to spell immunity.

Steps I took to create the innates.
1. Create innate spell
... Spell type innate gets it on the innate bar.
... SAY NAME1 gives it a name
... SAY UNIDENTIFIED_DESC gives it a description when right clicked.
... extended effect OP-CODE 214 allows it to select a spell from a table (2DA).
... At level 1, I get tabel 1 with 1 spell entry
... At level N, I get table N with N spell entries.
... all Spell entries are set to only function starting that level.

Now the 2DA works. I have a spell in there that I can cast. Only, when I rightclick it gives no description
I tried NAME1 which works, but NAME2 and UNIDENTIFIED_DESC do not give it a right-clickable info.
Does anyone know how to get this done?

Cheers

Comments

  • badungubadungu Member Posts: 53
    Have you tried setting the "identified" description to #-1 or to your description?

    SAY DESC #-1

    or

    SAY DESC ~Your string~

  • lroumenlroumen Member Posts: 1,924
    Thanks, I will try that.

  • subtledoctorsubtledoctor Member Posts: 11,468
    There's a separate field for the pop-up text in the new EE engine. I had a similar issue once but honestly I forget how I fixed it.

    Be aware that with opcode 214, after casting the main spell and displaying the various subspells, if you right-click on a subspell, the spell will go away as if you cast it, but it will not have actually been cast. So that right-click text may not be very useful...

  • lroumenlroumen Member Posts: 1,924
    My innate refreshes itself after casting so that should be less of an issue. Good to know in future though. It probably make more sense to put the right click text in the main innate then. Hmmmm

  • lroumenlroumen Member Posts: 1,924
    Another question.

    Suppose I want to make a spell that makes me immune to haste. Why would I need to add immunity to the haste spell (I see that often being done)? Wouldn't immunity to the op code and string be enough?

  • kjeronkjeron Member Posts: 2,137
    lroumen said:

    Why would I need to add immunity to the haste spell (I see that often being done)?

    The normal haste spells also impose fatigue, which you should not block by effect, so you block the resource(spell).

  • AasimAasim Member Posts: 591
    lroumen said:

    Another question.

    Suppose I want to make a spell that makes me immune to haste. Why would I need to add immunity to the haste spell (I see that often being done)? Wouldn't immunity to the op code and string be enough?

    It would, if you want to be immunte to effects tied to Haste opcode (movement bonus, extra attack etc.).
    However, w/o immunity to haste spell, you'd still suffer other effects tied to the spell like fatigue.

  • lroumenlroumen Member Posts: 1,924
    edited June 2017
    Okay. That is clear. Thanks.

    The problem I have is that some mods add sources of the effect I am trying to block, so it would be troublesome to find out which spells I would need to block by resource.

    Moreover, if I do not install a certain mod this time, I would need to not have that spell blocked since it does not exist in the install and I have no idea if that would go wrong or not.

    Unless there is an easy way to verify which spells carry a common effect, I think I would therefore rather add another block to the secondary detrimental effect (which in the case of haste is then fatigue). Or is my reasoning flawed?

  • subtledoctorsubtledoctor Member Posts: 11,468
    You can have extra 206 effects for nonexistent spells in your spell, it won't cause problems.

  • kjeronkjeron Member Posts: 2,137
    lroumen said:

    Okay. That is clear. Thanks.

    The problem I have is that some mods add sources of the effect I am trying to block, so it would be troublesome to find out which spells I would need to block by resource.

    Moreover, if I do not install a certain mod this time, I would need to not have that spell blocked since it does not exist in the install and I have no idea if that would go wrong or not.

    Unless there is an easy way to verify which spells carry a common effect, I think I would therefore rather add another block to the secondary detrimental effect (which in the case of haste is then fatigue). Or is my reasoning flawed?

    Immunity to Fatigue will prevent all sources of fatigue, including natural fatigue over time. Not a good approach.

    You can have extra 206 effects for nonexistent spells in your spell, it won't cause problems.

    This only works for mod-prefix spells, not those added through ADD_SPELL, those will cause problems.

    If a mod adds a new haste spell, its up to that mod to clone all existing isntances of "Immunity to Effect: Haste" with "Immunity to Resource: Newspell". Its no different from properly updating Spell Level Immunity for new Area Effect sources.

    If a mod adds a new source of "Immunity to Effect: Haste", its up to that mod to add "Immunity to Resource" for all sources with more than just the Haste Effect. Scan all spells/items for "Immunity to Effect: Haste", if found scan for all "Immunity to Resource" effects, scan those resources for the Haste Effect, and if found, add "Immunity to Resource" for that resource to your spell/item.

    Grammarsalad
  • GrammarsaladGrammarsalad Member Posts: 2,510
    Yeah, as I'm learning the hard way, there are layers and layers to spell creation: if you create an y-like spell, you have to be sure that all spells that protect against y protect against your spell; you also have to be sure that any spell that cancels y also cancels your spell( thankfully, these two often go together); if your spell cancels or protects against x- like spells, you have to be sure that it cancels or protects against all x-like spells ( often these go together, as well). And it is painful learning as you go, especially if you are adding a lot of spells. You may find, as I'm finding, that you have to do a top down revision of all the spells you have created so far. Also, as you go along, you realize that you need to recode an uncertain number of spells because you have forgotten to account for something ( looks up at Kjeron's post anxiously)

  • subtledoctorsubtledoctor Member Posts: 11,468
    edited June 2017
    kjeron said:


    You can have extra 206 effects for nonexistent spells in your spell, it won't cause problems.

    This only works for mod-prefix spells, not those added through ADD_SPELL, those will cause problems.
    It's easy enough to deal with ADD_SPELL'd spells, if you know their IDS name. You can find the RES name at install-time and update your own new spell in Weidu at that time. Frankly the more I do this, the more I find myself constructive spells from pure .tp2 code rather than making the spell first in NI.
    kjeron said:

    If a mod adds a new haste spell, its up to that mod to clone all existing isntances of "Immunity to Effect: Haste" with "Immunity to Resource: Newspell". Its no different from properly updating Spell Level Immunity for new Area Effect sources.

    If a mod adds a new source of "Immunity to Effect: Haste", its up to that mod to add "Immunity to Resource" for all sources with more than just the Haste Effect. Scan all spells/items for "Immunity to Effect: Haste", if found scan for all "Immunity to Resource" effects, scan those resources for the Haste Effect, and if found, add "Immunity to Resource" for that resource to your spell/item.

    Of course, this is dependent on install order. Which just means a modder has to think about install order at the time they make a mod. I know TnB should be installed after SR, so I can add immunity to spwi604d (a Flesh to Stone subspell) to Transmuters' immunities, even though that subspell doesn't exist in vanilla. Easy enough to handle anything in spell.ids similarly.

    But various kit mods add kits after TnB, and one such kit might have an innate version of Flesh to Stone. In that case it must be the kit mod that handles this, by looking for any spells like mine that give immunity to spwi604, and patch them with immunity to the new kit ability.

    CLONE_EFFECT more or less makes this a simple task; just need to specify it for any effects that take a .spl RES in the 'resource' field (which I think means opcode 206, 318, 321, and 324)... but most kit mods still don't do it (including mine!).

    If I ever have some free time maybe I'll write up a function to handle this so modders need only add a single line to their code to ensure this is done...

    GrammarsaladAasim
  • lroumenlroumen Member Posts: 1,924
    I was hoping not to put so much effort into it.
    If someone has a function that makes that easier it would really help the community, even smaller modders like me.

    Is spell creation via tp2 easy to learn? If it is easy to search all spells via tp2 and add the protection from resource, that would be really nice.

  • subtledoctorsubtledoctor Member Posts: 11,468
    This discussion is all very vague, which is why you are getting vague and intimidating advice. It would be better if you explained exactly what you are seeking to create. Chances are someone will just write out the code you need.

    And then in incorporating it, you'll probably come to understand it. This is basically how I learned everything I know about Weidu.

    lroumen
  • AasimAasim Member Posts: 591
    @Iroumen
    If it's any help to what you want to do (i.e. collect all resources and do x with them) check out SR's Dispelling_Screen and/or haste_slow components.
    It would be perfect if somewhere existed a sort of a "spell database" for BG mods, but it doesn't.
    As per spell creation via .tp2, again, you can check Dispelling_screen in SR - I made use of a macro code made by Ardanis to create a spell from "thin air" . But it's mostly a trial and error work - don't expect things to go easy. It took me quite a few hours to get the spell working as I envisioned it.

    Grammarsaladlroumen
  • lroumenlroumen Member Posts: 1,924
    Well, I am creating some spells that work on top of improved anvil spells. For instance, there are several Web lariat spells cast by spiders and things, and they have the Web and unconsciousness effects. I would like to be immune to those spells, so I can protect vs both op codes or I can protect vs the spell resources

    If I do the latter, I need to find out which spells those are.
    If i simply do the former that also makes me immune to wing buffet and emotion type spells, which is not the real desired effect I want. So protection from resource as explained is the best way, but requires a deep dive into all spells vanilla and anvil...

    But there are more spells and spell effects I want to be protected from via other spells I want to create. That requires me to go through the process multiple times.
    So if searching for spell effects and on the fly addition of protection vs opcode and resource is possible via tp2 (such that I have a generic spell that needs additions in accordance to what is searched for), that would make everything so easy.


    I will have a look at spell revisions. Sounds like what I want (ease of finding and adding) is already used there.

Sign In or Register to comment.