Smegmeister Posted January 13, 2020 Author Share Posted January 13, 2020 I did use the script you gave me and tested it as suggested. After fresh installing and making a clean save the spell still doesn't display any message when hitting either a wall or NPC. Link to comment Share on other sites More sharing options...
SurfsideNaturals Posted January 13, 2020 Share Posted January 13, 2020 Ok, If you put this script on the magic effect of your spell and the oneffectstart event is not working. That means either you did not properly add the script or the spell is not working for some reason. It should fire when you hit an NPC with your spell. If you want to see if you can find an event that will fire on the magic effect when you cast your spell you need to get it working properly first. Event OnSpellCast(Form akSpell) ; this is an event that goes on an objectreference. I suspect you may either need to cast some type of spell on the player when you cast this spell or create a quest, make the player a ref alias, and add the Event OnSpellCast(Form akSpell) there. But first you need to get your spell working and the script on it working. Scriptname AMEtestscript extends activemagiceffect Event OnEffectStart(Actor akTarget, Actor akCaster) Debug.Notification("Effect Started") EndEvent Event OnSpellCast(Form akSpell) Debug.Notification("Spell Cast") endEvent Link to comment Share on other sites More sharing options...
maxarturo Posted January 13, 2020 Share Posted January 13, 2020 (edited) 1) Make your spell and test it that it does what you actually want, as a spell alone without any scripts. 2) This will never compile as it is. Scriptname RailgunSpellScript extends activemagiceffect Conditional 'Casting this spell removes a gold coin from the player' {Scriptname RailgunSpellScript extends ActiveMagicEffect MiscObject property Gold001 Auto Int GoldCount = akCaster.GetItemCount(Gold001) 'if player has 0 gold, spell can't be cast' if GoldCount == 0 akCasster.InterruptCast() else 'if spell is cast, remove a gold coin from player inventory' Game.getPlayer().RemoveItem(Gold001, 1) endif EndEvent} 3) The supposed script above has this line "akCasster.InterruptCast()". The "InterruptCast()" does not actually interrupt the casting of the spell by the Player, the "InterruptCast()" is used to stop the casting of constant spell like a Beam, and is most use for objects, it's actually useless on Actors. 4) The first script has no problems, but if you don't fill in the script's properties it'll not do anything. 5) In order to interrupt the spell casting by the Player you need to follow a different approach. Once the spell charge starts there isn't a direct script function that can STOP it. In order to STOP it, if the Player doesn't fill in the requirements, is to listen for "AnimationEvent" and then "Stagger" the Player. * There are also other ways you can do this, but from what you may have understand by now this requires some knowledge of Papyrus, you can't expect to just find online and throw in a script and out of nowhere just work. Edited January 13, 2020 by maxarturo Link to comment Share on other sites More sharing options...
Smegmeister Posted January 13, 2020 Author Share Posted January 13, 2020 I got the spell to remove the item from the inventory. You were right Maxaturo, the script did work, I just didn't understand the properties aspect of it when I first attempted and didn't realize that was the issue. As for keeping the spell from casting and the other spells I want to do, I'm gonna do some much needed reading and tutorials on papyrus to better my understanding. Thanks again Maxaturo, Cumbrianlord, and SurfsideNaturals for all of your help. Link to comment Share on other sites More sharing options...
maxarturo Posted January 13, 2020 Share Posted January 13, 2020 Any time my friend... There are a lot of experienced modders here that are willing to provide unconditional assistance and guidance whenever you may need it. Link to comment Share on other sites More sharing options...
SurfsideNaturals Posted January 13, 2020 Share Posted January 13, 2020 If you want to keep the spell from casting have a look in the CK at spells that only allow the player to cast them at a particular level. They will have conditions on the spell template. That is where you want to put your condition requiring the item to be in the players inventory. I think someone already mentioned that. Here is a slight variation of the script you are working with. It is a good idea to make sure the item is there before attempting to remove it. Also this will allow you to put your spell on any NPC in the game not just the player. You certainly have gotten some really good help and advice here. Have fun!! :thumbsup: Scriptname MySuperSpellScript extends ActiveMagicEffect {Every time this spell is cast it removes an item from the player.} Spell Property MySuperSpell Auto; this property will need to be entered manually, unless the spell ID is 'MySuperSpell' Ingredient Property FireSalts Auto; this property will auto-fill Actor Property PlayerRef Auto; this property will auto-fill Event OnSpellCast(Form akSpell); the event that needs to happen for us to use the script If akSpell == MySuperSpell as form ; has a spell been cast and is it the spell we're concerned with? Else Return EndIf ObjectReference C = GetCasterActor() as ObjectReference If C.GetItemCount(FireSalts) Else Return EndIf C.RemoveItem(FireSalts) ; removes the item from the players inventory. EndEvent Link to comment Share on other sites More sharing options...
cumbrianlad Posted January 14, 2020 Share Posted January 14, 2020 SurfsideNaturals, That script won't compile. It's a variation of the script I posted on page 1 of the thread but you've altered things so it can't compile. Link to comment Share on other sites More sharing options...
SurfsideNaturals Posted January 14, 2020 Share Posted January 14, 2020 (edited) Ya, It is a variation of your script. I just complied the script. Starting 1 compile threads for 1 files...Compiling "A1_ameTestScript"...Starting assembly of A1_ameTestScript0 error(s), 0 warning(s)Assembly succeededCompilation succeeded. This script compiles just fine. Scriptname A1_ameTestScript extends activemagiceffect {Every time this spell is cast it removes an item from the player.} Spell Property MySuperSpell Auto; this property will need to be entered manually, unless the spell ID is 'MySuperSpell' Ingredient Property FireSalts Auto; this property will auto-fill Actor Property PlayerRef Auto; this property will auto-fill Event OnSpellCast(Form akSpell); the event that needs to happen for us to use the script If akSpell == MySuperSpell as form ; has a spell been cast and is it the spell we're concerned with? Else Return EndIf ObjectReference C = GetCasterActor() as ObjectReference If C.GetItemCount(FireSalts) Else Return EndIf C.RemoveItem(FireSalts) ; removes the item from the players inventory. EndEvent Edited January 14, 2020 by SurfsideNaturals Link to comment Share on other sites More sharing options...
cumbrianlad Posted January 14, 2020 Share Posted January 14, 2020 Surfside Naturals, that is my script from page 1, but modified. The modifications to my script mean that it can't compile. Link to comment Share on other sites More sharing options...
SurfsideNaturals Posted January 14, 2020 Share Posted January 14, 2020 Surfside Naturals, that is my script from page 1, but modified. The modifications to my script mean that it can't compile.Hey Cumbrianlad, I just told you that the script complies just fine. Link to comment Share on other sites More sharing options...
Recommended Posts