Jump to content

Change % chance to apply a spell based on Stealth value


Recommended Posts

Hello,

 

I want to introduce a specific behavior to a special version of Hide in Shadows I'm working on. This version is an innate spell, so I have full control of it. I want the spell to somehow mimic the original Hide in Shadows, but also allow to hide when the enemies are nearby with some % chance and that's the main problem I'm facing now.

I want to apply a spell (spell_1) to all enemies in sight when using my HiS ability (ability_1), this spell_1 is supposed to mimic a chance of that enemy to notice my Thief and dispel my original ability_1. I also want spell_1 to have smaller chance of dispelling ability_1 when my Stealth ability is higher, eg. the Thief should have 2% greater chance of successfully going invisible for every 5 points in Stealth, so 20% at 50 Stealth and 80% at 200 Stealth. Is there an easy way to introduce such mechanics without the need of making 50 different spells (which is the easiest way)?

I tried to use 50 effects using opcode 326 within spell_1, each casting a spell_2 that has 100% chance to dispel ability_1, but each having only 2% chance to succeed (0-1, 2-3, 4-5 etc) but it seems that for each effect I get a separate roll, so I could have my spell_1 dispelled 5 times by a single spell_1, which is not what I'm looking for.  

 

Edited by SparrowJacek
Link to comment

It sounds a bit weird to bounce it off enemies, and introduces complexity. 

First, 50 effects is excessive. Personally I would separate each 5% chance, mimicking a d20 roll.

That out of the way, maybe something like this:

The innate ability (“Spell”) would use op146 to cast Spell_A and Spell_B, targeting ‘Self.’

Spell_A would apply invisibility to self.

Spell_B would apply op177 to trigger an .EFF, targeting Self.

The .EFF would use op232 with condition [hp < 102%] to cast Spell_C every round.

Spell_C would have 20 op326 effects, with checks for each 5% in the stealth abilities. (Note, the fact that there are two distinct-but-equal stealth abilities could greatly complicate this.) Spell_B would target ‘Self’ and use the InAreaNP projectile. Depending on your stealth skill, it would cast Spell_1, Spell_2, etc. through Spell_20. 

Spell_1 through Spell_20 would all be identical: broad AoE spells with op321 to cancel Spell_A. The only difference among them would be the Probability1 value, ranging from 5 to 100 corresponding inversely with your guy’s stealth skill. 

…And I think that should do it? Notably, this means the more enemies there are the greater the chance you will become visible. 

Also you’ll have to figure out the details of the innate ability: is it usable at will? Does it disappear on use, and have an indefinite duration, and reappear when canceled? Do you need to manually cancel it via a different innate? Do you want the innate to reappear whenever you become visible, whether from being detected or from attacking or talking? There’s some nitpicky stuff required to make that work, depending on what you intend. 

Link to comment

Thank you for answering!

The reason I want to implement it that way is that... I couldn't figure out any other way, that would work instantaneously. I could probably add some checks to global script or even to enemy scripts, but I don't really like that. Firing the checks determining if I manage to go invisible or not only at the moment I use my ability makes the most sense to me.

 

Well, I had another idea, trying to put that % chance to dispel my invisibility into different spell abilities, but sadly opcode 326 does not allow to specify spell level at which the inner spell should be applied.

Your idea looks good, it should work, although I still need to create 20 or 50 additional spells, which I really wanted to avoid. I will most probably use your way, if no other solution is mentioned in this thread.

Quote

(Note, the fact that there are two distinct-but-equal stealth abilities could greatly complicate this.)

That's actually not a problem. It was always weird to me that there are 2 abilities doing the same thing, so you could spend 500 points into something that can't even be used during combat if you're not a Shadowdancer and there were many more reliable ways to go invisible and backstab. That's why I am planning to use only one of them for hiding in shadows and the other one will be used for something else.

Quote

Also you’ll have to figure out the details of the innate ability: is it usable at will? Does it disappear on use, and have an indefinite duration, and reappear when canceled? Do you need to manually cancel it via a different innate? Do you want the innate to reappear whenever you become visible, whether from being detected or from attacking or talking? There’s some nitpicky stuff required to make that work, depending on what you intend. 

I have most of that in my head already, I will need to see if I will be able to implement it though :) I'm planning to reuse most of the behaviors of original Stealth button, so it will be usable at will, not needing aura to be cleansed, it will be usable only once per 6 seconds etc.

Link to comment

Note, the Stealth ability basically does need to be aura cleansed. Can only hit the button once per round normally.

11 minutes ago, SparrowJacek said:

The reason I want to implement it that way is that... I couldn't figure out any other way, that would work instantaneously. I could probably add some checks to global script or even to enemy scripts, but I don't really like that. Firing the checks determining if I manage to go invisible or not only at the moment I use my ability makes the most sense to me.

Yeah but you don’t need enemies involved for that. Just have the initial invisibility effect fire based on you stealth skill, period end of story.

Innate: op277 casting EFF permanently.

EFF: op232, hp < 102%, cast Spell_A

Spell_A: 20 op326 effects checking for different Stealth skill ranges. Cast Spell_1 through Spell_20 depending on skill. 

Spell_1 through Spell_20: first, 20 op321 effects canceling all of Spell_1 through Spell_20. Then an op20 effect for invisibility, with the appropriate probability1 value, with a duration of 7 seconds. 

No projectiles, no enemy involvement, Bob’s your uncle. 

Edited by subtledoctor
Link to comment
Quote

Note, the Stealth ability basically does need to be aura cleansed. Can only hit the button once per round normally.

It is not exactly "aura cleansed", as you can try to go invisible at any moment, even right after casting a spell/using an ability, but yeah - you can click the button only once per 6 seconds. I also want to mimic that, although the more points you put in Hide in Shadows, the shorter the time needed to reuse the ability will be. I might even consider doing some simple GUI changes to remove any usability from Stealth button and make my Hide in Shadows ability block the button (make it gray) for specified period of time, indicating that you can't use the ability yet (ofc disabling the button will only be a visual representation, but underneath I will apply an opcode protecting from my HiS ability). It should be doable without EEEx, from what I remember and I don't need old Stealth behavior.

Quote

Yeah but you don’t need enemies involved for that. Just have the initial invisibility effect fire based on you stealth skill, period end of story.

Ahhh, I remember now why I decided to involve enemies in my HiS ability. In general I wanted to preserve the original Stealth behavior, so that it's not hard to go invisible if there are no enemies around, so that monks/rangers can benefit from that, but to reliably hide during combat you'd need high HiS skill and/or additional items. I couldn't figure out a way to enforce that any other way (as described above). Sorry for not mentioning it before, I just came back to modding after a while and I don't remember all the details of my previous ideas.

Edited by SparrowJacek
Link to comment
17 hours ago, SparrowJacek said:

remember now why I decided to involve enemies in my HiS ability. In general I wanted to preserve the original Stealth behavior, so that it's not hard to go invisible if there are no enemies around, so that monks/rangers can benefit from that, but to reliably hide during combat you'd need high HiS skill

Could implement something like the 2nd version, and separately add an ‘aura’ kind of repeating ability with a small AoE to all red-circle NPCs that simply reduces their opponents’ HiS skills. Then it would affect Shadowdancers as well (which is reasonable IMHO.) Benefit to doing it this way, it wouldn’t stack with the number of nearby enemies, but would be a simple static penalty to stealth when any enemies are around. 

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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...