I simply do not understand this...

Post » Tue Jun 19, 2012 12:48 am

I went in and defined the properties of these magic effects but for some reason if I un-comment these lines it will still crash the compiler...


if (ATHSsleepValue.GetValue() < 25) && (Game.GetPlayer().HasMagicEffect(Rested))
restedBonusOnce = 0
;(Game.GetPlayer().RemoveSpell(Rested))

elseif (ATHSsleepValue.GetValue() < 50) && (Game.GetPlayer().HasMagicEffect(WellRested))
restedBonusOnce = 1
;(Game.GetPlayer().RemoveSpell(WellRested))
;(Game.GetPlayer().AddSpell(Rested))

elseif (ATHSsleepValue.GetValue() < 75) && (Game.GetPlayer().HasMagicEffect(MarriageSleepAbility))
restedBonusOnce = 2
;(Game.GetPlayer().RemoveSpell(MarriageSleepAbility))
;(Game.GetPlayer().AddSpell(WellRested))

endif

MagicEffect Property Rested Auto
MagicEffect Property WellRested Auto
MagicEffect Property MarriageSleepAbility Auto

I just don't understand why this isn't working. It should be really simple!

type mismatch on parameter 1 (did you forget a cast?)
No output generated for ATHSBaseSCRIPT, compilation failed.

Can someone explain this to me in simple terms?
User avatar
Connie Thomas
 
Posts: 3362
Joined: Sun Nov 19, 2006 9:58 am

Post » Tue Jun 19, 2012 8:20 am

does

ATHSsleepValue

actually have a GetValue() method?

I havn't done much papyus yet but i do know C++ and a type mismatch, along with no output would indicate to me either a void return or the method doesn't actually exist, so cant return a value

but, of course, this a guess
User avatar
He got the
 
Posts: 3399
Joined: Sat Nov 17, 2007 12:19 pm

Post » Mon Jun 18, 2012 9:00 pm

Because those are global values from what I can tell you need to use the GetValue()... I am not the greatest programer so I could be wrong.

The lines I am refering to are the commented lines


;(Game.GetPlayer().RemoveSpell(Rested))

;(Game.GetPlayer().RemoveSpell(WellRested))
;(Game.GetPlayer().AddSpell(Rested))

;(Game.GetPlayer().RemoveSpell(MarriageSleepAbility))
;(Game.GetPlayer().AddSpell(WellRested))

For some reason how things are defined in this engine is really confusing. As long as those lines are commented out the code compiles perfectly fine.
User avatar
Racheal Robertson
 
Posts: 3370
Joined: Thu Aug 16, 2007 6:03 pm

Post » Mon Jun 18, 2012 9:23 pm

Have you declared WellRested, MarriageSleepAbility and Rested as spell properties?
User avatar
Leanne Molloy
 
Posts: 3342
Joined: Sat Sep 02, 2006 1:09 am

Post » Mon Jun 18, 2012 11:54 pm

oh, wow, using semi-colins for commenting is really silly, i didn't even see those.

the only thing i see weird about those lines is possibly the parenthesis around each statement but i doubt that's a problem.

sorry i cant help further, good luck
User avatar
Olga Xx
 
Posts: 3437
Joined: Tue Jul 11, 2006 8:31 pm

Post » Mon Jun 18, 2012 6:50 pm

It looks like your properties aren't matching up. Those properties should be "Spell" types, not "MagicEffect" types.

edit for clarity:

Spell Property Rested Auto

And when you change them, do a double-check and make sure they're filled :smile:

edit again: looks like the Welshman beat me to it!
User avatar
Jessica Lloyd
 
Posts: 3481
Joined: Fri Aug 25, 2006 2:11 pm

Post » Tue Jun 19, 2012 3:55 am

I'm not sure what you're doing will work. I assume you want to add a magic effect to the player depending on how well rested they are? The addSpell() command doesn't add an active magic effect, it just adds a spell to the player that can be cast. You'll want to use something like player.cast(spell) instead. And to remove.the effect player.dispell() .
User avatar
ILy- Forver
 
Posts: 3459
Joined: Sun Feb 04, 2007 3:18 am

Post » Tue Jun 19, 2012 10:11 am

I almost have this fully working thank you everyone for your help! :D
User avatar
Klaire
 
Posts: 3405
Joined: Wed Sep 27, 2006 7:56 am


Return to V - Skyrim