Jump to content

Easy Script Creation Help


TangerineDog

Recommended Posts

I tried a new script based on the Well Rested script, and that works. It adds SpellHunger02 correctly after a set period of time. I'll continue to work in that direction.

 

EDIT: Yes, it worked in the test runs. The effect duration and the time it takes 'till the spell is removed are two separate things now, though, and ideally, of course, they should match. I'll post the script tomorrow.

Edited by TangerineDog
Link to comment
Share on other sites

  On 9/26/2016 at 10:20 PM, TangerineDog said:

In C\Users\MyName\Steam.

Hmm... Not sure why you'd have issues that would require you to run in admin mode from that directory. If it were in Program Files then that would be a definite cause for issues.

Oh well, at least it works when in admin mode.

 

Good luck with your modding.

Link to comment
Share on other sites

You're damn right ;)

 

ANyway, here's the script:

 

ScriptName ScriptHunger01 extends activemagiceffect

Spell Property SpellHunger01 Auto
Spell Property SpellHunger02 Auto
Int Property pHoursToWait Auto

Event OnUpdateGameTime()

; debug.trace(self + "OnUpdateGameTime")
Game.GetPlayer().RemoveSpell(SpellHunger01)
Game.GetPlayer().AddSpell(SpellHunger02, false)
Debug.Notification("You are starving")

EndEvent

Event OnEffectStart(Actor akTarget, Actor akCaster)

; start timer
RegisterForSingleUpdateGameTime(pHourstoWait)

EndEvent

 

 

In the properties, I set pHoursToWait to 6, and after 6 hours, I get the notification and have the spell SPellHUnger02 in my active effects, SpellHunger01 gets removed correctly.

 

Now I just have to get food to reduce the hunger, and of course, food is making trouble, too. OnEffectStart seems to work just as well als OnEffectFinish...

Link to comment
Share on other sites

Can you spot the error in this script:

 

 

  Reveal hidden contents

 

 

It's telling me there's a type mismatch in the If and ElseIf lines, each time between the "l" and "a" of Player.

 

EDIT: Maybe it's because I declared the effects as spells. What kind of property is a magic effect?

Edited by TangerineDog
Link to comment
Share on other sites

Probably because it may not like having an ELSE after a series of ELSEIFs

Try this instead:

 

  Reveal hidden contents

 

Link to comment
Share on other sites

Unfortunately, it returns the same error. Maybe it's about the properties after all? I'm looking for a list of the different ones like Spell and Shout, but nothing turned up so far.

 

EDIT: AHA! There was one in the CK. the property type is MagicEffect, and now it compiled like a charm. Now to see if it works.

Edited by TangerineDog
Link to comment
Share on other sites

A magic effect would be MagicEffect. That would be a cause for it to complain if you are using the wrong thing in the function. Don't know why it would specifically mention the IF or ELSEIF statements if that were the case. Unless that were just communication error between your sharing of the error and my interpretation of what was said. Its better to just post the compiler error as that pinpoints the exact line and character position where it sees an issue.

Link to comment
Share on other sites

Update: works. On both scripts. I replaced

  Reveal hidden contents
Edited by TangerineDog
Link to comment
Share on other sites

  • Recently Browsing   0 members

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