RogerRed Posted November 11, 2022 Share Posted November 11, 2022 Is there a way to get which spell is currently being cast? And not just which spell is equipped, because I want make it so that activating an ayleid well or using welkstone causes an if statement to run in an object script. Something like this for eg If player.IsCasting fingerofthemountain == 1 Set etc, etc to etc, etcendif I know IsCasting only returns whether reference is casting or not, I want to return when the actor cast a specific spell. Link to comment Share on other sites More sharing options...
GamerRick Posted November 11, 2022 Share Posted November 11, 2022 OnSpellCast? Link to comment Share on other sites More sharing options...
RomanR Posted November 11, 2022 Share Posted November 11, 2022 For some reason determining a caster is extremely difficult in Oblivion (at least for me). However I can offer at least another way: if you want determine if Ayleid Well was hit by a spell and this spell was cast by a player, I created a script as additional script effect. It will show a message, if these two conditions were met. scn WellTestEffectScript ref target ref target2 ref source int count int size array_var caster begin ScriptEffectStart set target to GetSelf if target != 0 let target2 := target.GetBaseObject if target2 == ARWellGrate01 let count := target.GetActiveEffectCount if count > 0 let size := ar_Size caster if size == -1 let caster := ar_Construct Array endif let caster := target.GetActiveEffectCasters let size := ar_Size caster if size > 0 set count to 0 while count < size let source := caster[count] if source == player Message "Ayleid Well was hit by player." endif set count to count + 1 loop ar_Resize caster 0 endif let caster := ar_Null endif endif endif end Aim for active part in the center of well. Unfortunately you need OBSE, I couldn't find another approach. Link to comment Share on other sites More sharing options...
RogerRed Posted November 11, 2022 Author Share Posted November 11, 2022 (edited) GamerRick and RomanR both of your suggestions involves quest scripts and separate function scripts. I was hoping that everything could have been done in one object script, but it looks like that is the route I would eventually have to take to make the mod I want to make in the future, but I would rather not do that at this point. Thanks for your suggestion though and your script RomanR might be useful another future mod. This is the script attached to an amulet, it is in effect a magicka battery that stores up to 100 points of magicka, it replenishes the wearers magicka almost instantly from what it has stored. It recharges itself only after the wearers magicka pool is full, then it begins to recharge as fast as the wearers own magicka regeneration rate. This is to emulate the amulet recharging off of the wearers excess magicka. Hovering the cursor over the amulet shows the capacity of the amulet while holding down shift and hovering over it shows the recharge rate per seconds. I wanted to have using a welkynd stone or using ayleid well to fully replenish it along with the player. ScriptName MagesAmulet ref user float maxmag float curmag float regen Float rgtimer float charge float recharge float rctimer float will float udtimer short fulldoonce Begin onequip Set user to GetContainer Set charge to 0 set regen to 2 set maxmag to user.GetBaseActorValue Magicka set will to user.GetActorValue Willpower set recharge to 0.01 * ((.02 * Will) + .75) * maxmag End begin MenuMode 1002 if IsKeyPressed3 42 && GetActiveMenuSelection == MageAmulet message " Amulet regeneration rate %.0f per sec " recharge 2 elseif GetActiveMenuSelection == MageAmulet message " Amulet charge %.0f/100 " charge 1 endif ;set regen to 1 End Begin GameMode set regen to 1 set udtimer to udtimer + GetSecondsPassed if udtimer > 5 set maxmag to user.GetBaseActorValue Magicka set will to user.GetActorValue Willpower set recharge to 0.01 * ((.02 * Will) + .75) * maxmag set udtimer to 0 endif set curmag to user.GetActorValue Magic if curmag < maxmag if charge < 0 message " Amulet is empty" 1 set charge to 0 endif if charge > 0 set rgtimer to rgtimer + GetSecondsPassed if rgtimer > 0.1 set charge to charge -regen user.ModActorValue2 magicka regen set rgtimer to 0 set fulldoonce to 0 endif endif elseif charge < 100 ;message " Recharging " 1 set rctimer to rctimer + GetSecondsPassed if rctimer > 1 set charge to charge + recharge set rctimer to 0 endif elseif fulldoonce == 0 message " Amulet is full" 2 set fulldoonce to 1 endif End Edited November 11, 2022 by RogerRed Link to comment Share on other sites More sharing options...
RomanR Posted November 12, 2022 Share Posted November 12, 2022 (edited) So you want use the fact that Ayleid Well is forcing to cast player a spell as a sign of successful power draw? I think you can use IsSpellTarget function as the player will be affected by it for a while. For example: if user.IsSpellTarget AyleidPower != 0 && power_drawed == 0 set power_drawed to 1 endifEdit: Propably most easy will be to edit the AyleidWell script, the part in which Player.Cast AyleidPower Player command is used. But it can bring problems if another mod edits this script too. Edited November 13, 2022 by RomanR Link to comment Share on other sites More sharing options...
Recommended Posts