Dyramisty Posted February 7, 2013 Share Posted February 7, 2013 Hey guys, For the fifth installment in my "Mind" series I'm writing a new script and I'm having some issues.I hope perhaps one you guys could help me out.Credits will obviously be given. The code I have so far:Scriptname Base_Add_Conjuration_Selection extends ObjectReference {Adds one spell, removes six.} bool Function RemoveSpell(Spell akSpell, bool abVerbose = true) native bool Function AddSpell(Spell akSpell, bool abVerbose = true) native Spell Property SpellToRemove01 auto Spell Property SpellToRemove02 auto Spell Property SpellToRemove03 auto Spell Property SpellToRemove04 auto Spell Property SpellToRemove05 auto Spell Property SpellToRemove06 auto Spell Property SpellToAdd auto Event OnActivate (ObjectReference akActionRef) If akActionRef == Game.GetPlayer() akActionRef.RemoveSpell(SpellToRemove01, false) akActionRef.RemoveSpell(SpellToRemove02, false) akActionRef.RemoveSpell(SpellToRemove03, false) akActionRef.RemoveSpell(SpellToRemove04, false) akActionRef.RemoveSpell(SpellToRemove05, false) akActionRef.RemoveSpell(SpellToRemove06, false) Debug.Trace("Removed all") EndIF If akActionRef == Game.GetPlayer() akActionRef.AddSpell(SpellToAdd) Debug.Trace("Minds synchronised") EndIF EndEvent And this is what the compiler says:c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(20,13): RemoveSpell is not a function or does not existc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(21,13): RemoveSpell is not a function or does not existc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(22,13): RemoveSpell is not a function or does not existc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(23,13): RemoveSpell is not a function or does not existc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(24,13): RemoveSpell is not a function or does not existc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(25,13): RemoveSpell is not a function or does not existc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(30,13): AddSpell is not a function or does not exist I hope someone is able to figure this out. Thanks in advance,Dyramisty Link to comment Share on other sites More sharing options...
Plastrader Posted February 7, 2013 Share Posted February 7, 2013 (edited) RemoveSpell() is part of Actor - Script and not ObjectReference - Script. So: ... Actor MyPlaya = Game.GetPlayer() If (akActionRef == MyPlaya) MyPlaya.RemoveSpell(SpellToRemove01, false) .... EndIf ... No need to credit as you had figured this out eventually :) *edit*And before someone else mention it, you should take as a habit to make the player a property instead of using Game.GetPlayer() Edited February 7, 2013 by Plastrader Link to comment Share on other sites More sharing options...
vinniewryan Posted February 7, 2013 Share Posted February 7, 2013 I'm not sure how you're re-defining the RemoveSpell and Addspell functions, but they are already built into papyrus as:bool Function RemoveSpell(Spell akSpell) nativebool Function AddSpell(Spell akSpell, bool abVerbose = true) native which means you don't have to put this code in your script. Link to comment Share on other sites More sharing options...
Dyramisty Posted February 7, 2013 Author Share Posted February 7, 2013 (edited) RemoveSpell() is part of Actor - Script and not ObjectReference - Script. So: ... Actor MyPlaya = Game.GetPlayer() If (akActionRef == MyPlaya) MyPlaya.RemoveSpell(SpellToRemove01, false) .... EndIf ... No need to credit as you had figured this out eventually :) *edit*And before someone else mention it, you should take as a habit to make the player a property instead of using Game.GetPlayer() Hey man, thanks for that info.However, now I got my code like this:MyPlayer The compiler screams: c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(20' date='19): too many arguments passed to functionc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(21,19): too many arguments passed to functionc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(22,19): too many arguments passed to functionc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(23,19): too many arguments passed to functionc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(24,19): too many arguments passed to functionc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(25,19): too many arguments passed to functionNo output generated for Base_Add_Conjuration_Selection, compilation failed.[/quote'] Any idea? Edited February 7, 2013 by Dyramisty Link to comment Share on other sites More sharing options...
vinniewryan Posted February 7, 2013 Share Posted February 7, 2013 (edited) MyPlaya.RemoveSpell(SpellToRemove01, false) Remove the ', false' from these lines. RemoveSpell only accepts one argument, which in this case is SpellToRemove01. Edited February 7, 2013 by vinniewryan Link to comment Share on other sites More sharing options...
Plastrader Posted February 7, 2013 Share Posted February 7, 2013 MyPlaya.RemoveSpell(SpellToRemove01, false) Remove the ', false' from these lines. RemoveSpell only accepts one argument, which in this case is SpellToRemove01.Yes, I didn't see that, sorry Dyramisty :/ Link to comment Share on other sites More sharing options...
Dyramisty Posted February 7, 2013 Author Share Posted February 7, 2013 MyPlaya.RemoveSpell(SpellToRemove01, false) Remove the ', false' from these lines. RemoveSpell only accepts one argument, which in this case is SpellToRemove01. YOU SIR, HAVE MADE MY DAY. THANKS! And thanks everyone else too of course! Link to comment Share on other sites More sharing options...
Dyramisty Posted February 7, 2013 Author Share Posted February 7, 2013 MyPlaya.RemoveSpell(SpellToRemove01, false) Remove the ', false' from these lines. RemoveSpell only accepts one argument, which in this case is SpellToRemove01.Yes, I didn't see that, sorry Dyramisty :/ That's okay man. I can continue work now so all is good! Link to comment Share on other sites More sharing options...
vinniewryan Posted February 7, 2013 Share Posted February 7, 2013 Happy to help. :thumbsup: Link to comment Share on other sites More sharing options...
Recommended Posts