Jump to content

Applying a spell to original caster when target dies - is it possible?

Recommended Posts


I'm trying to implement two spells with a rather similar behavior, but I'm struggling to make them work as I want them to.

1. A non-damaging debuff ability lasting for some time targeted at an enemy and when that enemy dies the ability is restored. The best thing I could think of is that the ability applies a spell state to the caster and opcode 232 to the target, with condition "dies" which targets the whole party, but uses opcode 318 to only restore the spell to characters with that spell state. The problem I have with this solution is that if I have two characters that use this ability, then both will have it restored, which is not what I want.

2. A summon ability, that also restores itself when the summon dies. Here I should be able to target LastSummonerOf when the creature dies from its script file, but from what I remember there are effects and opcode s that block the execution of creature scripts.


Has anybody tried to implement such mechanics? Do you have any ideas on how to improve my solutions?

Edited by SparrowJacek
Link to comment
Posted (edited)

Sorry, I was not precise with my description, just for clarity I also rephrased my first message.


I want my spell to be a debuff that lasts for X time, not a damaging spell. I think this complicates stuff. I'd like to apply my debuff at one creature and when the creature is killed then the caster regains his one use of this ability. Will that make a difference?

I will look at Soul Eater in a few days when I have access to my PC.

Edited by SparrowJacek
Link to comment

Aquadrizzt claimed to have figured out a method for something like this a long time ago, but I don’t know what. I tried to make something like this for my psionics mod - use telepathic abilities against a target, and can’t use it again until the first instance stops - but I gave up after a while. 

Link to comment

Hmm, do you remember where did he claim that? Maybe there were some clues there, as I see he's not active on the forums, so asking him might not be an option. 


Well, a very ugly, but probably doable thing would be to make the caster silently cast some subspell at the target each second, if that subspell reaches the target then it applies protection from regaining the ability for a short while to the caster, if not then another subspell is applied, which restores the original ability. I'm sure this approach also has many pitfalls though.

Link to comment

Hey @subtledoctor did you try opcode 232 with SPECIAL set to 2? I performed a few basic tests, but looks like it should work.
Take a look at the description of EXTRA in https://gibberlings3.github.io/iesdp/opcodes/bgee.htm#op232

I created a spell that through opcode 177 applies opcode 232 with condition "die()" and XYZ.spl as a resource. XYZ.spl targets "dead actor" to ensure that range is not taken into account and applies some effect to self (just for testing, in the end it will allow self to regain that initial ability). It worked properly and applies all effects which had self as target even if my caster and the creature dying were in different areas, which means that it did what I wanted: it properly triggered on target dying and properly applied something to the caster. Even if this is not perfect, it's much better, faster and easier to implement than my idea of casting a spell each second.

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.

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