Jump to content

Need some script help. Compiling error.


Dyramisty

Recommended Posts

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 exist

c:\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 exist

c:\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 exist

c:\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 exist

c:\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 exist

c:\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 exist

c:\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

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 by Plastrader
Link to comment
Share on other sites

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) native

bool 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

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 function

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(21,19): too many arguments passed to function

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(22,19): too many arguments passed to function

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(23,19): too many arguments passed to function

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(24,19): too many arguments passed to function

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\Base_Add_Conjuration_Selection.psc(25,19): too many arguments passed to function

No output generated for Base_Add_Conjuration_Selection, compilation failed.[/quote']

 

Any idea?

Edited by Dyramisty
Link to comment
Share on other sites

               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

               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

               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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...