Jump to content

Recommended Posts

I recently managed to solve a problem that many modders seem to encounter. Namely: CUSTOM SPELLS DO NOT WORK. Maybe someone will find my experience useful.
The task seemed very simple. I created an interesting magical effect for a combat spell and gave this spell to an NPC... But the NPC stubbornly refused to use it! I removed all the spells that he had except mine, took away all the weapons, but the NPC got into a fight with his fists, ignoring my spell as before. An internet search turned up nothing. To provoke NPCs to use custom spells, modders use scripts or packages. But I needed the NPC to use the spell not just once, or with a certain frequency, but in accordance with the logic of the battle... Finally, I came across a post that said that of all the spells he has, the NPC uses those that are more powerful in battle, and if my spell is the weakest, then most likely he will never use it.
And my NPC has only my custom spell... I'm making a working assumption that the game doesn't define the effect archetype "Script ". Check. I take the Fireball spell and in its magical effect FireDamageFFAimedArea I change the archetype from “Value Modifier” to “Script”. That's all, no more NPCs use this spell. The experiment was a success. The logical conclusion is that the game is not able to determine what type of magic the “Script” archetype belongs to. Another flaw from the developers. To be honest, the entire work of the Bethesda developers is a complete flaw, but that’s another topic.
How do I let the game know that my spell is a combat spell? The answer came while looking at Fireball in the Creation Kit. This spell includes several magical effects. I take the magical effect FireDamageFFAimedArea, save it under a different ID just in case, and substitute it in my spell, reducing the health damage to one (I don’t need health damage from fire). Voila, everything works.

If it is not very clear, I will give an example.

Write the script:
--------------------------------------------------------------
Scriptname MyFavoriteSpellScript extends activemagiceffect
   Actor Property PlayerRef  Auto   

Event OnEffectStart(Actor akTarget, Actor akCaster)

 if akTarget == PlayerRef
    Debug.MessageBox("I got my ass kicked")    
 endif     

endEvent
---------------------------------------------------------------

Open the FireDamageFFAimedArea magic effect and change the archetype from "Value Modifier" to "Script". Give the effect the script you just wrote. Save the magic effect under a new ID "MyFavoriteMagicEffect".

Open the FireDamageFFAimedArea magic effect again and, without changing anything, save it under the new ID "ToHelpMyFavoriteMagicalEffect"

Open the Fireball spell and remove the magical effects from it. Now add MyFavoriteMagicEffect and ToHelpMyFavoriteMagicalEffect to it. In the magic effect ToHelpMyFavoriteMagicalEffect, reduce the Magnitude to 1. Assign the spell a new ID "MyFavoriteSpell" and save.

Give this spell to anyone you want and every time he hit you with this spell you will get a message that you got your ass kicked.
(Remember that if the NPC has stronger spells, he will use them first)
Good luck!

Sorry for my bad English

CustomSpell1.jpg

CustomSpell2.jpg

Link to comment
On 2/1/2024 at 6:27 PM, Fotogen said:

Didn't know that. Good to know

Another hint, if you want the followers use special spells.

 

check this field in MGEF:

 

Script Effect AI Data

Score: defines probability

Delay Time: should be seconds

 

recommend, not exceed 100, it might not work then anymore. Guess it's the limit, 100%

I saw values of 1000000, makes no sense

 

 

Just add this MGEF to your spell, can be dummy effect. (no damage, no duration, no strenght)

 

Following is a guess, not confirmed or tested:

I assume this is a pointer and might be affected by the Form 43 to 44 conversion. (8 to 16bit, like weapon damage)

If opened in CK for 43 to 44 conversion I would recommend to touch this values once to be on the safe side.

Edited by Tlam99
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use