Skip to content

NI Probability check with Cast spell on condition

MaerdylMaerdyl Member Posts: 15
edited July 2019 in General Modding
I've recently started creating my own items using NearInfinity, things have been working fine for me until now.
I'm trying to use "Cast spell on condition (232)" on an armor piece in BGEE + SoD, my problem here is that the effect triggers ALL THE TIME even with a 10% Probability.

So i was wondering, am i doing something wrong or is this function somehow hardcoded to not take into consideration the Probability parameter ?

Comments

  • OlvynChuruOlvynChuru Member Posts: 3,079
    Maerdyl wrote: »
    I've recently started creating my own items using NearInfinity, things have been working fine for me until now.
    I'm trying to use "Cast spell on condition (232)" on an armor piece in BGEE + SoD, my problem here is that the effect triggers ALL THE TIME even with a 10% Probability.

    So i was wondering, am i doing something wrong or is this function somehow hardcoded to not take into consideration the Probability parameter ?

    If you want the triggered spell to only take effect 10% of the time, you need to make a custom spell whose only effect is to cast the spell on the target with 10% Probability (specifically, set probability1 to 9 if you want a 10% chance). The Cast Spell on Condition effect should have probability1 = 100, and it should trigger the custom spell.

    In case this was the problem, giving a Cast Spell on Condition effect a 10% Probability will make the Cast Spell on Condition effect work perfectly 10% of the times the armor is put on; it will not make the spell trigger on 10% of conditions.
  • MaerdylMaerdyl Member Posts: 15
    edited July 2019
    First of, thanks for the reply, i didn't expect to get help so soon!

    As for your message, i got the first part alright, but i don't really understand what you mean in the second one, or more precisely the last sentence:
    OlvynChuru wrote: »
    it will not make the spell trigger on 10% of conditions.
    Sorry to bother you, my brain is kinda slow, would it be possible to elaborate on what this means ? maybe with an example ?

    Now on the part i did (hopefuly) understand, i already created a custom spell to do exactly what you are suggesting, but i must have done it wrong, because it still triggers 100% of the time.
    For more details, what i did was:
    - Add "Cast spell on condition" as an effect on my armor. (should i have made it an item ability ?)
    - Set up the effect with a 50% Probability and linked it to my custom spell as a resource
    - Set up my custom spell with a Spell ability
    - Edited all Effects on that Spell ability to trigger with a 50% Probability

    (I set up 50% Probability for testing purposes so it triggers quicker and more often)

    Despite all this, it still triggers 100% of the time regardless...

    Do you want me to link any of my ITM or SPL files btw ?


    P.S: Sorry for the first part, i think i finally got what you meant. in short the Cast Spell on Condition will trigger 10% of the time at each check to determine if the armor is worn or not and i guess the frequency of those checks is so high that it will trigger constantly. Therefore the 10% chance to trigger based on the parameters i want doesn't really matter.
  • OlvynChuruOlvynChuru Member Posts: 3,079
    Maerdyl wrote: »
    Do you want me to link any of my ITM or SPL files btw ?

    Sure! Just post them here and I'll take a look at them.
  • MaerdylMaerdyl Member Posts: 15
    Here you go
  • OlvynChuruOlvynChuru Member Posts: 3,079
    Okay, I found the problem. The probability you put on each effect of the spell determines the probability of that specific effect being applied, but the spell itself is always applied.

    Some screenshots:

    01e2k3chegcl.png
    (She got hit by the battle horror and that triggered Armor of Faith, but the effects didn't get applied this time.)

    ahi45zfa809g.png
    (She got hit by the battle horror and that triggered Armor of Faith, and the effects were applied.)

    That's why I recommended making a custom spell that casts the spell you want. Make it so SPPR111B has no name, and put just one effect on it; that effect should cast SPPR111, but probability1 should be set to 9 (10% chance of triggering).

    By the way, it might be simpler just to have the armor give the effects of Armor of Faith while equipped.
  • MaerdylMaerdyl Member Posts: 15
    edited July 2019
    OlvynChuru wrote: »
    By the way, it might be simpler just to have the armor give the effects of Armor of Faith while equipped.
    I haven't done that yet, but i think i'll keep that for another item anyway. I just like the spreading wings animation in middle of combat way too much!

    Anyway, i transformed SPPR111B into a blank spell that only casts SPPR111, well at least that's what it's supposed to do... but sadly it doesn't work at all, nothing triggers, maybe i set it up wrong due to my inexperience?

    I've taken the liberty of adding the changed spell (now called PLAT08B.SPL) and the Updated Armor that goes with it as attachments, if you want to check them out again.
  • OlvynChuruOlvynChuru Member Posts: 3,079
    I noticed in PLAT08B.SPL you put the cast spell effect as a global effect. It should work if you keep one of the "spell ability" sections you had before and put the cast spell effect in there as the only effect.

    Also, if you want to have the spell not display its name when triggered, set the name to -1 rather than 99999, since certain mods might add so many strings to the game that the total goes over 99999.
  • MaerdylMaerdyl Member Posts: 15
    edited July 2019
    It took me a while, mainly due to PLAT08.SPL corrupting itself for some reason...
    I redid the whole thing from scratch and it worked perfectly in the end !

    I'm really grateful for your help, i would never have managed to get even close to figuring this out without you!
    Thanks a lot!!!
Sign In or Register to comment.