I have a pixie imprisoned in a magical cage. When you free him by casting Dispel Magic on the cage (and the pixie), the cage disappears (by spellhooking), but unfortunately the pixie turns hostile and attacks you. This is not as intended, the pixie should stay friendly towards you and start a conversation.
I'm sure it used to work earlier, maybe with an earlier patch. I checked the onSpellCastAt script, here GetLastSpellHarmful returns true. I double-checked spells.2da, here the hostile flag of DispelMagic is set to 0.
What am I doing wrong? Is there a way that the pixie remains peaceful? In an earlier stage of development, I would have left it at it is now, but unfortunately this does not fit with the plot.
Dispel magic
Débuté par
diophant
, nov. 24 2012 07:48
#1
Posté 24 novembre 2012 - 07:48
#2
Guest_Iveforgotmypassword_*
Posté 24 novembre 2012 - 10:45
Guest_Iveforgotmypassword_*
I don't know if this will work but make the pixie neutral possibly "plot" too if that's possible. If you haven't got a neutral faction open the view tab, click factions, add faction, click the one with 50 for everything that says faction then in the box in the bottom corner change its name and that's it done. Now it will appear in the properties when you click the faction part of anything select it and no matter who's fighting the neutral person/pixie/whatever will just watch..
#3
Posté 24 novembre 2012 - 02:24
What Tsongo said, or you could try removing her 'on spell cast-at' script.
#4
Posté 24 novembre 2012 - 04:09
Thanks for the replies. I'll give it a try, although I doubt it will work. The problem is, there is no battle going on and no other NPCs are involved. Just the pixie interprets freeing him as hostile act, as he gets hit by the dispel magic spell. When the onSpellCastAt script fires, the reputation of the pixies faction has already changed, aborting or removing the script avoids that he attacks, but he is already marked as hostile.
Well, if nothing else helps, I still can use his onSpellCastAt script to readjust the reputation, but I hoped there would be a better way.
Well, if nothing else helps, I still can use his onSpellCastAt script to readjust the reputation, but I hoped there would be a better way.
#5
Posté 24 novembre 2012 - 05:33
After diving into several scripts, I found out the reason for the behaviour as well as a convenient workaround. Maybe someone else runs into the same problem and finds this useful.
- The main implementation of Dispel magic is in x0_i0_spells. Here, it is checked whether the spell target is a valid target for a hostile spell. Depending on that, the SpellCastAt event will be sent with a flag set to TRUE or FALSE. I guess this flag determines whether the target turns hostile or not. The flag from spells.2da is never checked in the script.
- The check whether the target is valid is rather complicated, and involves checks for faction, reputation, and game rules. Modifying these checks seemed rather risky to me, especially as this function is also called by other spell scripts.
- Before said check, there is a check whether the target is petrified or immune to dispel magic. If so, the other check is not done at all, and the script aborts without fireing the SpellCastAt event. That was the point that I could use for my workaround. I just had to set the local int X1_L_IMMUNE_TO_DISPEL to 10, now the pixie is immune to dispel magic (which is okay for me, as he cannot buff himself), and therefore is ignored by the spell script.
- The main implementation of Dispel magic is in x0_i0_spells. Here, it is checked whether the spell target is a valid target for a hostile spell. Depending on that, the SpellCastAt event will be sent with a flag set to TRUE or FALSE. I guess this flag determines whether the target turns hostile or not. The flag from spells.2da is never checked in the script.
- The check whether the target is valid is rather complicated, and involves checks for faction, reputation, and game rules. Modifying these checks seemed rather risky to me, especially as this function is also called by other spell scripts.
- Before said check, there is a check whether the target is petrified or immune to dispel magic. If so, the other check is not done at all, and the script aborts without fireing the SpellCastAt event. That was the point that I could use for my workaround. I just had to set the local int X1_L_IMMUNE_TO_DISPEL to 10, now the pixie is immune to dispel magic (which is okay for me, as he cannot buff himself), and therefore is ignored by the spell script.





Retour en haut






