cumbrianlad Posted January 14, 2020 Share Posted January 14, 2020 i must be getting really shot! Time for a break I think!I'm even posting the same thing twice... time to see a doctor :confused: Sorry, SurfsideNaturals. Link to comment Share on other sites More sharing options...
SurfsideNaturals Posted January 14, 2020 Share Posted January 14, 2020 (edited) That is ok. I know the feeling lol. Hopefully this guy will try out my update of your script in game and see how it works. My only concern is the game will not return a caster actor unless the spell has a target actor ( hits an NPC ) but I think will. Edited January 14, 2020 by SurfsideNaturals Link to comment Share on other sites More sharing options...
cumbrianlad Posted January 15, 2020 Share Posted January 15, 2020 I'd only be guessing too about that.I think Maxarturo's point about getting the actual spell working correctly first, then adding the conditions and any scripts afterwards is absolutely the right way to go, or else the OP is never sure which bit is wrong. It could be that my original suggestion would have worked.OP, how are you testing this? You must test from a game that has never seen the mod. That includes re-using a save even if you don't save the game while testing. It's especially important with scripts and properties in scripts. I found that out the hard way. I spent days wondering why an activator that had worked before when testing, didn't work later. it was just that I'd reassigned a property on the activator script. The game seems to log the values of properties when the script is used and that gets imbedded. Given that you're trying all sorts of scripts and properties here, your testing method is vital.A good way to test is to use the 'live another life' mod (unless your mod may clash with it, not the case here). Then you can skip the intro, 'TGM' and coc into a cell full of bandits and test away in seconds.If you are testing like this, then it's one other thing we needn't worry about. Link to comment Share on other sites More sharing options...
Rizalgar Posted January 17, 2020 Share Posted January 17, 2020 Well, he never posted back, but I'll throw my two cents in anyway. Who knows. This may not be the most efficient way of doing it, I strictly use a framework for my mod to determine whether or not the player has the correct items, levels ect to use a spell. So feel free to correct where I'm wrong. What this will do;Set conditional item requirementSet script to check and remove item on useUnequip once out of item(s) What this won't do;Whatever you limit yourself to First, hop in to your script. Since this will be added to the ME, there's no point in going back and forth. Scriptname SomeTestSpellScript Extends ActiveMagicEffect Ingredient Property ReqItem Auto ;Either fill in with the CS item name, or keep as is and manually fill in item for use in multiple scripts Int Property ReqAmount ;The amount needed to cast the spell. Leave as is for multi-use or set as a static Actor Property PlayerRef Auto ;Fastest way to obtain player AFAIK Spell Property SpellName Auto ;Fill in with actual spell, or again keep as is for multiple use Event OnEffectStart(Actor Target, Actor Caster) Int ItemCount = PlayerRef.GetItemCount(ReqItem) If Caster == PlayerRef ;Makes sure it's the player casting, so this can be used for NPC's if wanted If ItemCount < ReqAmount ;Simple maffs Debug.Notification("You do not have enough " + ReqItem + ". You need " + ReqAmount + ".") ;Let's the player know how much of what item is needed PlayerRef.UnequipSpell(SpellName, 1) ;0 is Left hand, 1 Right hand and 2 is shout slot ;;Note - May require actual link to spell will display in next spoiler Else PlayerRef.RemoveItem(ReqItem, ReqAmount, True) ;Silently removes the required amount of required item from player ;Insert anything else you want done if it is the player casting the spell here EndIf Else ;Insert anything you want a NPC to do with this spell here EndIf EndEvent Linking spell if that is needed ;Just showing how to link spells Spell Property FireSpell Auto Spell Property IceSpell Auto Spell Property LightningSpell Auto Under your event. you would then declare all of your properties to a single variable Something like Event OnEffectStart(Actor Target, Actor Caster) Spell EquippedSpell = PlayerRef.GetEquippedSpell(1) ;Again, 0 left, 1 right, 2 shout Then you would change up the unequip a little bit, to find the correct spell If EquippedSpell = FireSpell PlayerRef.UnequipSpell(FireSpell, 1) ElseIf EquippedSpell = IceSpell PlayerRef.UnequipSpell(IceSpell, 1) EndIf and so on ;-; Again, I use a framework for my spells where the spell scripts are interacting with each other regularly, so there's probably a better way that is simpler than this for what you're looking for Then, go into your magic effect, attach the script after naming it and all that. Don't forget to go into the script in the ME menu and set the properties. Oh, one thing. If you do not set a Magic Skill in the ME menu, the spell will not show up in game. Just an FYI, least it's the case I keep coming across. After that, just create the spell(s), attach the magic effect(s), then set the condition as was mentioned in previous posts. Link to comment Share on other sites More sharing options...
Recommended Posts